[Thread Prev][Thread Next][Index]

Re: [ferret_users] replace fillvalue with NaN ?



Hi Ansley,

> Ferret does not generate Nan's. A 0/0 will be replaced with the default
> missing-data flag of -1.e34.
>
> For a netCDF file which has NaN as the missing-data flag, Ferret notes that
> and applies code to internally replace the NaN's with that flag.  In
> addition a number of files use NaN as the fill but don't set a missing_value
> or _FillValue flag, and Ferret handles those in the same way.

Thank you for the detailed explanation.  Now what I observed makes
perfect sense.

> Ideally we would do the reverse and write NaN's to the file on output when
> requested, [. . .]

That would be a nice future extension.  I guess the extension would
boil down to this single capability: the ability to "truly" set the
missing-data flag to NaN .

If we "truly" set it to NaN, a 0/0 will be replaced with the current
missing-data flag, which is NaN; NaN values in the input file will be
replaced with the current missing-data flag, which is NaN ! ; NaN
values will be written into output files as the missing-data flag;
etc.  --- All will be consistent.  (I'm not saying that you should
implement the feature internally like this.  If the user cannot see
the difference, it doesn't matter.)

In passing, I started this discussion of NaN because I've started to
use NaN's in my Fortran programs.  NaN's are helpful to detect your
programming error, and they are now much more usable than before.
Most Fortran compilers now support the standardized capability of
handling NaN's (and other standard IEEE-floating-point stuff), which
means you don't have to rely on the non-standard function isnan() to
detect NaN's or the hack "0/0" to generate a NaN.  Another piece of
good news is that Fortran compilers now support again the standardized
capability of procedure pointer, which would enable you to define your
own "is_missing()" function, which would normally point to a function
that compares its argument with the missing-data flag but would be
made to point to an is_nan() function when the missing-data flag is
NaN.

Regards,

Ryo

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

Privacy Policy | Disclaimer | Accessibility Statement