GDALMultidimensional

gdalmdimtranslate

What is gdalmdimtranslate?

gdalmdimtranslate is the multidimensional counterpart of gdal_translate. It converts and subsets multidimensional rasters (NetCDF, HDF5, Zarr, GRIB) by selecting arrays, slicing along named dimensions, and writing either another multidimensional dataset or a classical 2D raster. This is how you go from a monolithic CMIP6 NetCDF file to a GeoTIFF of, say, one temperature variable at one time step for one region.

Shell
gdalmdimtranslate [options] <src> <dst>

Commonly used options:

  • -of <format> — output driver (classical or multidim)
  • -array <spec> — select a specific array, with optional options like view to slice or transpose
  • -group <path> — select a group
  • -subset <subset_spec> — subset a dimension, e.g. time("2020-01-01","2020-12-31") or lat(-30,30)
  • -scaleaxes <spec> — downsample along specified dimensions
  • -co <NAME>=<VALUE> — creation option
  • -strict — fail rather than produce partial output on unsupported operations
  • -oo <NAME>=<VALUE> — open option

When would you use gdalmdimtranslate?

Use gdalmdimtranslate whenever you want a specific slice of a multidimensional dataset. Typical jobs: extracting a single time step of sea-surface temperature from a NetCDF into a GeoTIFF (gdalmdimtranslate sst.nc sst_20240601.tif -array sst -subset "time(\"2024-06-01\")"), clipping a global ERA5 variable to a regional bounding box (-subset 'lat(30,60)' -subset 'lon(-10,30)'), or downsampling a 1-km Zarr cube along latitude and longitude for a quick overview (-scaleaxes "lat(4),lon(4)").

For going from multidim to classical GeoTIFF, the result has the same geospatial semantics as gdal_translate output — it can be warped, tiled, or fed into any raster pipeline. For going multidim-to-multidim (e.g. NetCDF to Zarr), gdalmdimtranslate is the right path because it preserves groups, dimensions, and attributes that gdal_translate cannot represent.

FAQs

How do I subset by time?

Pass -subset "time(\"ISO-timestamp\")" for a single step, or -subset "time(\"start\",\"end\")" for a range. The dimension name (time) must match what gdalmdiminfo reports. For integer time indices, use -array name,view=[time=0] to slice by position rather than value.

Can I convert NetCDF to Zarr with this tool?

Yes: gdalmdimtranslate in.nc out.zarr -of Zarr. Multidimensional drivers preserve group structure and dimensions across the conversion. Useful for producing cloud-friendly Zarr stores from NetCDF archives for downstream parallel access.

What is the difference between -array and -group?

-group selects a subtree of the dataset hierarchy and includes all its arrays and subgroups. -array selects a single variable, optionally with a view slicing clause. Use -group for bulk extraction of related variables, -array when you only need one.

How do I emit a 2D classical raster from a multidim source?

Select a single array and subset all non-spatial dimensions until only y,x remain, then output to a classical driver: gdalmdimtranslate in.nc out.tif -array temperature -subset "time(\"2024-06-01\")" -of GTiff. If the array has more than two remaining dimensions, the output will fail unless you reduce it to 2D first.