[ncl-talk] Read HDF5 file

dream916 dream916 at gmail.com
Tue Jun 9 11:35:18 MDT 2015


Hi,

I was trying to read global fire emission dataset v4 in hdf4 format. I
searched online and couldn't find any examples how to read groups within
group. My code is as follows:

; read hdf5 fire dataset
begin
setfileoption("h5", "FileStructure", "Advanced")
f = addfile("GFED4.0s_1997.hdf5","r")
grps = getfilegroups(f,"/",0)
print(grps)
grps2 = getfilegroups(f,"/emissions/",0)
print(grps2)
lat = f->lat
lon = f->lon
printVarSummary(lat)
printVarSummary(lon)
g = f=>ancill
gridarea = g->grid_cell_area
printVarSummary(gridarea)
emissions = f=>emissions

in the dataset, emissions is a group which contains two subgroups (month
and partitioning) (see below).

group: emissions {


  group: \01 {

    dimensions:

    phony_dim_52 = 720 ;

    phony_dim_53 = 1440 ;

    variables:

    float C(phony_dim_52, phony_dim_53) ;

     string C:long_name = "GFED4s biomass burning carbon emissions" ;

     string C:units = "g C / m^2 / month" ;

    float DM(phony_dim_52, phony_dim_53) ;

     string DM:long_name = "GFED4s biomass burning dry matter emissions" ;

     string DM:units = "kg DM / m^2 / month" ;

    float small_fire_fraction(phony_dim_52, phony_dim_53) ;

     string small_fire_fraction:long_name = "Fraction of total GFED4s
biomass burning emissions originating from \"small fire burned area\"" ;

     string small_fire_fraction:units = "Unitless (fraction)" ;


    group: partitioning {

      dimensions:

      phony_dim_50 = 720 ;

      phony_dim_51 = 1440 ;

      variables:

      float C_AGRI(phony_dim_50, phony_dim_51) ;

       string C_AGRI:long_name = "Contribution of agricultural waste
burning to total monthly biomass burning carbon emissions" ;

       string C_AGRI:units = "Unitless" ;

      float C_BORF(phony_dim_50, phony_dim_51) ;

       string C_BORF:long_name = "Contribution of boreal forest fires to
total monthly biomass burning carbon emissions" ;

       string C_BORF:units = "Unitless" ;

So my question is how to read the monthly emissions and partitioning
associated with each month into an array.
Thanks,
Lei Meng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150609/1e85f509/attachment.html 


More information about the ncl-talk mailing list