[Thread Prev][Thread Next][Index]
Re: [ferret_users] Missing value flag.
Hi Nikesh,
The trick is to define a "new" variable and assign the missing_value
as NaN. For those variables loaded from NetCDF file, the "set var/bad=NaN" command
will change the missing_value only in a temporal manner (see Ferret User Manual
Ref Sec31.11.1. SET VARIABLE/BAD=). The following example worked fine for me
(with Ferret versions 5.53 to 6.00):
use coads_climatology
let sfc_temp = sst[d=1]
set var/bad=NaN/title="My Temp"/units="^oC" sfc_temp
sp rm -f junk.nc
save/file=junk.nc/append sfc_temp
Now, do a ncdump on junk.nc, it will show the missing_value (and _FillValue)
attribute as
float SFC_TEMP(TIME, COADSY, COADSX) ;
SFC_TEMP:missing_value = nanf ;
SFC_TEMP:_FillValue = nanf ;
and the data values for sfc_temp will be like :
SFC_TEMP =
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
......................................................................
-1.56, -1.448571, -1.147778, -1.242857, -1.131111, -1.11, -1.1125,
-0.8677778, -0.675, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan,
You can also set the missing_values to NaN in Matlab itself. Typically,
misssing_values will be large -ve values. In Matlabe use an IF construct
to convert all missing values to NaN like :
if (var < -1000)
var = NAN
end
Relevant Topics on Ferret User Manual
Ch3 Sec1.6.1. Missing values in input files
Ref Sec31.11.1. SET VARIABLE/BAD=
Hope this helps,
Jaison
On Mon, 6 Aug 2007 nikesh@xxxxxxxxxxxxxxxxxxxx wrote:
> Hi ferreters,
>
> I want to change the missing value flag in a netcdf file from the default value
> to NaN, which is compatable with matlab.
>
> I have tried the
>
> set var/bad=NaN but it only changes the missing value for the current ferret
> session, if I am writing a new netcdf file even after the set var/bad=NaN
> command, in new netcdf file also the default value is given. Should I do
> something else for attaining that.
>
> Thanks in advance.
>
>
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce /
NOAA /
OAR /
PMEL /
TMAP
Privacy Policy | Disclaimer | Accessibility Statement