GDALMDIMTRANSLATE(1) | GDAL | GDALMDIMTRANSLATE(1) |
gdalmdimtranslate - Converts multidimensional data between different formats, and perform subsetting.
gdalmdimtranslate [--help-general] [-co "NAME=VALUE"]*
[-if format]* [-of format]
[-array <array_spec>]*
[-group <group_spec>]*
[-subset <subset_spec>]*
[-scaleaxes <scaleaxes_spec>]*
[-oo NAME=VALUE]*
<src_filename> <dst_filename>
gdalmdimtranslate program converts multidimensional raster between different formats, and/or can perform selective conversion of specific arrays and groups, and/or subsetting operations.
The following command line parameters can appear in any order.
New in version 3.2.
The creation options available vary by format driver, and some simple formats have no creation options at all. A list of options supported for a format can be listed with the --formats command line option but the documentation for the format is the definitive source of information on driver creation options. See Raster drivers format specific documentation for legal creation options for each format.
Array-level creation options may be passed by prefixing them with ARRAY:. See GDALGroup::CopyFrom() for further details regarding such options.
<array_spec> may be just an array name, potentially using a fully qualified syntax (/group/subgroup/array_name). Or it can be a combination of options with the syntax: name={src_array_name}[,dstname={dst_array_name}][,transpose=[{axis1},{axis2},...][,view={view_expr}]
[{axis1},{axis2},...] is the argument of GDALMDArray::Transpose(). For example, transpose=[1,0] switches the axis order of a 2D array.
{view_expr} is the value of the viewExpr argument of GDALMDArray::GetView()
When specifying a view_expr that performs a slicing or subsetting on a dimension, the equivalent operation will be applied to the corresponding indexing variable.
<group_spec> may be just a group name, potentially using a fully qualified syntax (/group/subgroup/subsubgroup_name). Or it can be a combination of options with the syntax: name={src_group_name}[,dstname={dst_group_name}][,recursive=no]
That is dim_name(min_val,max_val) or dim_name(sliced_val) The first syntax will subset the dimension dim_name to values in the [min_val,max_val] range. The second syntax will slice the dimension dim_name to value sliced_val (and this dimension will be removed from the arrays that reference to it)
Using -subset is incompatible of specifying a view option in -array.
<scaleaxes_spec> follows exactly the syntax of the KVP encoding of the SCALEAXES parameter of OGC WCS 2.0 Scaling Extension, but limited to integer scale factors.
That is dim1_name(scale_factor)[,dim2_name(scale_factor)]*
Using -scaleaxes is incompatible of specifying a view option in -array.
Source dataset open option (format specific)
This utility is also callable from C with GDALMultiDimTranslate().
$ gdalmdimtranslate in.nc out.vrt
$ gdalmdimtranslate in.nc out.tif -subset 'time("2010-01-01")' -array temperature
$ gdalmdimtranslate in.nc out.nc -array "name=temperature,view=[:,::-1,:]"
$ gdalmdimtranslate in.nc out.nc -array "name=temperature,transpose=[2,1,0]"
Even Rouault <even.rouault@spatialys.com>
1998-2023
January 2, 2023 |