You may use the multidimensional API for that :
https://gdal.org/drivers/raster/vrt_multidimensional.html . Typically
the <SourceTranspose> element is relevant. Note however that on-the-fly
transposing can have bad performance, but for the relatively small image
you mention, that might be OK. That said, you'd may be better using the
MDim API ( https://gdal.org/tutorials/multidimensional_api_tut.html)
directly to get a numpy array and use numpy native transpose capabilities.
Le 02/06/2023 à 18:30, Daniel Scheffler a écrit :
Hi!
I have an image with 500 rows, 1000 columns, and 2 bands in a NetCDF
file which stores the data in the following scheme:
- dimension 1: rows
- dimension 2: bands
- dimension 3: columns
If I now do gdal.Open('filepath').GetRasterBand(1).ReadAsArray(), I
get a numpy array in the shape 500x2. Is it somehow possible to create
a GDAL VRT that accesses the data as rows/columns/bands instead of
rows/bands/columns? If yes, how would I create such a VRT using the
Python API?
Best,
Daniel
--
http://www.spatialys.com
My software is free, but my time generally not.
_______________________________________________
gdal-dev mailing list
gdal-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev