Re: NaNs and iso

From: Mary Haley (haley AT ucar.edu)
Date: Wed Mar 30 2005 - 16:34:35 MST


On Wed, 30 Mar 2005, Derrick Snowden wrote:

> Hi,
>
> I've been using Silvia's iso.scp and iso.ncl to calculate isotherm depths from
> a netcdf file containing temperature. This program seems to work fine but
> there is a small quirk I can't figure out. If my input file is called
> temperature.atl.nc then the output from iso.scp will be
> iso_temperature.atl.nc. Inside iso_temperature.atl.nc is a variable called
> ISO with several attributes added. _FillValue among them. The _FillValue
> attribute is equal to the _FillValue from my original file. So far so good.
>
> When I use ncdump to view the contents of the new file, I see several fill
> values that are indicated by missing data in the ascii listing (e.g. ,_,_,_,
> etc) Additionally, I see "not a number" values denoted by "nan,nan,nan" etc.
> I'm not sure how to deal with the nans and they've choked up some subsequent
> analysis I was doing using NCO utilities. e.g.
>
> ncwa -alatitude,longitude iso_temperature.equ.pac.nc
> area_average_iso_z20_ecco.nc
>
> ncwa seems to understand the _FillValue but not the nans. The resulting file
> is entirely nans.
>
> Where did the nans come from? Is this a default fill value inside the fortran
> program that iso.ncl calls?
>
> Where should I try to fix it? I'd like to mask the nans so that in the file
> they are numerically equal to the _FillValue, and I guess iso.ncl is the
> place to make this modification.
>
> Ideas?
>
> Thanks much,
> Derrick

Hi Derrick,

I'm not sure where all the Nans came from, but there's a way you can
deal with them using a couple of NCL functions.

Inside your iso.ncl file, you can replace all your Nans with
ISO@_FillValue:

    if (any(isnan_ieee(ISO))) then
      replace_ieeenan(ISO, ISO@_FillValue, 0)
    end if

It is important to note that dealing with Nans varies from system
to system, and you need to be careful that the above steps actually
work on your system.

For documentation on these two functions, see:

   http://www.ncl.ucar.edu/Document/Functions/Built-in/isnan_ieee.shtml
   http://www.ncl.ucar.edu/Document/Functions/Built-in/replace_ieeenan.shtml

--Mary

> --
> Derrick Snowden
> PhOD/AOML/NOAA
> 4301 Rickenbacker Causeway
> Miami, FL 33149
> Office: 305.361.4322 Fax: 305.361.4392
> _______________________________________________
> ncl-talk mailing list
> ncl-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
ncl-talk@ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk



This archive was generated by hypermail 2b29 : Thu Mar 31 2005 - 09:00:27 MST