[Thread Prev][Thread Next][Index]

Re: [ferret_users] Problem with masking



 Hi -
The IF statements used to define masks are logically True/False statements, but the mask variable is a numeric variable consisting of 0's and 1's, with 0 equivalent to false and 1 equivalent to true.

See the documentation for IF,
http://porter.pmel.noaa.gov/Ferret/home/documentation/users-guide/commands-reference/IF, and continue to scroll down for section Ref Sec 14.2, "IF-THEN-ELSE logic for masking"

You could use this expression for the mask, and I think it will give the result you want:

   yes? let mask = if (sossheig or sossheig eq 0) then sossheig

-Ansley

On 9/7/2010 2:59 AM, Bruno Levier wrote:
Hi Ferreters

I'm trying to mask a 2D field from a NetCDF file. The first example works fine :


     NOAA/PMEL TMAP
     FERRET v6.2
     Linux(g77) 2.6.9-22. - 05/19/09
      7-Sep-10 11:05

yes? use PSY2V4_2D.nc
yes? let mask = if sossheig LT 0.01 then sossheig
yes? list /j=120 /i=24:26 sossheig, mask
             DATA SET: ./PSY2V4_2D.nc
             X: 23.5 to 26.5
             Y: 120
             TIME: 01-MAY-2009 00:00
 Column  1: SOSSHEIG is Sea Surface Height (m)
 Column  2: MASK is IF SOSSHEIG LT 0.01 THEN SOSSHEIG
          SOSSHEIG    MASK
24   / 24: -0.01500 -0.01500
25   / 25:  0.00000  0.00000
26   / 26:  0.01400     ....


But not the second one:


yes? let mask = if sossheig then sossheig
yes? list /j=120 /i=24:26 sossheig, mask
             DATA SET: ./PSY2V4_2D.nc
             X: 23.5 to 26.5
             Y: 120
             TIME: 01-MAY-2009 00:00
 Column  1: SOSSHEIG is Sea Surface Height (m)
 Column  2: MASK is IF SOSSHEIG THEN SOSSHEIG
          SOSSHEIG    MASK
24   / 24: -0.01500 -0.01500
25   / 25:  0.00000     ....
26   / 26:  0.01400  0.01400


Why is the "0" value masked in this case ?

Here's a ncdump of the file :

    short sossheig(time_counter, y, x) ;
        sossheig:units = "m" ;
        sossheig:missing_value = 32767.f ;
        sossheig:valid_min = -9999s ;
        sossheig:valid_max = 9999s ;
        sossheig:add_offset = 0.f ;
        sossheig:scale_factor = 0.001f ;
        sossheig:long_name = "Sea Surface Height" ;
        sossheig:standard_name = "sea_surface_height_above_geoid" ;
        sossheig:short_name = "sossheig" ;
        sossheig:online_operation = "N/A" ;
        sossheig:axis = "TYX" ;
        sossheig:interval_operation = 86400 ;
        sossheig:interval_write = 86400 ;
        sossheig:associate = "time_counter nav_lat nav_lon" ;


Thanks in advance,

Bruno Levier




[Thread Prev][Thread Next][Index]

Contact Us
Dept of Commerce / NOAA / OAR / PMEL / TMAP

Privacy Policy | Disclaimer | Accessibility Statement