[ncl-talk] FillValue problems with Netcdf-4

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Apr 7 17:17:39 MDT 2015


NCL team,

This program gets a segmentation fault when writing a single value to a
Netcdf-4 classic test file.  I get the same behavior with NCL 6.2.1 and
6.3.0 on Mac OS 10.10.2, also NCL 6.2.1 on Redhat Linux 6.6.

mac56> ncdump -s data.nc
netcdf data {
dimensions:
   t = 3 ;
variables:
   float dat(t) ;
      dat:_Storage = "chunked" ;
      dat:_ChunkSizes = 3 ;
      dat:_DeflateLevel = 0 ;
      dat:_Shuffle = "true" ;

// global attributes:
      :_Format = "netCDF-4 classic model" ;
data:

 dat = 10, 20, 30 ;
}
-------------------------------------------------
begin
  outfile = "data.nc"
  print ("Open test file in write mode: " + outfile)
  out = addfile (outfile, "w")    ; open as read/write, for updating

  dims = (/ 3, 5 /) ; create dummy array
  avs = new (dims, float)
  avs = 99.0

  vmin = new (3, float, "No_FillValue")
  vmin(:) = dim_min_n (avs, 1)
;;  vmin(:) = min (avs)

  printFileVarSummary (out, "dat")
  print (vmin)

  print ("Write single value to file variable 'dat'.")
  out->dat(0) = (/ vmin(0) /)
  print ("Test complete.")
end
-------------------------------------------------
mac56> ncl test6.ncl
 Copyright (C) 1995-2015 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.3.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
(0) Open empty file in write mode: data.nc

Variable: dat
Type: float
Total Size: 12 bytes
            3 values
Number of Dimensions: 1
Dimensions and sizes: [t | 3]
Coordinates:
            t: not a coordinate variable
Number of Attributes: 0

Variable: vmin
Type: float
Total Size: 12 bytes
            3 values
Number of Dimensions: 1
Dimensions and sizes: [3]
Coordinates:
(0) 99
(1) 99
(2) 99
(0) Write single value to file variable 'dat'.
/Users/dallured/bin/ncl: line 6: 61511 Segmentation fault: 11
 /usr/local/ncl/bin/ncl "$@"

I see the possible combination of two bugs combined.  vmin should have
received a _FillValue attribute from the dim_min_n function, and NCL should
print a rational error message rather than seg fault.  Let me know if I am
misunderstanding something.

This is a low priority request, I have my own workaround.  Could you please
fix one or both of these conditions for a future release.  Thank you for
taking a look at this.

--Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150407/c54e1be9/attachment.html 


More information about the ncl-talk mailing list