<div dir="ltr">Sorry about the typo. I meant HDF5, not HDF4. I am able to access the top group using statement emissions = f=>emissions. However, I am unable to access the subgroup in the group emissions. For instance, group emissions has two subgroups : monthly value dry matter (DM) and corresponding partitioning. How can I read DM from group 01 and <span style="font-size:12.8000001907349px">C_AGRI from group </span><span style="font-size:12.8000001907349px">partitioning? Thanks!</span><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Lei<br></span><div><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 9, 2015 at 2:49 PM, David Brown <span dir="ltr"><<a href="mailto:dbrown@ucar.edu" target="_blank">dbrown@ucar.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is a bit confusing, because you say HDF5 in the subject, but then<br>
you say that the data is in hdf4 format. The current version of NCL<br>
handles HDF4 groups differently from HDF5 groups. The HDF4 module uses<br>
group tag numbers appended to the variable names to differentiate<br>
groups. Eventually we would like to make both modules work the same<br>
way but that is not the case now.<br>
You have not said whether you tried your code on a sample file. If it<br>
worked, then you actually have HDF5 data.<br>
Basically you should be able to treat a group just like a file, so you<br>
should be able to get subgroups of a group the same way you get the<br>
top level groups from the file.<br>
-dave<br>
<div><div class="h5"><br>
<br>
<br>
On Tue, Jun 9, 2015 at 11:35 AM, dream916 <<a href="mailto:dream916@gmail.com">dream916@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> I was trying to read global fire emission dataset v4 in hdf4 format. I<br>
> searched online and couldn't find any examples how to read groups within<br>
> group. My code is as follows:<br>
><br>
> ; read hdf5 fire dataset<br>
> begin<br>
> setfileoption("h5", "FileStructure", "Advanced")<br>
> f = addfile("GFED4.0s_1997.hdf5","r")<br>
> grps = getfilegroups(f,"/",0)<br>
> print(grps)<br>
> grps2 = getfilegroups(f,"/emissions/",0)<br>
> print(grps2)<br>
> lat = f->lat<br>
> lon = f->lon<br>
> printVarSummary(lat)<br>
> printVarSummary(lon)<br>
> g = f=>ancill<br>
> gridarea = g->grid_cell_area<br>
> printVarSummary(gridarea)<br>
> emissions = f=>emissions<br>
><br>
> in the dataset, emissions is a group which contains two subgroups (month and<br>
> partitioning) (see below).<br>
><br>
> group: emissions {<br>
><br>
><br>
> group: \01 {<br>
><br>
> dimensions:<br>
><br>
> phony_dim_52 = 720 ;<br>
><br>
> phony_dim_53 = 1440 ;<br>
><br>
> variables:<br>
><br>
> float C(phony_dim_52, phony_dim_53) ;<br>
><br>
> string C:long_name = "GFED4s biomass burning carbon emissions" ;<br>
><br>
> string C:units = "g C / m^2 / month" ;<br>
><br>
> float DM(phony_dim_52, phony_dim_53) ;<br>
><br>
> string DM:long_name = "GFED4s biomass burning dry matter emissions" ;<br>
><br>
> string DM:units = "kg DM / m^2 / month" ;<br>
><br>
> float small_fire_fraction(phony_dim_52, phony_dim_53) ;<br>
><br>
> string small_fire_fraction:long_name = "Fraction of total GFED4s biomass<br>
> burning emissions originating from \"small fire burned area\"" ;<br>
><br>
> string small_fire_fraction:units = "Unitless (fraction)" ;<br>
><br>
><br>
> group: partitioning {<br>
><br>
> dimensions:<br>
><br>
> phony_dim_50 = 720 ;<br>
><br>
> phony_dim_51 = 1440 ;<br>
><br>
> variables:<br>
><br>
> float C_AGRI(phony_dim_50, phony_dim_51) ;<br>
><br>
> string C_AGRI:long_name = "Contribution of agricultural waste burning<br>
> to total monthly biomass burning carbon emissions" ;<br>
><br>
> string C_AGRI:units = "Unitless" ;<br>
><br>
> float C_BORF(phony_dim_50, phony_dim_51) ;<br>
><br>
> string C_BORF:long_name = "Contribution of boreal forest fires to<br>
> total monthly biomass burning carbon emissions" ;<br>
><br>
> string C_BORF:units = "Unitless" ;<br>
><br>
><br>
> So my question is how to read the monthly emissions and partitioning<br>
> associated with each month into an array.<br>
> Thanks,<br>
> Lei Meng<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> ncl-talk mailing list<br>
> <a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
> List instructions, subscriber options, unsubscribe:<br>
> <a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
><br>
</blockquote></div><br></div>