[Gdal-dev] Issues with hdf4 sub datasets on win xp using gdal trunk

Ivan Lucena ivan.lucena at pmldnet.com
Sun May 20 17:42:52 EDT 2007


Simone,

I have the same problem with a MODIS file but I found a solution (Skip to
the "***" if you don't want to read it all)

The first exploratory call to gdalinfo works fine:

C:\Data>gdalinfo C:\Data\Modis\MCD43B4.A2005241.h13v09.004.200526900420
6.hdf
...
SUBDATASET_3_NAME=HDF4_EOS:EOS_GRID:"C:\Data\Modis\MCD43B4.A2005241.h13v09.0
04.2005269004206.hdf":MOD_Grid_BRDF:Nadir_Reflectance_Quality
...

But if I query for a specific dataset I got the same error as you:

C:\Data>gdalinfo
HDF4_EOS:EOS_GRID:"C:\Data\Modis\MCD43B4.A2005241.h13v09.004.2005269004206.h
df":MOD_Grid_BRDF:Nadir_Reflectance_Quality
ERROR 4:
`HDF4_EOS:EOS_GRID:C:\Data\Modis\MCD43B4.A2005241.h13v09.004.2005269004
206.hdf:MOD_Grid_BRDF:Nadir_Reflectance_Quality' does not exist in the file
system,
and is not recognised as a supported dataset name.

Humm, there is also a typo error in "recognized".

****
The workaround is simple, I just remove the "C:" and it work:

C:\Data>gdalinfo HDF4_EOS:EOS_GRID:"\Data\Modis\MCD43B4.A2005241.h13v09
.004.2005269004206.hdf":MOD_Grid_BRDF:Nadir_Reflectance_Quality

I hope that it works in your case too.
****

It looks like if you are in "programming mode" (FWTools or GDAL API) that
could be a problem with more than one disk driver. Isn't it right?

Anyway, I always thought that this mechanism for selecting dataset in
gdalinfo is IMHO a little user unfriendly. I suggest that the first
exploratory call should issue a numeric index for each datasets so that the
user can refer to that in the second call, e.g.:

C:\Data>gdalinfo C:\Data\Modis\MCD43B4.A2005241.h13v09.004.200526900420
6.hdf
...
SUBDATASET_3_NAME[4]=HDF4_EOS:EOS_GRID:"C:\Data\Modis\MCD43B4.A2005241.h13v0
9.004.2005269004206.hdf":MOD_Grid_BRDF:Nadir_Reflectance_Quality
...
C:\Data>gdalinfo -s 4 C:\Data\Modis\MCD43B4.A2005241.h13v09.004.200526900420
6.hdf

Of course that will require the same change in gdal_translate, gdalwarp and
other utilities. That could also affect the others multi-dataset GDAL
drivers.

Best regards,

Ivan Lucena


-----Original Message-----
From: gdal-dev-bounces at lists.maptools.org
[mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Simone Gannecchini
Sent: Sunday, May 20, 2007 11:37 AM
To: gdal-dev at lists.maptools.org
Subject: [Gdal-dev] Issues with hdf4 subdatasets on win xp using gdal trunk

Hi list,
I am having some issues working with hdf4 driver on some modis aqua data.

I am working with gdal trunk which I built myself two days ago on my windows
xp box.

I have a test dataset that I want to access which is now located on my hard
drive under c:\roger. Dataset name is NJ2007136092911.L3_NURC_temp.

When I am inside the c:\roger directory everything works as expected. I can
do a gdalinfo on the main dataset and I am also able to do a gdalinfo on the
subdatasets I need.

If I browse to c:\ and I issue the following command:

gdalinfo c:\\roger\\NJ2007136092911.L3_NURC_temp
I get the information for the whole dataset correctly. Here below you have
an excerpt:


>>
C:\>gdalinfo c:\\roger\\NJ2007136092911.L3_NURC_temp

Driver: HDF4/Hierarchical Data Format Release 4 Size is 512, 512 Coordinate
System is `'
Metadata:
....
  mapProjectionSystem=NRL(USGS)
  mapProjection=temp
  mapUpperLeft=38.4999999999998, 11.5
  mapUpperRight=38.4999999999998, 16.5
  mapLowerLeft=33.9979685274162, 11.5
  mapLowerRight=33.9979685274162, 16.5
 
prodList=albedo_ch1,albedo_ch2,btemp_ch3,btemp_ch4,btemp_ch5,l2_flags,sst,re
f_dif,K_PAR,suspend,c_660
....
Subdatasets:
 
SUBDATASET_1_NAME=HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp"
:1

  SUBDATASET_1_DESC=[556x500] albedo_ch1 (16-bit integer)
 
SUBDATASET_2_NAME=HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp"
:2

  SUBDATASET_2_DESC=[556x500] albedo_ch2 (16-bit integer)
 
SUBDATASET_3_NAME=HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp"
:3

  SUBDATASET_3_DESC=[556x500] btemp_ch3 (16-bit integer)
 
SUBDATASET_4_NAME=HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp"
:4

  SUBDATASET_4_DESC=[556x500] btemp_ch4 (16-bit integer)
 
SUBDATASET_5_NAME=HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp"
:5

  SUBDATASET_5_DESC=[556x500] btemp_ch5 (16-bit integer)
 
SUBDATASET_6_NAME=HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp"
:6

  SUBDATASET_6_DESC=[556x500] l2_flags (32-bit unsigned integer)
 
SUBDATASET_7_NAME=HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp"
:7

  SUBDATASET_7_DESC=[556x500] sst (16-bit integer)
 
SUBDATASET_8_NAME=HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp"
:8

  SUBDATASET_8_DESC=[556x500] ref_dif (8-bit unsigned integer)
 
SUBDATASET_9_NAME=HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp"
:9

  SUBDATASET_9_DESC=[556x500] K_PAR (8-bit unsigned integer)
 
SUBDATASET_10_NAME=HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp
":
10
  SUBDATASET_10_DESC=[556x500] suspend (8-bit unsigned integer)
 
SUBDATASET_11_NAME=HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp
":
11
  SUBDATASET_11_DESC=[556x500] c_660 (16-bit integer)
 
SUBDATASET_12_NAME=HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp
":
16
  SUBDATASET_12_DESC=[28x26] CP_Longitudes (64-bit floating-point)
 
SUBDATASET_13_NAME=HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp
":
17
  SUBDATASET_13_DESC=[28x26] CP_Latitudes (64-bit floating-point) Corner
Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  512.0)
Upper Right (  512.0,    0.0)
Lower Right (  512.0,  512.0)
Center      (  256.0,  256.0)

>>

Problems arise if now I try to access any of the subdatasets like as
follows:


>>
C:\>gdalinfo HDF4_SDS:UNKNOWN:"c:\\roger\\NJ2007136092911.L3_NURC_temp":7

I get the following error:

ERROR 4: `'HDF4_SDS:UNKNOWN:c:\\roger\\NJ2007136092911.L3_NURC_temp:7'' does
not  exist in the file system, and is not recognised as a supported dataset
name.

GDALOpen failed - 4
`'HDF4_SDS:UNKNOWN:c:\\roger\\NJ2007136092911.L3_NURC_temp:7'' does not
exist in  the file system, and is not recognised as a supported dataset
name.

>>

I tried the same command with a different dataset and the same problem
arises when I try to access them. I tried to do the same using gdalinfo from
FWTools 1.2.2 experiencing the same problems. However, using OpenEV from the
same FWTools distro I have been able to open up a subdataset and to
visualize it correctly.


I hope that someone can shed some light here. It has been a while since the
last time I played with gdal and HDF hence it might be me doing something
wrong.

Thx a lot,
Simone.






-------------------------------------------------------
Eng. Simone Giannecchini
President /CEO GeoSolutions S.A.S.
Via Carignoni 51
55041  Camaiore (LU)
Italy

phone: +39 0584983027
fax:   +39 0584983027
mob:   +39 333 8128928 


http://www.geo-solutions.it

-------------------------------------------------------

_______________________________________________
Gdal-dev mailing list
Gdal-dev at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/gdal-dev




More information about the Gdal-dev mailing list