2011-03-18 10:48:37 PDT
Thanks for pointing this out, and the workaround. Clearly we need better regression tests.
Here is a matrix of what does/does not work with ncatted -a overwrite mode in 4.0.7:
ncatted -O -a _FillValue,fll_val,o,f,-999 ~/nco/data/in.nc ~/foo.nc # Works on netCDF3 file when attribute already exists
ncatted -O -a _FillValue,lon,o,f,-999 ~/nco/data/in.nc ~/foo.nc # Works on netCDF3 file when attribute does not yet exist
ncatted -O -a _FillValue,fll_val,o,f,-999 ~/nco/data/in_4.nc ~/foo.nc # Works on netCDF4 file when attribute already exists
ncatted -O -a _FillValue,lon,o,f,-999 ~/nco/data/in_4.nc ~/foo.nc # Fails on netCDF4 file when attribute does not yet exist
So, it appears to fail only on netCDF4 files where the attribute already exists.
netCDF4 handles _FillValue unlike netCDF3. If it is possible to get this working
it will be in nco 4.0.8. Until then, use the workaround you suggested (or convert
to netCDF3 in/out files).
cz