[gdal-dev] Motion: adopt RFC 75: Multidimensional array

Even Rouault even.rouault at spatialys.com
Thu Jul 25 12:39:39 PDT 2019


On jeudi 25 juillet 2019 19:12:02 CEST Joe Lee wrote:
> I'm glad that this motion has passed!
> 
> I got one question after reviewing Even's latest code and RFC.
> 
> Does it consider a case that subsets 1d dataset from 2d dataset [1]?
> The organization of MOP02J (1-D SWATH) and its shape is like below:
> 
> dset[2][n_points]
> lat[n_points]
> lon[n_points]
> 
> I wish I could be able to extract 1D from 2D using dset[n_points][0] and
> make a GeoTIFF grid from the scattered dset/lat/lon using a tool like [2]
> or
 gdalwarp with 3 VRTs that correspond to 1D lat/lon/dset.
> 
> To help you understand the case better,
> the equivalent Python code is available in [3].
> 
> If this workflow can be already done,
> can anyone give me a series of commands to be executed?

As far as I understand your need, this could probably be done with a gdalmdimtranslate invokation
(or possibly several ones and assemble manually a VRT)

https://gdal.org/programs/gdalmdimtranslate.html#gdalmdimtranslate

to extract 1D from 2D, you would do something like

gdalmdimtranslate in out -array name=dset,view=[:,0]

The view argument can be used to use numpy-style indexing & slicing:
https://gdal.org/api/gdalmdarray_cpp.html#_CPPv4NK11GDALMDArray7GetViewERKNSt6stringE 

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list