OSGeo / grass

GRASS GIS - free and open-source geospatial processing engine
https://grass.osgeo.org
Other
816 stars 297 forks source link

t.rast.to.r3 does not produce viewable raster 3D data #3242

Open cmbarton opened 9 months ago

cmbarton commented 9 months ago

Describe the bug I've worked through creating a temporal dataset (STRDS) using the temporal GIS commands and the NC demo set (using the MODIS data). This has all worked fine. I can visualize and analyze the resulting STRDS.

I then create a voxel raster 3D map using t.rast.to.r3. Nothing I do makes this visible. I've created and viewed R3D data previously. But changing the 3D region does not help. Assigning a color table to the original STRDS does not help. Changing the NVIZ settings only allows me to see the wire frame box where the voxel data is supposed to display. I've tried both isosurfaces and slices. It is not just a flat or weird image, there is no image at all. Nothing works.

Expected behavior This should create a viewable 3D data set. And it should produce one without any special adjustment of the 3D region because all the info needed is already in the STRDS metadata.

Screenshots No screenshots because nothing is visible.

System description (please complete the following information):

petrasovaa commented 9 months ago

Please provide a reproducible example, how you create the 3D raster. Otherwise I can't say the problem is in 3D raster data preparation or in the visualization.

cmbarton commented 9 months ago

As I said, I used t.rast.to.rast3 to make the rast3 map, following the manual for that command.

Here is the work flow using the modis_lst2 demo mapset as example.

  1. A normal activity when importing maps is to set to region to match the imported maps. giving the following result.
g.region -p -3 raster=MOD11B3_A2015001_h11v05_single_LST_Day_6km@modis_lst2     
projection: 99 (Lambert Conformal Conic)
zone:       0
datum:      nad83
ellipsoid:  a=6378137 es=0.006694380022900787
north:      760180.12411493
south:      -415819.87588507
west:       -448265.53588469
east:       1550934.46411531
top:        1.00000000
bottom:     0.00000000
nsres:      5600
nsres3:     5600
ewres:      5600
ewres3:     5600
tbres:      1
rows:       210
rows3:      210
cols:       357
cols3:      357
depths:     1
cells:      74970
cells3:     74970
(Fri Nov 17 09:19:20 2023) Command finished (0 sec)            
  1. Following the steps in the t.rast.to.rast3 manual, I then set the 3D resolution with following result.
    g.region -p -3 res3=5600                                                        
    projection: 99 (Lambert Conformal Conic)
    zone:       0
    datum:      nad83
    ellipsoid:  a=6378137 es=0.006694380022900787
    north:      760180.12411493
    south:      -415819.87588507
    west:       -448265.53588469
    east:       1550934.46411531
    top:        1.00000000
    bottom:     0.00000000
    nsres:      5600
    nsres3:     5600
    ewres:      5600
    ewres3:     5600
    tbres:      1
    rows:       210
    rows3:      210
    cols:       357
    cols3:      357
    depths:     1
    cells:      74970
    cells3:     74970
    (Fri Nov 17 09:23:19 2023) Command finished (0 sec)                             

3 Then I converted the STRDS to a rast 3

t.rast.to.rast3 --overwrite input=MOD11B3_2016@modis_lst2 output=MODIS2016STRDS_3D2
Creating 3D raster map
Gran from stds 1.000000000000000

This rast3 does not display in NVIZ

  1. A reasonable way to resolve this is to match the region to the new map
    g.region -p -3 raster_3d=MODIS2016STRDS_3D2@modis_lst2                          
    projection: 99 (Lambert Conformal Conic)
    zone:       0
    datum:      nad83
    ellipsoid:  a=6378137 es=0.006694380022900787
    north:      760180.12411493
    south:      -415819.87588507
    west:       -448265.53588469
    east:       1550934.46411531
    top:        1405.00000000
    bottom:     1393.00000000
    nsres:      5600
    nsres3:     5600
    ewres:      5600
    ewres3:     5600
    tbres:      1
    rows:       210
    rows3:      210
    cols:       357
    cols3:      357
    depths:     12
    cells:      74970
    cells3:     899640

This doesn't display either

cmbarton commented 9 months ago

So the current manual is incorrect and needs to explain how to set the tbres AND top/bottom to numbers that work.

Even better, there is sufficient metadata in the STRDS to have a flag that automatically sets workable values to vertical dimensions. It knows the horizontal resolution and the number of vertical time 'depths'.

t.info input=MOD11B3_2016@modis_lst2                                            
/Applications/GRASS-
8.3.app/Contents/Resources/lib/python3.11/multiprocessing/re
source_tracker.py:224: UserWarning: resource_tracker: There
appear to be 1 leaked semaphore objects to clean up at
shutdown
  warnings.warn('resource_tracker: There appear to be %d '
 +-------------------- Space Time Raster Dataset -----------------------------+
 |                                                                            |
 +-------------------- Basic information -------------------------------------+
 | Id: ........................ MOD11B3_2016@modis_lst2
 | Name: ...................... MOD11B3_2016
 | Mapset: .................... modis_lst2
 | Creator: ................... cmbarton
 | Temporal type: ............. absolute
 | Creation time: ............. 2023-11-15 16:50:16.877082
 | Modification time:.......... 2023-11-15 16:58:39.142012
 | Semantic type:.............. mean
 +-------------------- Absolute time -----------------------------------------+
 | Start time:................. 2016-01-01 00:00:00
 | End time:................... 2017-01-01 00:00:00
 | Granularity:................ 1 month
 | Temporal type of maps:...... interval
 +-------------------- Spatial extent ----------------------------------------+
 | North:...................... 760180.124115
 | South:...................... -415819.875885
 | East:.. .................... 1550934.464115
 | West:....................... -448265.535885
 | Top:........................ 0.0
 | Bottom:..................... 0.0
 +-------------------- Metadata information ----------------------------------+
 | Raster register table:...... raster_map_register_a58cf15ea7ee40808a447e61f974e029
 | North-South resolution min:. 5600.0
 | North-South resolution max:. 5600.0
 | East-west resolution min:... 5600.0
 | East-west resolution max:... 5600.0
 | Minimum value min:.......... 12964.0
 | Minimum value max:.......... 14714.0
 | Maximum value min:.......... 14360.0
 | Maximum value max:.......... 15597.0
 | Aggregation type:........... None
 | Number of semantic labels:.. 0
 | Semantic labels:............ None
 | Number of registered maps:.. 12
 |

If such a flag were set, t.rast.to.rast3 should in this case also run

g.region t=12000 b=0 tbres=1000

[Note the error that seems to show up in any t.x command. Seems to be related to parallel processing]

cmbarton commented 9 months ago

My suggestion was incorrect. This is indeed a bug. Even when I set the tbres correctly in g.region and then create a map, it still doesn't display. Below is the metadata on the resulting rast3 map.

r.to.rast3 does create a map that matches the region settings.

r3.info map=MODIS2016STRDS_3D@modis_lst2                                        
 +----------------------------------------------------------------------------+
 | Layer:    MODIS2016STRDS_3D@modis_lst2   Date: Fri Nov 17 09:51:09 2023    |
 | Mapset:   modis_lst2                     Login of Creator: cmbarton        |
 | Location: nc_spm_08_grass7                                                 |
 | DataBase: /Users/cmbarton/Dropbox (ASU)/GRASS_dropbox/grassdata_dropbox    |
 | Title:    Space time voxel cube                                            |
 | Units:    none                                                             |
 | Vertical unit: months                                                      |
 | Timestamp: 1 Jan 2016 00:00:00 / 1 Jan 2017 00:00:00                       |
 |----------------------------------------------------------------------------|
 |                                                                            |
 |   Type of Map:  raster_3d            Number of Categories: 0               |
 |   Data Type:    DCELL                                                      |
 |   Rows:         210                                                        |
 |   Columns:      357                                                        |
 |   Depths:       12                                                         |
 |   Total Cells:  899640                                                     |
 |   Total size:           543133 Bytes                                       |
 |   Number of tiles:      242                                                |
 |   Mean tile size:       2244 Bytes                                         |
 |   Tile size in memory:  31680 Bytes                                        |
 |   Number of tiles in x, y and  z:   11, 11, 2                              |
 |   Dimension of a tile in x, y, z:   33, 20, 6                              |
 |                                                                            |
 |        Projection: Lambert Conformal Conic (zone 0)                        |
 |            N: 760180.12411493    S: -415819.87588507   Res:  5600          |
 |            E: 1550934.46411531    W: -448265.53588469   Res:  5600         |
 |            T:       1405    B:       1393   Res:     1                     |
 |   Range of data:   min =      12964 max =      15597                       |
 |                                                                            |
 |   Data Source:                                                             |
 |                                                                            |
 |                                                                            |
 |                                                                            |
 |   Data Description:                                                        |
 |    This space time voxel cube was created with t.rast.to.rast3  
petrasovaa commented 9 months ago

This looks fine. For the visualization, you would have to set the computational region to match this 3D raster and then in 3D you need to set high vertical exaggeration. You can display the wire box to give you an idea where you should be seeing the data. Other than that, I don't know, it works for me. Try to use slices first, they may be more obvious than the isosurfaces.

cmbarton commented 9 months ago

I forgot to say that I did set the vertical region to 0 bottom, 12000 top, and 1000 res when I made the rast3. These settings are ignored by t.rast.to.rast3. The values I show are the ones it always makes with these 12 time slices, regardless of the region settings.The region settings are not ignored by r.to.rast3Michael Barton...Sent from my iPadOn Nov 17, 2023, at 2:28 PM, Anna Petrasova @.***> wrote: This looks fine. For the visualization, you would have to set the computational region to match this 3D raster and then in 3D you need to set high vertical exaggeration. You can display the wire box to give you an idea where you should be seeing the data. Other than that, I don't know, it works for me. Try to use slices first, they may be more obvious than the isosurfaces.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>