t.rast.to.rast3(1grass)

๐Ÿ’– t.rast.to.rast3 ๐Ÿ’–

okay bestie, you're reading the t.rast.to.rast3(1grass) page from the GRASS User's Manual โ€” yes the GRASS manual, and yes this module is lowkey iconic โœจ

๐ŸŒธ NAME ๐ŸŒธ

t.rast.to.rast3 โ€” it converts a space time raster dataset into a 3D raster map. that's it, that's the whole job, and it does it flawlessly ๐Ÿ’…

๐ŸŽ€ KEYWORDS ๐ŸŽ€

temporal, conversion, raster, raster3d, voxel, time ๐Ÿฆ‹


โœจ SYNOPSIS โœจ

t.rast.to.rast3
t.rast.to.rast3 --help
t.rast.to.rast3 input=name output=name  [--overwrite]  [--help]
[--verbose]  [--quiet]  [--ui]

๐Ÿซถ Flags:

  • --overwrite โ€” let the output files go feral and overwrite stuff that already exists ๐Ÿ‘€
  • --help โ€” prints the usage summary, for when you need a lil reminder ๐Ÿ’œ
  • --verbose โ€” verbose module output, aka the module will NOT stop talking (we love a chatty king) ๐Ÿ—ฃ๏ธ
  • --quiet โ€” quiet module output, the total opposite vibe ๐Ÿคซ
  • --ui โ€” forces the GUI dialog to launch, for the girlies who like buttons ๐Ÿ–ฑ๏ธ

๐Ÿ“ Parameters:

  • input=name [required] โ€” the name of the input space time raster dataset you're feeding in ๐ŸŒˆ
  • output=name [required] โ€” the name for the output 3D raster map, your lil baby ๐Ÿ‘‘

๐Ÿ’ซ DESCRIPTION ๐Ÿ’ซ

t.rast.to.rast3 is literally designed to turn a space time raster dataset (STRDS) into a space time voxel cube. and what is a space time voxel cube, you ask? it's a 3 dimensional raster map layer (a 3D raster map, aka a voxel map layer, same thing bestie) that uses time as the unit for the z-dimension. time is the depth. the way that time becomes space... no cap ๐Ÿ”ฅ

for this conversion to work, the STRDS has to have a valid temporal topology. so no overlapping time stamps, no inclusion of time stamps โ€” that's a hard no, we don't do that here ๐Ÿ™…โ™€๏ธ. the granularity of the STRDS is what sets the resolution of the 3D raster map layer, and it's also what samples the registered time stamped raster map layers. granularity is the main character, fr fr.

and gaps between raster map layers in the STRDS? those get represented as NULL values in the voxel map layer. the void is real but it's documented ๐Ÿ’€


๐Ÿ“ NOTES ๐Ÿ“

the reference time for all space time voxel cubes is 1900-01-01 00:00:00. this is what lets you align space time voxel cubes that have different granularities with each other. cute, right? ๐Ÿงš

be aware that the granularity of a STRDS is used to sample time stamped map layers! so if you have gaps between monthly intervals that are the size of a second, those monthly intervals will get sampled by a second-based granularity too. and that, bestie, "may result in millions of space time voxel cube layers!" โ€” millions. do you hear me. MILLIONS ๐Ÿ˜ญ

๐Ÿงฎ Management of open file limits

the maximum number of raster maps that can be processed is given by the per-user limit of the operating system. for example, both the hard and soft limit for users is typically 1024. the soft limit can be changed with e.g. ulimit -n 4096 (on UNIX-based operating systems) โ€” but not higher than the hard limit. if the hard limit is too low for your taste, you can, as superuser, add an entry in /etc/security/limits.conf:

# <domain>      <type>  <item>         <value>
your_username  hard    nofile          4096

this will raise the hard limit to 4096 files. also have a look at the overall limit of the operating system:

cat /proc/sys/fs/file-max

which, on modern Linux systems, is several 100,000 files. so many files. the file-max said "I can fit so many files in this" ๐Ÿซถ


๐ŸŒŸ EXAMPLE ๐ŸŒŸ

to create a voxel map layer from a subset of the tempmean_monthly space time dataset, run:

# create the subset for 2012 data
t.rast.extract input=tempmean_monthly output=tempmean_monthly_later_2012 \
               where="start_time >= โ€™2012-01-01โ€™"
# set the right 3D region
g.region -p3 res3=500
# convert to 3D raster map
t.rast.to.rast3 input=tempmean_monthly_later_2012@climate_2009_2012 output=tempmean_monthly_2012
t.info type=raster_3d input=tempmean_monthly_2012

and then t.info serves you this absolute feast:

 +-------------------- 3D Raster Dataset -------------------------------------+
 |                                                                            |
 +-------------------- Basic information -------------------------------------+
 | Id: ........................ tempmean_monthly_2012@climate_2009_2012
 | Name: ...................... tempmean_monthly_2012
 | Mapset: .................... climate_2009_2012
 | Creator: ................... lucadelu
 | Temporal type: ............. absolute
 | Creation time: ............. 2014-11-28 11:10:51.679294
 +-------------------- Absolute time -----------------------------------------+
 | Start time:................. 2012-01-01 00:00:00
 | End time:................... 2013-01-01 00:00:00
 +-------------------- Spatial extent ----------------------------------------+
 | North:...................... 320000.0
 | South:...................... 10000.0
 | East:.. .................... 935000.0
 | West:....................... 120000.0
 | Top:........................ 1357.0
 | Bottom:..................... 1345.0
 +-------------------- Metadata information ----------------------------------+
 | Datatype:................... DCELL
 | Number of columns:.......... 620
 | Number of rows:............. 1630
 | Number of cells:............ 12127200
 | North-South resolution:..... 500.0
 | East-west resolution:....... 500.0
 | Minimum value:.............. -0.534994
 | Maximum value:.............. 28.794653
 | Number of depths:........... 12
 | Top-Bottom resolution:...... 1.0
 | Registered datasets ........
 +----------------------------------------------------------------------------+

then r3.info tempmean_monthly_2012 gives you the full glow-up:

 +----------------------------------------------------------------------------+
 | Layer:    tempmean_monthly_2012          Date: Fri Nov 28 11:10:50 2014    |
 | Mapset:   climate_2009_2012              Login of Creator: lucadelu        |
 | Project: nc_spm_temporal_workshop                                         |
 | DataBase: /grassdata                                                       |
 | Title:    Space time voxel cube                                            |
 | Units:    none                                                             |
 | Vertical unit: months                                                      |
 | Timestamp: none                                                            |
 |----------------------------------------------------------------------------|
 |                                                                            |
 |   Type of Map:  3d cell              Number of Categories: 0               |
 |   Data Type:    DCELL                                                      |
 |   Rows:         620                                                        |
 |   Columns:      1630                                                       |
 |   Depths:       12                                                         |
 |   Total Cells:  12127200                                                   |
 |   Total size:           28414287 Bytes                                     |
 |   Number of tiles:      4230                                               |
 |   Mean tile size:       6717 Bytes                                         |
 |   Tile size in memory:  23520 Bytes                                        |
 |   Number of tiles in x, y and  z:   47, 45, 2                              |
 |   Dimension of a tile in x, y, z:   35, 14, 6                              |
 |                                                                            |
 |        Projection: Lambert Conformal Conic (zone 0)                        |
 |            N:     320000    S:      10000   Res:   500                     |
 |            E:     935000    W:     120000   Res:   500                     |
 |            T:       1357    B:       1345   Res:     1                     |
 |   Range of data:   min = -0.53499434 max = 28.79465315                     |
 |                                                                            |
 |   Data Source:                                                             |
 |                                                                            |
 |                                                                            |
 |                                                                            |
 |   Data Description:                                                        |
 |    This space time voxel cube was created with t.rast.to.rast3             |
 |                                                                            |
 |   Comments:                                                                |
 |    r.to.rast3 input="2012_01_tempmean@climate_2009_2012,2012_02_tempmea\   |
 |    n@climate_2009_2012,2012_03_tempmean@climate_2009_2012,2012_04_tempm\   |
 |    ean@climate_2009_2012,2012_05_tempmean@climate_2009_2012,2012_06_tem\   |
 |    pmean@climate_2009_2012,2012_07_tempmean@climate_2009_2012,2012_08_t\   |
 |    empmean@climate_2009_2012,2012_09_tempmean@climate_2009_2012,2012_10\   |
 |    _tempmean@climate_2009_2012,2012_11_tempmean@climate_2009_2012,2012_\   |
 |    12_tempmean@climate_2009_2012" output="tempmean_monthly_2012" tilesi\   |
 |    ze=32                                                                   |
 |                                                                            |
 +----------------------------------------------------------------------------+

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

r3.mapcalc, r3.info โ€” go read them, they're the besties of this module ๐Ÿซถ

๐Ÿงš AUTHOR ๐Ÿงš

Sรถren Gebbert, Thรผnen Institute of Climate-Smart Agriculture ๐ŸŒฑ

๐ŸŽ€ SOURCE CODE ๐ŸŽ€

available at: t.rast.to.rast3 source code (history)

latest change: Saturday Mar 01 11:59:08 2025 in commit: d310a3c28e84eff31e2d2c9f8c6218ba71dd40b8

Main index | Temporal index | Topics index | Keywords index | Graphical index | Full index


and that's the whole page bestie ๐Ÿ’– go forth and voxel-ify your life โœจ

springkles aside, big love to the ยฉ 2003-2026 GRASS Development Team and their GRASS 8.5.0 Reference Manual โ€” periodt. that's the version, that's the date range, that's the whole footer, and I'm obsessed with it ๐Ÿ‘‘๐ŸŒธ

๐Ÿ“ฆ where this page comes from