[gradsusr] how to read a hdf5 format file by GrADS?

chunchun Meng.Chunchun at ColoState.EDU
Thu Jul 10 12:53:53 EDT 2014


Hi James,

This file is from the NDVI files of RAMS.

I tried h5dump -H NDVI_APR_70N090E.h5,it worked,and the result is showed below:

HDF5 "NDVI_APR_70N090E.h5" {
GROUP "/" {
   DATASET "30-second_ndvi_data" {
      DATATYPE  H5T_IEEE_F32LE
      DATASPACE  SIMPLE { ( 1201, 1201 ) / ( 1201, 1201 ) }
   }
}
}

the latitude and longitude in the file name is the location of SW corner.So I'll try to create the .ctl  file ad read it.


Thanks a lot!

Chunchun     
________________________________________
From: James E Johnson [james.johnson at nasa.gov]
Sent: Thursday, July 10, 2014 10:16 AM
To: gradsusr at gradsusr.org
Cc: chunchun
Subject: Re: [gradsusr] how to read a hdf5 format file by GrADS?

On Wednesday 09 July 2014 17:38:52 chunchun wrote:
> Hi All,
>
>     Is there anyone has any idea about reading hdf5 file by GrADS?
>     I followed http://www.iges.org/grads/gadoc/gradcomdxdfopen.html,and
>  tried ncdump on the file,but it didn't work.
>
>    One file is attached here.
>
>   Thanks a lot!
>
> Chun
>

You should get the newer ncdump with built-in HDF5/netCDF4 support. Then it
will work dumping HDF5 or netCDF4 (which are actually special case HDF5
files), unless its using some of the lower level obscure HDF5 object types.

If you dump it you'll see the file structure is:
netcdf NDVI_APR_30N070E {
dimensions:
        phony_dim_0 = 1201 ;
variables:
        float \30-second_ndvi_data(phony_dim_0, phony_dim_0) ;
data:

 \30-second_ndvi_data =
  0.4392157, 0.4431373, 0.4431373, 0.4431373, 0.4392157, 0.4392157,
    0.4313726, 0.4313726, 0.427451, 0.4313726, 0.427451, 0.4156863,
    .
    :
    0.3960785, 0.3960785, 0.3960785, 0.3960785, 0.3960785, 0.3960785,
    0.3960785 ;
}

This is a very poorly designed file which isn't taking advantage of HDF5's
self-describing features, i.e. no variable level attributes to describe what
the data represent, and no file level attributes to describe the product or
file. It has no dimension/coordinates defined, but the variable is a square
array of size 1201 x 1201, however one has no idea what the 1st
dimension/coordinate represents and no idea what the 2nd dimension/coordinate
represents. Its possible they are not coordinates at all, it could be a square
matrix for all one knows. One is forced to have to rely on some external
document to interpret what and how to use this type of data file. The HDF5
file is so poorly designed you have no idea what the data are, other than rely
on the variable name to know its some NDVI at 30-second whatever.

As for GrADS, you can construct a control file (.ctl) to read the single
variable data array. But because this file FAILS to self-describe itself fully
(other that it is 32-bit float array size 1201 x 1201), its unclear what if
any lat/lon boundary the array has. Its up to you to locate the external
documentation about what this data product file really is supposed to
represent. Where did you get this file from?

------------------------------------------------------------------------------
| James E. Johnson                   | address:                              |
| ADNET Systems, Inc.                |  NASA Goddard Space Flight Center     |
| e-mail: james.johnson at nasa.gov     |  Data and Information Services Center |
| phone:  301-614-5121               |  Code 610.2, Bldg 32, Room S130G      |
| fax:    301-614-5268               |  Greenbelt, MD  20771                 |
------------------------------------------------------------------------------



More information about the gradsusr mailing list