[gdal-dev] HDF-EOS vs. GDAL: order of dimensions
Ivan Shmakov
ivan at theory.asu.ru
Tue Dec 18 06:47:05 EST 2007
One more issue with HDF-EOS support in GDAL:
$ gdalinfo \
'HDF4_EOS:EOS_SWATH:"AIRS.....061.L2.RetStd.v4.0.9.102.D07281140036.hdf":L2_Standard_atmospheric&surface_product:latAIRS' \
| grep -F latAIRS
SUBDATASET_25_NAME=HDF4_EOS:EOS_SWATH:"AIRS.....061.L2.RetStd.v4.0.9.102.D07281140036.hdf":L2_Standard_atmospheric&surface_product:latAIRS
SUBDATASET_25_DESC=[45x30x3x3] latAIRS (32-bit floating-point)
$ gdal_translate \
'HDF4_EOS:EOS_SWATH:"AIRS.....061.L2.RetStd.v4.0.9.102.D07281140036.hdf":L2_Standard_atmospheric&surface_product:latAIRS' \
airs.lat-airs.tiff
Input file size is 3, 3
0Warning 1: Lost metadata writing to GeoTIFF ... too large to fit in tag.
...10...20...30...40...50...60...70...80...90...100 - done.
$
Surely the source image has to be treaten as 45x30.
Apparently, GDAL tries to ``guess'' the spatial dimensions of an
HDF-EOS dataset:
--cut: frmts/hdf4/hdf4imagedataset.cpp: HDF4ImageDataset::GetImageDimensions ()--
// Search for the starting "X" and "Y" in the names or take
// the last two dimensions as X and Y sizes
iXDim = nDimCount - 1;
iYDim = nDimCount - 2;
for ( i = 0; i < nDimCount; i++ )
{
if ( EQUALN( papszDimList[i], "X", 1 ) && iBandDim != i )
iXDim = i;
else if ( EQUALN( papszDimList[i], "Y", 1 ) && iBandDim != i )
iYDim = i;
}
--cut: frmts/hdf4/hdf4imagedataset.cpp: HDF4ImageDataset::GetImageDimensions ()--
And gets it wrong, since the dimensions are:
--cut: ncdump-hdf -h AIRS.....061.L2.RetStd.v4.0.9.102.D07281140036.hdf--
"\t\t\t\tDataFieldName=\"latAIRS\"\n",
"\t\t\t\tDataType=DFNT_FLOAT32\n",
"\t\t\t\tDimList=(\"GeoTrack\",\"GeoXTrack\",\"AIRSTrack\",\"AIRSXTrack\")\n",
"\t\t\tEND_OBJECT=DataField_40\n",
--cut: ncdump-hdf -h AIRS.....061.L2.RetStd.v4.0.9.102.D07281140036.hdf--
Any opinions on how the spatial dimensions detection should be
done to handle such cases? May it be of any help to try to also
inspect the geolocation fields and ``guess'' the X, Y dimensions
only among the dimensions referred by both the geolocation
fields and the field being handled? Or should there be a way to
manually override any detection logic and specify the X, Y
dimensions explicitly?
More information about the gdal-dev
mailing list