[gdal-dev] HDF-EOS AIRS CO2 images without georeference using gdal_translate

Chaitanya kumar CH chaitanya.ch at gmail.com
Thu Jan 26 02:34:07 EST 2012


David,

I used gdal_translate to convert
HDF4_EOS:EOS_SWATH:"AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":CO2:CO2ret
into .img and TIFF format. I didn't get zeros nor did they lose the
coordinate info. I did this with gdal version 1.8 and the latest trunk.

Check your input and output images with "gdalinfo -stats".

On Thu, Jan 26, 2012 at 9:34 AM, David Ortiz <dvdov at yahoo.com> wrote:

> Hi Everyone, greetings.
>
> I am working with AIRS images, specifically CO2 products
> (AIRX2STC,AIRX2SPC) and i am trying to convert a couple of subdataset from
> .hdf files to other format as GTiff or .img so that can be handled on some
> open source GIS but using gdal_translate there are problems, mainly a lack
> of georeference in processed images.
>
>  The file is AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf
> downloadable from
>  ttp://
> mirador.gsfc.nasa.gov/cgi-bin/mirador/homepageAlt.pl?keyword=AIRX2SPC  for
> 2008-03-12 date.A special feature of this kind of files is geolocations
> fields "latitude" and "longitude"  have some values =-9999 where respective
> pixel doesn't have information about co2 amounts.
>
> * When I do gdalinfo I get :
>
> gdalinfo
> /home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf
> Size is 512, 512
> Coordinate System is `'
> Metadata:
>                      ...
>                       ...
>   GROUP                  = SPATIALDOMAINCONTAINER
>     GROUP                  = HORIZONTALSPATIALDOMAINCONTAINER
>       GROUP                  = BOUNDINGRECTANGLE
>         OBJECT                 = EASTBOUNDINGCOORDINATE
>           NUM_VAL              = 1
>           VALUE                = -133.537399291992
>         END_OBJECT             = EASTBOUNDINGCOORDINATE
>         OBJECT                 = WESTBOUNDINGCOORDINATE
>           NUM_VAL              = 1
>           VALUE                = -157.941314697266
>         END_OBJECT             = WESTBOUNDINGCOORDINATE
>         OBJECT                 = SOUTHBOUNDINGCOORDINATE
>           NUM_VAL              = 1
>           VALUE                = 22.2317676544189
>         END_OBJECT             = SOUTHBOUNDINGCOORDINATE
>         OBJECT                 = NORTHBOUNDINGCOORDINATE
>           NUM_VAL              = 1
>           VALUE                = 45.889762878418
>         END_OBJECT             = NORTHBOUNDINGCOORDINATE
>
>       END_GROUP              = BOUNDINGRECTANGLE
>                      ...
>                      ...
>   HDFEOSVersion=HDFEOS_V2.12
>   ProductGenerationHostInformation=alpha.jpl.nasa.gov Linux
> 2.6.9-78.0.22.ELsmp #1_SMP_Thu_Apr_30_19:17:40_EDT_2009 x86_64
>   VersionRetrieval=5.2.2.0
> Subdatasets:
>                      ...
>
>  SUBDATASET_8_NAME=HDF4_EOS:EOS_SWATH:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":CO2:CO2ret
>   SUBDATASET_8_DESC=[22x15] CO2ret CO2 (32-bit floating-point)
>                        ...
>   SUBDATASET_11_DESC=[22x15x100] AvgKern CO2 (32-bit floating-point)
>
>  SUBDATASET_12_NAME=HDF4_SDS:UNKNOWN:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":0
>                      ...
>
> SUBDATASET_19_NAME=HDF4_SDS:UNKNOWN:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":7
>   SUBDATASET_19_DESC=[22x15] CO2ret (32-bit floating-point)
>                       ...
> SUBDATASET_23_NAME=HDF4_SDS:UNKNOWN:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":11
>   SUBDATASET_23_DESC=[22x15] Latitude (32-bit floating-point)
>
> SUBDATASET_24_NAME=HDF4_SDS:UNKNOWN:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":12
>   SUBDATASET_24_DESC=[22x15] Longitude (32-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)
>
>
> * I need "CO2ret" subdataset. Using gdalinfo:
>
> root at debian:/home/david# gdalinfo
> HDF4_EOS:EOS_SWATH:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":CO2:CO2ret
> Driver: HDF4Image/HDF4 Dataset
> Files:
> /home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf
> Size is 15, 22
> Coordinate System is `'
> GCP[  0]: Id=, Info=
>           (0.5,0.5) -> (-9999,-9999,0)
> GCP[  3]: Id=, Info=
>           (3.5,0.5) -> (-145.229995727539,23.3500003814697,0)
> GCP[  4]: Id=, Info=
>           (4.5,0.5) -> (-9999,-9999,0)
>                      ...
>                      ...
> GCP[329]: Id=, Info=
>           (14.5,21.5) -> (-9999,-9999,0)
>                      ...
>                      ...
> Geolocation:
>   LINE_OFFSET=0
>   LINE_STEP=1
>   PIXEL_OFFSET=0
>   PIXEL_STEP=1
>   X_BAND=1
>
> X_DATASET=HDF4_EOS:EOS_SWATH_GEOL:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":CO2:Longitude
>   Y_BAND=1
>
> Y_DATASET=HDF4_EOS:EOS_SWATH_GEOL:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":CO2:Latitude
> Corner Coordinates:
> Upper Left  (    0.0,    0.0)
> Lower Left  (    0.0,   22.0)
> Upper Right (   15.0,    0.0)
> Lower Right (   15.0,   22.0)
> Center      (    7.5,   11.0)
> Band 1 Block=15x22 Type=Float32, ColorInterp=Gray
>   NoData Value=-9999
>
> * I tried create an .img file but the image doesn't spatial reference:
>
> rgdal_translate -of HFA
> HDF4_EOS:EOS_SWATH:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":CO2:CO2ret
>  /home/david/Descargas/pruebas/CO2_sup_img_EOS.img
>
> * with Geotiff format there is not georeference and all pixels have value
> =0 :
>
> gdal_translate -of GTiff
> HDF4_EOS:EOS_SWATH:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":CO2:CO2ret
>  /home/david/Descargas/pruebas/CO2_sup_Gtiff_EOS_traslate.tif
> Input file size is 15, 22
> 0Warning 1: Lost metadata writing to GeoTIFF ... too large to fit in tag.
> Warning 1: Lost metadata writing to GeoTIFF ... too large to fit in tag.
> ...10...20...30...40...50...60...70...80...90...100 - done.
>
> * I tried with gdalwarp but the file doesn't have geographical reference
> and co2 info:
>
>  gdalwarp
> HDF4_EOS:EOS_SWATH:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":CO2:CO2ret
>  /home/david/Descargas/pruebas/CO2_sup_Gtiff_EOS_warp.tif
> Creating output file that is 141P x 144L.
> Processing input file
> HDF4_EOS:EOS_SWATH:/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf:CO2:CO2ret.
> Using internal nodata values (eg. -9999) for image
> HDF4_EOS:EOS_SWATH:/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf:CO2:CO2ret.
> 0...10...20...30...40...50...60...70...80...90...100 - done.
>
>
> * SO, i did the same with subdataset name HDF4_SDS:UNKNOWN  :
>
>  gdalinfo
> HDF4_SDS:UNKNOWN:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":7
> Driver: HDF4Image/HDF4 Dataset
> Files:
> /home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf
> Size is 15, 22
> Coordinate System is `'
>                      ...
>                      ...
> Geolocation:
>   LINE_OFFSET=0
>   LINE_STEP=1
>   PIXEL_OFFSET=0
>   PIXEL_STEP=1
>   SRS=GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
> 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]]
>   X_BAND=1
>
> X_DATASET=HDF4_SDS:UNKNOWN:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":12
>   Y_BAND=1
>
> Y_DATASET=HDF4_SDS:UNKNOWN:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":11
> Corner Coordinates:
> Upper Left  (    0.0,    0.0)
> Lower Left  (    0.0,   22.0)
> Upper Right (   15.0,    0.0)
> Lower Right (   15.0,   22.0)
> Center      (    7.5,   11.0)
> Band 1 Block=15x22 Type=Float32, ColorInterp=Gray
>
>  gdal_translate -of HFA
> HDF4_SDS:UNKNOWN:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":7
> /home/david/Descargas/pruebas/CO2_sup_img_UNKNOWN_traslate.img
>
>  gdal_translate -of GTiff
> HDF4_SDS:UNKNOWN:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":7
> /home/david/Descargas/pruebas/CO2_sup_Gtiff_UNKNOWN_traslate.tif
> Input file size is 15, 22
> 0Warning 1: Lost metadata writing to GeoTIFF ... too large to fit in tag.
> Warning 1: Lost metadata writing to GeoTIFF ... too large to fit in tag.
> ...10...20...30...40...50...60...70...80...90...100 - done.
>
> gdalwarp
> HDF4_SDS:UNKNOWN:"/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf":7
> /home/david/Descargas/pruebas/CO2_sup_Gtiff_UNKNOWN_warp.tif
> Creating output file that is 70P x 72L.
> Processing input file
> HDF4_SDS:UNKNOWN:/home/david/Descargas/pruebas/AIRS.2008.03.12.228.L2.CO2_Sup.v5.4.11.0.CO2.T09254115637.hdf:7.
> ERROR 1: Too many points (441 out of 441) failed to transform,
> unable to compute output bounds.
> 0...10...20...30...40...50...60...70...80...90...100 - done
>
>
> * but none of images have geographical reference. When i use HEGTool with
> AIRS radiances (AIRIBRAD products), for example, the Geotiff have WGS84
> coordinates.The problem is HEG doesn't support CO2 products.
>
> 1. How can i generate  images with spatial reference?
> 2. Should i replace -9999 values from latitude and longitude fields with
> other value? How can i do this?
>
> The gdal version is 1.9 built from source with hdf4 support:
> ./configure --with-hdf4=/home/david/Descargas/gdal_grass_R/hdf-4.2.6-linux
> --without-grass --without-libgrass
> make
> make install
>
>
>
>
> I really appreciate your help and advice
>
> Best Regards
>
>
> David A. Ortiz V.
> UD - ICG
> Bogota D.C.
>
>
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
Best regards,
Chaitanya kumar CH.

+91-9494447584
17.2416N 80.1426E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120126/316ae3fe/attachment-0001.html


More information about the gdal-dev mailing list