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

Joe Lee hyoklee at hdfgroup.org
Thu Jul 25 12:57:44 PDT 2019


Thanks, Even for the quick answer!

I tried it but I get "ERROR 6":

[nene:gdal/gdal/apps] hyoklee%  ./gdalmdimtranslate -array name='/HDFEOS/SWATHS/MOP02/Data Fields/RetrievedSurfaceTemperature',view=\[:,0\]  ~/NASAHDF/MOP02J-20131129-L2V17.8.3.he5  test.tif
ERROR 6: Unsupported number of dimensions


On 7/25/19, 2:39 PM, "Even Rouault" <even.rouault at spatialys.com> wrote:

    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