[ncl-talk] Bug: _FillValue attribute erases previous data

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Tue Mar 28 14:59:23 MDT 2017


NCL team,

Under some conditions, adding a _FillValue attribute to an existing
Netcdf-4 file erases previous data.  I find this behavior with both NCL
6.3.0 and 6.4.0 on Mac OS 10.11 (El Capitan).  I get the same behavior with
both netcdf4-classic and full netcdf4 formats.

mac56:~/ncl/bugs/fillvalue1 2> ncdump -s test3.nc
netcdf test3 {
dimensions:
dim = 10 ;
variables:
int var(dim) ;
var:_Storage = "contiguous" ;
var:_Endianness = "little" ;

// global attributes:
:_NCProperties = "version=1|netcdflibversion=4.4.1|hdf5libversion=1.8.17" ;
:_SuperblockVersion = 0 ;
:_IsNetcdf4 = 1 ;
:_Format = "netCDF-4 classic model" ;
data:

 var = 11, 22, 33, 44, 55, _, _, _, _, _ ;
}

mac56:~/ncl/bugs/fillvalue1 3> ncl
 Copyright (C) 1995-2017 - All Rights Reserved
 University Corporation for Atmospheric Research
 NCAR Command Language Version 6.4.0
 The use of this software is governed by a License Agreement.
 See http://www.ncl.ucar.edu/ for more details.
ncl 0> f=addfile("test3.nc","w")
ncl 1> f->var at _FillValue = 99
ncl 2> exit

mac56:~/ncl/bugs/fillvalue1 4> ncdump -s test3.nc
netcdf test3 {
dimensions:
dim = 10 ;
variables:
int var(dim) ;
var:_FillValue = 99 ;
var:_Storage = "contiguous" ;
var:_Endianness = "little" ;

// global attributes:
:_NCProperties = "version=1|netcdflibversion=4.4.1|hdf5libversion=1.8.17" ;
:_SuperblockVersion = 0 ;
:_IsNetcdf4 = 1 ;
:_Format = "netCDF-4 classic model" ;
data:

 var = _, _, _, _, _, _, _, _, _, _ ;
}

In my opinion, the correct response for netcdf-4 formats should be an
error, something like "Can not change _FillValue after data is written in
netcdf-4", and the file is unchanged.  In any case, previous data should
not be silently erased.  If you agree, please fix this for the next
release.  Thanks.

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


More information about the ncl-talk mailing list