Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions apps/gdalalg_mdim_convert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,18 @@ GDALMdimConvertAlgorithm::GDALMdimConvertAlgorithm()
AddArg("group", 0,
_("Select a single group instead of converting the whole dataset."),
&m_groups)
.SetMetaVar("<GROUP-SPEC>");
.SetMetaVar("<GROUP-SPEC>")
.SetPackedValuesAllowed(false);

AddArg("subset", 0, _("Select a subset of the data."), &m_subsets)
.SetMetaVar("<SUBSET-SPEC>");
.SetMetaVar("<SUBSET-SPEC>")
.SetPackedValuesAllowed(false);

AddArg("scale-axes", 0,
_("Applies a integral scale factor to one or several dimensions"),
&m_scaleAxes)
.SetMetaVar("<SCALEAXES-SPEC>");
.SetMetaVar("<SCALEAXES-SPEC>")
.SetPackedValuesAllowed(false);

AddArg("strict", 0, _("Turn warnings into failures."), &m_strict);
}
Expand Down
30 changes: 22 additions & 8 deletions doc/source/programs/gdal_mdim_convert.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Standard options
<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]
``name={src_group_name}[,dstname={dst_group_name}][,recursive=no]``

.. option:: --subset <subset_spec>

Expand All @@ -107,15 +107,19 @@ Standard options
<subset_spec> follows exactly the `OGC WCS 2.0 KVP encoding <https://portal.opengeospatial.org/files/09-147r3>`__
for subsetting.

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
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)

Beware that dimension name is case sensitive.

Several subsetting operations along different dimensions can be specified by repeating the option.

Using --subset is incompatible with specifying a *view* option in --array.

See :example:`mdim-convert-subset-1`.
See :example:`mdim-convert-subset-1` or :example:`mdim-convert-subset-2`.

.. option:: --scale-axes <scaleaxes_spec>

Expand All @@ -127,9 +131,11 @@ Standard options
`OGC WCS 2.0 Scaling Extension <https://portal.opengeospatial.org/files/12-039>`__,
but limited to integer scale factors.

That is <dim1_name>(<scale_factor>)[,<dim2_name>(<scale_factor>)]...
That is ``<dim1_name>(<scale_factor>)``.

Using --scaleaxes is incompatible with specifying a *view* option in --array.
Several scaling operations along different dimensions can be specified by repeating the option.

Using --scale-axes is incompatible with specifying a *view* option in --array.

See :example:`mdim-convert-subsample-1`.

Expand Down Expand Up @@ -165,12 +171,20 @@ Examples
gdal mdim convert in.nc out.tif --subset "time(\"2010-01-01\")" --array temperature

.. example::
:title: Subsample along X and Y axis
:title: Extract a a 3D chunk from a time-indexed GRIB file into a multiband GeoTIFF.
:id: mdim-convert-subset-2

.. code-block:: bash

gdal mdim convert /vsicurl/https://tgftp.nws.noaa.gov/SL.us008001/ST.opnl/DF.gr2/DC.ndfd/AR.conus/VP.001-003/ds.qpf.bin tst.tif --subset "TIME(1763164800,1763251200)" --array QPF_0-SFC --co COMPRESS=DEFLATE

.. example::
:title: Subsample along x and y axis
:id: mdim-convert-subsample-1

.. code-block:: bash

gdal mdim convert in.nc out.nc --scaleaxes "X(2),Y(2)"
gdal mdim convert in.nc out.nc --scale-axes "x(2),y(2)"

.. example::
:title: Reorder the values of an array
Expand Down
Loading