[Thread Prev][Thread Next][Index]

Re: [ferret_users] zero values to NaN



Hi,

Ferret does not treat values of -999 as NaN. Instead it stores the missing flag, whatever is indicated in the dataset, and handles those values in calculations as missing data - whether that is skipping that data in calculations, or counting valid data values, or whatever the _expression_ requires.

Because many files written with other software use NaN for missing values, Ferret will read netCDF files that use NaN, but  when writing netCDF data, it doesn't write NaN as the missing flag.


Ansley

On 8/16/2017 1:20 AM, Abhisek Chatterjee wrote:
Dear Atul,

Another way of specifying any value (say -999 ) as nan is

set var/bad=-999 uval

Then all -999 values will be treated as NaN.

Regards,
Abhisek 


On Wed, Aug 16, 2017 at 12:55 PM, Russ Fiedler <russell.fiedler@xxxxxxxx> wrote:

Hi,

Rather than using "NaN" it's is preferable to use "missing" values. What you want is the IGNORE0() function

let uvels=IGNORE0(uvel)

This sets all zero to missing.

In general if you want to mask out a value but keep the rest.

let val_if_not_equal_to_foo = if val ne foo then val


http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/variables-xpressions/VARIABLES#_VPID_75


http://ferret.pmel.noaa.gov/Ferret/documentation/users-guide/commands-reference/IF


Russ



On 16/08/17 16:54, Atul Srivastava wrote:
Dear ferret users I am new in ferret please tell me how I can set zero values in the data sets to NaN values. Regarding this I am using this command but it does not work properly.


let uvels=uvel[x=40E:110E,y=20S:30N,z=1:500]

let nan = "NaN"

let uvelsn=IF uvels eq 0 THEN nan









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

Privacy Policy | Disclaimer | Accessibility Statement