[gdal-dev] multidim arraySpecs/GetView

Michael Sumner mdsumner at gmail.com
Wed Aug 30 00:13:20 PDT 2023


Hi, hoping to check my syntax ... or expectations ... I'm expecting this to
subset by step the 20x20 array in this netcdf, but getting no change in
python MultiDimTranslate or at command line:

ds = gdal.OpenEx('gdrivers/data/netcdf/byte_no_cf.nc',
gdal.OF_MULTIDIM_RASTER)

nds = gdal.MultiDimTranslate("/vsimem/array_view.zarr", ds, format="Zarr",
arraySpecs=['name=Band1,view=[::2,::4]'])
nds.GetRootGroup().OpenMDArray("Band1").GetShape()
# (20, 20)

Directly with the python GetView api it works

ds.GetRootGroup().OpenMDArray("Band1").GetView("[::2,::4]").GetShape()
# (10, 5)

Am I specifying the view wrong in MultiDimTranslate?

Thanks, Mike

I've put fuller notes here in case the email is a problem:
https://gist.github.com/mdsumner/028d089ad9a960267347f891c058fc9a

--
Michael Sumner
Software and Database Engineer
Australian Antarctic Division
Hobart, Australia
e-mail: mdsumner at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20230830/4355ab1d/attachment.htm>


More information about the gdal-dev mailing list