[ncl-talk] Writing to to new netcdf file after replacing NaNf

David Brown dbrown at ucar.edu
Tue Apr 19 18:06:37 MDT 2016


Hi Freddie,

I am writing about a message you sent to ncl-talk in November:
I have a file containing NaNf as missing values that are not
recognized by standard tools except "ncdump". I tried hard to get rid
of NaNf but I got stuck in write the clean data to a new netcdf file.
I get the following error:

fatal:["NclFile.c":432]:FileAddVar: an error occurred while adding a
variable to a file, check to make sure data type is supported by the
output format
fatal:["Execute.c":8575]:Execute: Error occurred at or near line 67 in
file replaceNaN.ncl

I will be grateful for your help. I have attached my small script and
the file containg NaNf.

----------

I just want to say that any problems related to NCL related to this
script have been fixed. The source of the error messages is that the
original NetCDF files is NetCDF4 and it makes the type of the "time"
variable "uint" (unsigned integer). The error comes about because you
were writing to a NetCDF3 file and the variable you were writing
contains "time" as a coordinate variable. It is a bit confusing
because you were actually writing a "float" variable, a type that is
certainly supported in NetCDF3. The coordinates get written
implicitly. It might be a good idea for us to put the name of the
variable causing the type error into the message.

So your script can be fixed either by replacing the time coordinate
with an integer type coordinate variable:

xETo&time := tointeger(xETo&time)

or opening the output file as NetCDF4 by calling:

setfileoption("nc","Format","NetCDF4")

prior to opening the output file.
 -dave


More information about the ncl-talk mailing list