[gdal-dev] Translate HDF MODIS subdataset get dimensions wrong
Even Rouault
even.rouault at spatialys.com
Wed Mar 16 08:08:52 PDT 2022
You could certainly do that with the -array switch of
https://gdal.org/programs/gdalmdimtranslate.html using a view expression
that does subsetting
(https://gdal.org/api/gdalmdarray_cpp.html#_CPPv4NK11GDALMDArray7GetViewERKNSt6stringE
. similar to numpy slicing/indexing syntax)
Use https://gdal.org/programs/gdalmdiminfo.html to get the path to the
variable of interest.
Even
Le 16/03/2022 à 15:48, inti luna a écrit :
> Hello,
> I am trying to read a subdaset from modis total precipitable water
> product(https://ladsweb.modaps.eosdis.nasa.gov/missions-and-measurements/products/MOD05_L2).
> The specific subdataset is Qualiy_Assurance_NIR.
>
> Checking the file with gdalinfo provide details about subdatasets:
>
> For example:
> gdalinfo MOD05_L2.A2013152.0035.061.2017299012514.hdf
>
> Output extract:
> SUBDATASET_8_NAME=HDF4_EOS:EOS_SWATH:"MOD05_L2.A2013152.0035.061.2017299012514.hdf":mod05:Water_Vapor_Correction_Factors
> SUBDATASET_8_DESC=[2030x1354] Water_Vapor_Correction_Factors mod05
> (16-bit integer)
> SUBDATASET_9_NAME=HDF4_EOS:EOS_SWATH:"MOD05_L2.A2013152.0035.061.2017299012514.hdf":mod05:Water_Vapor_Infrared
> SUBDATASET_9_DESC=[406x270] Water_Vapor_Infrared mod05 (16-bit integer)
> SUBDATASET_10_NAME=HDF4_EOS:EOS_SWATH:"MOD05_L2.A2013152.0035.061.2017299012514.hdf":mod05:Quality_Assurance_Near_Infrared
> SUBDATASET_10_DESC=[2030x1354x1] Quality_Assurance_Near_Infrared
> mod05 (8-bit integer)
> ---------------------------------------
> It can be seen that subdataset 8 has dimensions 2030x1354 which is
> fine but subdataset 10 has dimensions 2030x1354x1 which when using
> gdal translate to pass it to a geotif gives a raster file with 1x1354
> dimensions with 2030 bands which is not right, it should be a file
> with 2030x1354. What can be done to correct this or to pass it to the
> dimensions and match other subdatasets.
> -------
> command used to pass it to geotif
> -------
> gdal_translate
> HDF4_EOS:EOS_SWATH:"MOD05_L2.A2013152.0035.061.2017299012514.hdf":mod05:Quality_Assurance_Near_Infrared
> b10_QA_NIR.tif
> ------
>
> Thank you for any guidance
> Ernesto
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
http://www.spatialys.com
My software is free, but my time generally not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20220316/12a4a69f/attachment.html>
More information about the gdal-dev
mailing list