GRASS logo

NAME

t.rast.exporttree - Export raster maps from a STRDS to GeoTiff format in a temporal directory structure.

KEYWORDS

temporal, move, export, GDAL, directory

SYNOPSIS

t.rast.exporttree
t.rast.exporttree --help
t.rast.exporttree [-fsn] input=name [where=sql_query] output_directory=name [format=string] [compression=string] [level=integer] [resampling=string] [minimal_overview_size=integer] [temporal_tree=string] [separator=character] [nprocs=integer] [--help] [--verbose] [--quiet] [--ui]

Flags:

-f
Force export of floating point maps as Float32
Force export of floating point maps as Float32
-s
Use semantic label in directory structure
Use semantic label in directory structure
-n
Export NoData maps as Byte
Export NoData maps as Byte, default is to skip export of maps with only NoData
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--ui
Force launching GUI dialog

Parameters:

input=name [required]
Name of the input space time raster dataset
where=sql_query
WHERE conditions of SQL statement without 'where' keyword used in the temporal GIS framework
Example: start_time > '2001-01-01 12:30:00'
output_directory=name [required]
Path to the output / destination directory
format=string
Geotiff format flavor to export
Options: COG, GTiff
Default: COG
compression=string
Compression method to be used for the output GeoTiffs
Options: LZW, ZSTD, DEFLATE, LERC
Default: ZSTD
level=integer
Compression level for the output files (0-22), GDAL default for ZSTD is 9, for DEFLATE is 6
resampling=string
Resampling to be used for overviews
Options: NEAREST, AVERAGE, BILINEAR, CUBIC, CUBICSPLINE, LANCZOS, MODE, RMS
minimal_overview_size=integer
Minimal size of overview tiles (default=256)
Default: 256
temporal_tree=string
Strftime format to create temporal directory name or tree (e.g. "%Y/%m/%d")
separator=character
Field separator
Special characters: pipe, comma, space, tab, newline
Default: pipe
nprocs=integer
Number of threads for parallel computing
Default: 1

Table of contents

DESCRIPTION

t.rast.exporttree is a wrapper module around r.out.gdalto export raster maps from a STRDS to GeoTiffs in a temporal directory tree. The tree structure can be defined with the temporal_tree option and the s-flag (to include the semantic_label in the directory structure). The output directory needs to exist, but the directory structure below will be created if necessary. Parallel export of maps is supported with the nprocs option.

EXAMPLES

temp_dir=$(g.tempfile -d pid=1)
mkdir $temp_dir
target_dir=$(g.tempfile -d pid=1)
mkdir $target_dir

g.region -ag s=0 n=80 w=0 e=120 res=1
r.external.out format="GTiff" directory=$temp_dir extension="tif" options="COMPRESS=LZW"
for rmap_idx in 1 2 3
do
  for prefix in a b
  do
    r.mapcalc expression="${prefix}_${rmap_idx} = ${rmap_idx}00 --overwrite
    r.support map="${prefix}_${rmap_idx} semantic_label=$prefix
  done
done
t.create type="strds" temporaltype="absolute" output="A" \
    title="A test" description="A test" --overwrite
t.register -i type="raster" input="A" maps="a_1,a_2,a_3" \
    start="2001-01-01" increment="3 months" --overwrite
t.create type="strds" temporaltype="absolute" output="B" \
    title="B test" description="B test" --overwrite
t.register -i type="raster" input="B" maps="b_1,b_2,b_3" \
    start="2001-01-01" increment="1 day" --overwrite

t.rast.exporttree -f input="A" temporal_tree="%Y/%m" nprocs=2 \
    output_directory=$target_dir

t.rast.copytree -s input="B" temporal_tree="%Y/%m/%d" nprocs=2 \
output_directory=$target_dir

AUTHOR

Stefan Blumentrath

SOURCE CODE

Available at: t.rast.exporttree source code (history)

Accessed: Wednesday Aug 20 11:09:16 2025


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

© 2003-2025 GRASS Development Team, GRASS GIS 8.4.1 Reference Manual