[ncl-talk] Seg fault when reading attribute from file
David Brown
dbrown at ucar.edu
Thu Sep 17 11:15:15 MDT 2015
Hi Kyle,
I was able to reproduce this problem only under the condition that the
variable in question has no existing attributes, a condition that your
test case meets. You are correct that it is a NetCDF4-only issue. It
is definitely an issue that we need to fix for the next release.
Thanks for pointing this out.
-dave
On Thu, Sep 17, 2015 at 9:31 AM, Kyle Griffin <ksgriffin2 at wisc.edu> wrote:
> Yes, it's a seg fault, but it's quite simple to avoid. Trying to manually
> read a variable's attribute from a file, and it turns out that this
> attribute doesn't exist, results in a seg fault.
> Lesson learned: don't read a variable's attribute if it doesn't exist.
> Also, should specify that this is a true netCDF4 file. The same problem
> doesn't occur with a smaller netCDF file. Both code segments are from
> NCL6.3.0.
>
>
> Kyle
>
>
> netCDF4:
>
> ncl 0> a=addfile("TEST_dp_stddev_0101.nc","r")
>
> ncl 1> time=a->time
>
> ncl 2> printVarSummary(time)
>
>
> Variable: time
>
> Type: double
>
> Total Size: 992 bytes
>
> 124 values
>
> Number of Dimensions: 1
>
> Dimensions and sizes: [time | 124]
>
> Coordinates:
>
> time: [1262256..1262994]
>
> ncl 3> time at units = a->time at units
>
> Segmentation fault (core dumped)
>
>
> netCDF3:
>
>
> ncl 0> a=addfile("dp_climo_01.nc","r")
>
> ncl 1> time=a->time
>
> ncl 2> printVarSummary(time)
>
>
> Variable: time
>
> Type: double
>
> Total Size: 992 bytes
>
> 124 values
>
> Number of Dimensions: 1
>
> Dimensions and sizes: [time | 124]
>
> Coordinates:
>
> time: [1262256..1262994]
>
> Number Of Attributes: 1
>
> units : hours since 1800-01-01 00:00:00.0
>
> ncl 3> time at units = a->time at blahblah
>
> warning:FileReadVarAtt: (blahblah) is not an attribute of (time)
>
> ----------------------------------------
> Kyle S. Griffin
> Department of Atmospheric and Oceanic Sciences
> University of Wisconsin - Madison
> Room 1407
> 1225 W Dayton St, Madison, WI 53706
> Email: ksgriffin2 at wisc.edu
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
More information about the ncl-talk
mailing list