Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libpython/temporal: fix t.rast.import module import input tarball file #3591

Merged
merged 5 commits into from
Apr 17, 2024

Conversation

tmszi
Copy link
Member

@tmszi tmszi commented Apr 13, 2024

Fixes #3581.

Fix read/write missing semantic label column from the list.txt file.
@tmszi tmszi added this to the 8.4.0 milestone Apr 13, 2024
@tmszi tmszi self-assigned this Apr 13, 2024
@github-actions github-actions bot added Python Related code is in Python libraries labels Apr 13, 2024
@tmszi tmszi added the bug Something isn't working label Apr 13, 2024
veroandreo
veroandreo previously approved these changes Apr 13, 2024
Copy link
Contributor

@veroandreo veroandreo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it works as expected :)

@echoix
Copy link
Member

echoix commented Apr 13, 2024

Is there a way to trigger the old bug in a test without a specific dataset (even better just function calls)?
I know it's not fun...

@tmszi
Copy link
Member Author

tmszi commented Apr 13, 2024

I'm a little bit confused with printing semantic label.

I modified temporal data sample.zip semantic labels inside list.txt file as follows:

zaplava_180.5|1|1|S2_1
zaplava_180.6|11|11|S2_2
zaplava_180.7|21|21|S2_3

Importing temporal raster maps was successful:

GRASS newProject/PERMANENT:~ > t.rast.import in=/tmp/exp/strds_export.tar.bz2 output=sample --o
Checking validity of input file (size: 0.0 MB). Make take a while...
Extracting data...
WARNING: Raster map <zaplava_180.5> already exists and will be overwritten
Importing raster map <zaplava_180.5>...
 100%
Color table for raster map <zaplava_180.5> set to 'zaplava_180.5.color'
WARNING: Raster map <zaplava_180.6> already exists and will be overwritten
Importing raster map <zaplava_180.6>...
 100%
Color table for raster map <zaplava_180.6> set to 'zaplava_180.6.color'
WARNING: Raster map <zaplava_180.7> already exists and will be overwritten
Importing raster map <zaplava_180.7>...
 100%
Color table for raster map <zaplava_180.7> set to 'zaplava_180.7.color'
 100%
 100%

Checking semantic labels with t.info module was successful:

GRASS newProject/PERMANENT:~ > t.info sample 
 +-------------------- Space Time Raster Dataset -----------------------------+
 |                                                                            |
 +-------------------- Basic information -------------------------------------+
 | Id: ........................ sample@PERMANENT
 | Name: ...................... sample
 | Mapset: .................... PERMANENT
 | Creator: ................... tomas
 | Temporal type: ............. relative
 | Creation time: ............. 2024-04-13 19:43:08.895144
 | Modification time:.......... 2024-04-13 19:43:09.374256
 | Semantic type:.............. sum
 +-------------------- Relative time -----------------------------------------+
 | Start time:................. 1
 | End time:................... 21
 | Relative time unit:......... minutes
 | Granularity:................ 10
 | Temporal type of maps:...... point
 +-------------------- Spatial extent ----------------------------------------+
 | North:...................... 1.0
 | South:...................... 0.0
 | East:.. .................... 1.0
 | West:....................... 0.0
 | Top:........................ 0.0
 | Bottom:..................... 0.0
 +-------------------- Metadata information ----------------------------------+
 | Raster register table:...... raster_map_register_0b33293e385f48e5984c3ed1bd5f3793
 | North-South resolution min:. 1.0
 | North-South resolution max:. 1.0
 | East-west resolution min:... 1.0
 | East-west resolution max:... 1.0
 | Minimum value min:.......... None
 | Minimum value max:.......... None
 | Maximum value min:.......... None
 | Maximum value max:.......... None
 | Aggregation type:........... None
 | Number of semantic labels:.. 3
 | Semantic labels:............ S2_1,S2_2,S2_3
 | Number of registered maps:.. 3
 |
 | Title:
 | 
 | Description:
 | 
 | Command history:
 | # 2024-04-13 19:43:09 
 | t.rast.import in="/tmp/exp/strds_export.tar.bz2"
 |     output="sample" --o
 | 
 +----------------------------------------------------------------------------+

Checking individual raster map semantic label with r.info module was successful too:

GRASS newProject/PERMANENT:~ > r.info zaplava_180.5
 +----------------------------------------------------------------------------+
 | Map:      zaplava_180.5                  Date: Sat Apr 13 20:09:00 2024    |
 | Mapset:   PERMANENT                      Login of Creator: tomas           |
 | Project:  newProject                                                       |
 | DataBase: /home/tomas/grassdata                                            |
 | Title:                                                                     |
 | Timestamp: 1 minute                                                        |
 |----------------------------------------------------------------------------|
 |                                                                            |
 |   Type of Map:  raster               Number of Categories: 0               |
 |   Data Type:    FCELL                Semantic label: S2_1                  |
 |   Rows:         1                                                          |
 |   Columns:      1                                                          |
 |   Total Cells:  1                                                          |
 |        Projection: S-JTSK / Krovak East North                              |
 |            N:          1    S:          0   Res:     1                     |
 |            E:          1    W:          0   Res:     1                     |
 |   Range of data:    min = NULL  max = NULL                                 |
 |                                                                            |
 |   Data Description:                                                        |
 |    generated by r.in.gdal                                                  |
 |                                                                            |
 |   Comments:                                                                |
 |    r.in.gdal --overwrite input="zaplava_180.5.tif" output="zaplava_180.\   |
 |    5" memory=150 offset=0 num_digits=0                                     |
 |                                                                            |
 +----------------------------------------------------------------------------+

But checking individual raster map semantic label with r.semantic.label module doesn't print semantic label:

GRASS newProject/PERMANENT:~ > r.semantic.label zaplava_180.5 operation=print
WARNING: Metadata for semantic label <None> not found

@tmszi
Copy link
Member Author

tmszi commented Apr 13, 2024

Is there a way to trigger the old bug in a test without a specific dataset (even better just function calls)? I know it's not fun...

I can extend t.rast.import module tests by test of import temporal raster maps with semantic labels, and check them.

@tmszi
Copy link
Member Author

tmszi commented Apr 14, 2024

But checking individual raster map semantic label with r.semantic.label module doesn't print semantic label:

It is bug (method semantic_label argument is assigned to wrong parameter), I'm going to open related PR #3595.

@github-actions github-actions bot added temporal Related to temporal data processing module labels Apr 14, 2024
@tmszi tmszi requested a review from echoix April 16, 2024 19:37
@tmszi tmszi merged commit 94e398b into OSGeo:main Apr 17, 2024
26 checks passed
@tmszi tmszi deleted the t_rast_import-fix-import-input-file branch April 17, 2024 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working libraries module Python Related code is in Python temporal Related to temporal data processing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] t.rast.import fails with ValueError
4 participants