[Thread Prev][Thread Next][Index]

Re: [ferret_users] NetCDF: Not a valid data type or _FillValue type mismatch



Hi,
I think I see what may be the cause of this. I'll work with Bruno to verify this for the data he's looking at, but now I see what is happening with the dataset in the 2011 message with the earlier report of the same error.  That dataset has _FillValue attributes on the coordinate axis variables, e.g. in the ncdump output, the X axis looks like this:

...
        float longitude(longitude) ;
                longitude:valid_min = -12.f ;
                longitude:valid_max = -7.f ;
                longitude:step = 0.1666641f ;
                longitude:units = "degrees_east" ;
                longitude:unit_long = "Degrees East" ;
                longitude:long_name = "Longitude" ;
                longitude:standard_name = "longitude" ;
                longitude:_FillValue = 1.e+35f ;

This isn't something we expect under the CF standard for NetCDF datasets, because coordinate variables must have all valid values. But apparently some software is set up to write this attribute.

Ferret always writes coordinate data with the double-precision datatype, and for coordinate variables, it writes out all of the attributes from the file.  So it has set itself up to write a double-precision variable with a single-precision _FillValue attribute. That's the error condition that the NetCDF library is returning (error code -45 _FillValue type mismatch).

We can fix this within Ferret by either not writing the _FillValue attribute for coordinate axes, or setting its type to match the coordinate data type. 

A workaround with existing versions of Ferret is to tell Ferret not to write this attribute for the coordinate axes. 

yes? use test_out.cdf
yes? cancel att/output (`u,return=xaxis`)._FillValue
yes? cancel att/output (`u,return=yaxis`)._FillValue
yes? cancel att/output (`u,return=zaxis`)._FillValue

yes? set reg/i=10/j=10
yes? save/file=test_out_subset.cdf/clobber u

-Ansley



On 9/12/2012 9:27 AM, Bruno Levier wrote:
Hi

I have the same kind of problem that Paulo mentioned one year ago, and I couldn't find a solution in Ferret's archives.

I can plot a variable from a dataset, but I can not save it in a new file.

yes? use my_data.nc
yes?
yes? stat atms

             Atmospheric pressure at sea level
             X:  N/A
             Y:  N/A
             DEPTH (m): -99999
             TIME: 30-APR-2012 22:00 to 04-MAY-2012 04:30
             E:  N/A
             F:  N/A
             DATA SET: my_data.nc

 Total # of data points: 43 (1*1*1*43*1*1)
 # flagged as bad  data: 0
 Minimum value: 1018
 Maximum value: 1020.5
 Mean    value: 1019.5 (unweighted average)
 Standard deviation: 0.72517
yes?
yes? save /file=toto.nc atms
 LISTing to file toto.nc
NetCDF: Not a valid data type or _FillValue type mismatch (OPeNDAP/netCDF Error code -45)
 could not change CDF mode
ncclose: ncid 131072: NetCDF: Not a valid data type or _FillValue type mismatch



ncdump of the file gives for variable ATMS:

    float ATMS(TIME, DEPTH) ;
        ATMS:long_name = "Atmospheric pressure at sea level" ;
        ATMS:standard_name = "air_pressure_at_sea_level" ;
        ATMS:units = "hectopascal" ;
        ATMS:_FillValue = 9.96921e+36f ;



Thank you for your help,

Bruno Levier


On 08/31/2011 07:37 PM, Paulo B. Oliveira wrote:
Hi,

The attached CDF file (test_out.cdf) was built by an extraction tool
from the MyOcean (http://www.myocean.eu.org/) data server. It's OK to
plot the data but I'm not being able to save a subset of data.

A "Not a valid data type" error occurs, either asking to preserve the
variable attributes or not.

Any hints ? Thanks.

___________________________ converting to float ________________
$ ferret
      NOAA/PMEL TMAP
      FERRET v6.65
      Linux rh5 (gfortran) 2.6.18-164.11.1.el5 - 11/30/10
      31-Aug-11 18:32

yes?  use test_out.cdf
yes? set reg/i=10/j=10
yes? save/file=test_out_subset.cdf/clobber u
  LISTing to file test_out_subset.cdf
  *** NOTE: Converting data type of missing_value NC_SHORT to match
output type of variable NC_FLOAT
NetCDF: Not a valid data type or _FillValue type mismatch
(OPeNDAP/netCDF Error code -45)
  could not change CDF mode
ncclose: ncid 131072: NetCDF: Not a valid data type or _FillValue type
mismatch

___________________________ keeping var atts ________________
$ ferret
      NOAA/PMEL TMAP
      FERRET v6.65
      Linux rh5 (gfortran) 2.6.18-164.11.1.el5 - 11/30/10
      31-Aug-11 18:32

yes? use test_out.cdf
yes? set reg/i=10/j=10
yes? set att/output=all (U)
yes? save/file=test_out_subset.cdf/clobber U
  LISTing to file test_out_subset.cdf
NetCDF: Not a valid data type or _FillValue type mismatch
(OPeNDAP/netCDF Error code -45)
  could not change CDF mode
ncclose: ncid 131072: NetCDF: Not a valid data type or _FillValue type
mismatch

  



[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement