Hi Ferret users,
I was wondering how to replace the "missing" value (a.k.a. "bad" value
and fillvalue) of an existing dataset with a NaN.
It seems you can replace it with anything except it's not obvious how
to use NaN. I'm attaching a complete example at the end of this
message, but basically I tried this
let newvar = ifv var then var else (0/0)
set var/bad=NaN newvar
which doesn't work. Perhaps 0/0 doesn't generate a NaN ?
By "doesn't work", I mean that I saved the resultant variable to a
binary file and examined its contents to see if NaN was there. It
wasn't.
I use
FERRET v6.94
Darwin 14.1.0 - 02/26/15
Regards,
Ryo
!--- replace with -123 ==> Works. ----
set data coads_climatology
let sst_gt20 = if sst gt 20 then sst
let newsst = ifv sst_gt20 then sst_gt20 else (-123)
set var/bad=-123 newsst
save/clobber/l=1/file=tmp.nc newsst
list/clobber/l=1/format=STREAM/file=tmp.bin newsst
!--- Try to replace with NaN ==> Doesn't work. ----
set data coads_climatology
let sst_gt20 = if sst gt 20 then sst
let newsst = ifv sst_gt20 then sst_gt20 else (0/0)
set var/bad=NaN newsst
save/clobber/l=1/file=tmp2.nc newsst
list/clobber/l=1/format=STREAM/file=tmp2.bin newsst