Hi, Antonio!
You can do that with the gdalinfo command prior to running a python script:

gdalinfo MODIS_FILE.hdf | grep EV_1KM_RefSB | wc -l

returns a number if subdataset EV_1KM_RefSB exist
return 0 if not.

triton:gdaltest>gdalinfo MYD02QKM.A2010217.1335.005.2010218190207.hdf | grep EV_1KM_RefSB | wc -l
0

triton:gdaltest>gdalinfo MOD021KM.A2010105.2120.005.2010106075131.hdf | grep EV_1KM_RefSB | wc -l
7

Anton
On 08/04/2011 10:10 AM, António Rocha wrote:
Greetings

I have a Python Script where I call gdalwarp binary (in Windows) to warp
an image. But, before I run the gdalwarp I need to check if the file
exists (DONE) and if a defined HDF layer exists. How can I check, using
gdal, in a Script if a certain layer exists?
THanks
Antonio


__________ Information from ESET NOD32 Antivirus, version of virus
signature database 6348 (20110803) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com


_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
_______________________________________________
gdal-dev mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to