[ncl-talk] Segmentation fault (core dumped) when reading hdf5

Dennis Shea shea at ucar.edu
Wed Sep 4 11:28:27 MDT 2019


Bonjour Adriana,

The* golden rule of data processing *:* "Look at your data" * :-)

NCL examples are for illustration on how to process and plot. The following
example:

https://www.ncl.ucar.edu/Applications/gfed.shtml
"gfed_3.ncl"

expects a file containing "*groups" with monthly mean data only.* *No daily
data.*
As noted in the documentation: *Convert all yearly (12 months) GFED HDF5
files ...*

See attached: *dump.hdf5.GFED4.1s_1997*

*%> ncl_filedump
<https://www.ncl.ucar.edu/Document/Tools/ncl_filedump.shtml> *
GFED4.1s_1997.hdf5* >! *dump.hdf5.GFED4.1s_1997

Specifically: It has groups: *ancill*, *biosphere*, *burned
_area, emissions.*
Each group has its own set of variables. Group *emissions* has *many*
variables.

eg:  group: *biosphere*/
contains "groups" with months: *01,  02, ..., 12.*
Within each *monthly* group, the variables are:  *BB, NPP, Rh*

Hence, data import paths would be:
biosphere/01/BB,   biosphere/01/NPP,   biosphere/01/Rh
biosphere/02/BB,   biosphere/02/NPP,   biosphere/02/Rh
etc

For some user applications, this approach works. If a user wants a specific
variable for a particular month

    npp = f->biosphere/02/NPP     ; get NPP for February of current year [
*(:,:)*  ], two dimensions

However, if a user wants to perform statistics over many years, this
approach is rather cumbersome.
It is incumbent on the user to import each year-month value and correctly
place into an array (say): npp(time,lat,lon)
for subsequent processing.

---
The "*GFED4.1s_2017_beta.hdf5*"  you refer to contains monthly and **daily**
data. The *ancill *group is the same.
However, there is *no* *burned_area *group. [a] I looked, [b] I used the
following

ncl 0> f = addfile("GFED4.1s_2017_beta.hdf5","r")
ncl 1> gNames = getfilegrpnames (f) ; get names of all groups on file
ncl 2> nNames = dimsizes (gNames)   ; number of groups on the file
ncl 3> print (nNames)
ncl 4> print(gNames)

Variable: gNames
Type: string
Total Size: 400 bytes
            50 values
Number of Dimensions: 1
Dimensions and sizes:   [50]
Coordinates:
(0)     /ancill
(1)     /emissions
(2)     /emissions/01
(3)     /emissions/02
(4)     /emissions/03
(5)     /emissions/04
(6)     /emissions/05
(7)     /emissions/06
(8)     /emissions/07
(9)     /emissions/08
(10)    /emissions/09
(11)    /emissions/10
(12)    /emissions/11
(13)    /emissions/12
(14)    /emissions/01/daily_fraction
(15)    /emissions/01/diurnal_cycle
(16)    /emissions/01/partitioning
(17)    /emissions/02/daily_fraction
(18)    /emissions/02/diurnal_cycle
[snip]

I added the following print to  gfed_3.ncl
To see where the Segfault is coming from I added the following two print
statements to the gfed_3.ncl example:

*print("burned_area")*
    bf  = get_gefd_var(f, "burned_area", "burned_fraction", time, lat,lon)  *;
<== Segfault*
*print("burned_area_source")*
    src = get_gefd_var(f, "burned_area", "source", time, lat,lon)

This Segfault occurred when NCL is trying to access a group that does not
exist!
Likely, a warging should have been issued but .... it was not.

====
I'll stop here. Hopefully, this explanation is of some value.
You could alter gfed_3.ncl to extract the desired data. However, it will
require some work. I'll help you if you want.

Cheers
D




On Tue, Sep 3, 2019 at 8:36 AM Adriana via ncl-talk <ncl-talk at ucar.edu>
wrote:

> Hi all,
>
> I am using one ncl example script for read and convert GFED4 (hdf5)
> files in netcdf files. I have downoaled the example 3 from here:
> https://www.ncl.ucar.edu/Applications/gfed.shtml
> "gfed_3.ncl"
>
> But now when I try to run for read and convert my file doesn't work
> My current version of ncl is 6.6.2
> I attached the ncl_script with my little modification.
>
> There is any "knowed" problems with this?
>
> I appreciate any help
>
> Thank you
>
> Adriana
>
>
> --
> Adriana Bossolasco
> LPC2E UMR 7328 (CNRS, Université d'Orléans)
> 3A avenue de la Recherche Scientifique
> 45071 Orléans Cedex 2 - FRANCE
> Tel  +33 (0)2 38 25 52 85
> e-mail: adriana.bossolasco at cnrs-orleans.fr
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190904/3840ab13/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dump.hdf5.GFED4.1s_1997
Type: application/octet-stream
Size: 166823 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190904/3840ab13/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dump.hdf5.GFED4.1s_2017_beta
Type: application/octet-stream
Size: 382920 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190904/3840ab13/attachment-0003.obj>


More information about the ncl-talk mailing list