[gdal-dev] subdatasets not read in a HDF file

Joaquim Luis jluis at ualg.pt
Mon Oct 24 08:56:11 EDT 2011


Anton,

I don't remember the details because I programmed that some time ago, 
but from what I recall that's the most accurate way of interpolating the 
data into a regular grid. The whole procedure is implemented in Mirone 
were the x,y,z triplets (computed after the cnt_pt_col|row)  are 
reinterpolated with minimum curvature or nearneighbor algorithms to 
calculate a regular grid.  Now, this used to work with temperature data 
but it didn't anymore with that chlorophyll file (Mirone stand-alone 
crashed) .  The implementation use a Matlab hdf reader MEX and that MEX 
of the time of ML6.5 crashes. New versions work okay but I cannot used 
them in the Mirone stand-alone so I though in using GDAL (as I do in 
many other instances), except that ... it doesn't work too.

Joaquim

P.S. The whole procedure should be as simple as described here

https://sites.google.com/site/mironehowtos/satellite/import-a-modis-l2-sst-hdf-grid


> Hi Joaquim!
>
> I'm curious why do you want to read cnt_pt_col and cnt_pt_row from a 
> SeaWiFS file?
>
> These dataset (1D vectors, actually) only contains indexes of rows and 
> columns for which latitude, longitude grids are given. And you can 
> read lat/lon from GCPs. Or do you also feel that only ~100 GCPs are 
> not enough ?
>
> I'm working with MODIS data and in the Arctic warping results look 
> ugly sometimes. I was thinking if I should try to get lat/lon grids 
> from an HDF file and increase number of GCPs.
>
> Anton
>
> On 10/23/2011 08:54 PM, Joaquim Luis wrote:
>> Etienne,
>>
>> 1) Manage to attach the file (zipped) to the just opened ticket.
>>
>> 2) Unfortunately it doesn't work. It says the usual
>>
>> C:\SVN\mironeWC>gdalinfo 
>> "NETCDF:S1998031140424.L2_MLAC_OC.x.hdf:longitude"
>> ERROR 4: `NETCDF:S1998031140424.L2_MLAC_OC.x.hdf:longitude' does not
>> exist in the file system,
>>
>> Note that I built GDAL with netcdf4 that on Windows is always linked
>> against HDF.
>>
>> Joaquim
>>
>>
>>
>>> 1) Not sure, but give it a try! If not, put it somewhere accessible on
>>> the web. You should definitively create a ticket for this.
>>>
>>> 2)
>>> netcdf supports HDF4 if it was configured for hdf4 support.
>>>
>>> In that case, to force the netcdf driver you would have to use
>>> "NETCDF:filename:subdataset", or else the HDF4 driver will open it
>>> pick it up.
>>>
>>> Etienne
>>>
>>> On Sat, Oct 22, 2011 at 9:57 AM, Joaquim Luis <jluis at ualg.pt
>>> <mailto:jluis at ualg.pt>> wrote:
>>>
>>>     Hi,
>>>
>>>     I'm having troubles reading a SeaWifs L2 hdf file due to a bug in
>>>     the hdf driver. The problem here is that not all Subdatasets are
>>>     read.
>>>     Below is the list givem by gdalinfo, which lacks 2 subdatasets: the
>>>     cntl_pt_cols & cntl_pt_rows
>>>     To prove I attach a little screencapture of "HDF Explorer".
>>>
>>>     Now I have two questions.
>>>
>>>     1- The hdf file in question is relatively small (1.2 Mb). Can I
>>>     attach it to a ticket?
>>>
>>>     2- If I build GDAL with netCDF4, can I force the reading of this
>>>     file with the netCDF driver? And if yes, how?
>>>
>>>     Thanks
>>>
>>>     Joaquim
>>>
>>>
>>>
>>>
>>>     Subdatasets:
>>>     
>>> SUBDATASET_1_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":11
>>>     SUBDATASET_1_DESC=[391x78] longitude (32-bit floating-point)
>>>     
>>> SUBDATASET_2_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":12
>>>     SUBDATASET_2_DESC=[391x78] latitude (32-bit floating-point)
>>>     
>>> SUBDATASET_3_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":13
>>>     SUBDATASET_3_DESC=[391x78] Rrs_412 (16-bit integer)
>>>     
>>> SUBDATASET_4_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":14
>>>     SUBDATASET_4_DESC=[391x78] Rrs_443 (16-bit integer)
>>>     
>>> SUBDATASET_5_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":15
>>>     SUBDATASET_5_DESC=[391x78] Rrs_490 (16-bit integer)
>>>     
>>> SUBDATASET_6_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":16
>>>     SUBDATASET_6_DESC=[391x78] Rrs_510 (16-bit integer)
>>>     
>>> SUBDATASET_7_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":17
>>>     SUBDATASET_7_DESC=[391x78] Rrs_555 (16-bit integer)
>>>     
>>> SUBDATASET_8_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":18
>>>     SUBDATASET_8_DESC=[391x78] Rrs_670 (16-bit integer)
>>>     
>>> SUBDATASET_9_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":19
>>>     SUBDATASET_9_DESC=[391x78] chlor_a (32-bit floating-point)
>>>     
>>> SUBDATASET_10_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":20
>>>     SUBDATASET_10_DESC=[391x78] Kd_490 (16-bit integer)
>>>     
>>> SUBDATASET_11_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":21
>>>     SUBDATASET_11_DESC=[391x78] pic (16-bit integer)
>>>     
>>> SUBDATASET_12_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":22
>>>     SUBDATASET_12_DESC=[391x78] poc (16-bit integer)
>>>     
>>> SUBDATASET_13_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":23
>>>     SUBDATASET_13_DESC=[391x78] cdom_index (16-bit integer)
>>>     
>>> SUBDATASET_14_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":24
>>>     SUBDATASET_14_DESC=[391x78] par (16-bit integer)
>>>     
>>> SUBDATASET_15_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":25
>>>     SUBDATASET_15_DESC=[391x78] l2_flags (32-bit integer)
>>>     
>>> SUBDATASET_16_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":34
>>>     SUBDATASET_16_DESC=[391x3] orb_vec (32-bit floating-point)
>>>     
>>> SUBDATASET_17_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":35
>>>     SUBDATASET_17_DESC=[391x3] sun_ref (32-bit floating-point)
>>>     
>>> SUBDATASET_18_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":36
>>>     SUBDATASET_18_DESC=[391x3] att_ang (32-bit floating-point)
>>>     
>>> SUBDATASET_19_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":37
>>>     SUBDATASET_19_DESC=[391x3x3] sen_mat (32-bit floating-point)
>>>     
>>> SUBDATASET_20_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":38
>>>     SUBDATASET_20_DESC=[391x6] scan_ell (32-bit floating-point)
>>>     
>>> SUBDATASET_21_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":39
>>>     SUBDATASET_21_DESC=[391x8] nflag (32-bit integer)
>>>     
>>> SUBDATASET_22_NAME=HDF4_SDS:SEAWIFS_L2:"S1998031140424.L2_MLAC_OC.x.hdf":42
>>>     SUBDATASET_22_DESC=[20x2] tilt_ranges (16-bit integer)
>>>     Corner Coordinates:
>>>
>>>     _______________________________________________
>>>     gdal-dev mailing list
>>>     gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
>>>     http://lists.osgeo.org/mailman/listinfo/gdal-dev
>>>
>>>
>>
>>
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>



More information about the gdal-dev mailing list