[Thread Prev][Thread Next][Index]

Re: [ferret_users] how to set missing value on one fixed time



Hi Dawn,
If zero is always going to be a bad value, and there are no other missing data, this is very simple. You can set the bad -data flag to be 0.

   SET VAR/BAD=0  temp
   SET VAR/BAD=0  sst

If there is already a bad-data flag, and you want places where temp is 0 also to be marked as missing, then define a new variable. (this concept is called masking, if you want to read about it in the Users Guide.)

   LET my_temp = IF temp NE 0 THEN temp

If you want to only ignore 0 when it is in that one part of the time axis, you could make a fancier mask. For instance, here's a variable on a monthly time axis, and say we want to mask out data at just one time.  We need to get the time coordinate for that month (here it's some number of days since the year 1700).  You can run this example using the online dataset:

yes? SET DATA "http://ferret.pmel.noaa.gov/NVODS-FDS/LAS/coads_time_series_1854_1993/sst"
yes? LET tt = T[GT=sst]
 
! dec1980 is the time coordinate corresponding to 15-dec-1980

yes? LET  dec1980 = TT[T=15-dec-1980]
 
! define a mask: 1 at all times except the one time.

yes? LET tmask = IF tt NE dec1980 THEN 1  ! There is an implied "else missing"
 
! Check that the mask variable is missing in December 1980

yes? LIST/T=1-sep-1980:1-mar-1981 tt, tmask
             DATA SET: http://ferret.pmel.noaa.gov/NVODS-FDS/LAS/coads_time_series_1854_1993/sst
             TIME: 01-SEP-1980 00:00 to 01-MAR-1981 00:00
 Column  1: TT is T[GT=SST]
 Column  2: TMASK is IF TT NE DEC1980 THEN 1
                            TT   TMASK
15-SEP-1980 00 / 1521:  102525.  1.000
15-OCT-1980 00 / 1522:  102555.  1.000
15-NOV-1980 00 / 1523:  102586.  1.000
15-DEC-1980 00 / 1524:  102616.   ....
15-JAN-1981 00 / 1525:  102647.  1.000
15-FEB-1981 00 / 1526:  102678.  1.000
 
! Apply the mask to a variable. December 1980 is missing in the masked var.

yes? LET var = sst[X=300:320@AVE,Y=20:40@ave]
yes? LET masked_var = tmask * var
 
yes? LIST/T=1-sep-1980:1-mar-1981 var, masked_var
             DATA SET: http://ferret.pmel.noaa.gov/NVODS-FDS/LAS/coads_time_series_1854_1993/sst
             TIME: 01-SEP-1980 00:00 to 01-MAR-1981 00:00
             LONGITUDE: 60W to 40W
             LATITUDE: 20N to 40N
 Column  1: VAR is SST[X=300:320@AVE,Y=20:40@AVE]
 Column  2: MASKED_VAR is TMASK * VAR
                         VAR  MASKED_VAR
15-SEP-1980 00 / 1521:  26.80   26.80
15-OCT-1980 00 / 1522:  26.04   26.04
15-NOV-1980 00 / 1523:  24.14   24.14
15-DEC-1980 00 / 1524:  22.60    ....
15-JAN-1981 00 / 1525:  21.85   21.85
15-FEB-1981 00 / 1526:  21.20   21.20

 

ferret ocean wrote:
hi, ferreters
   I have a monthly dataset including temp and salt varies with (x,y,z,t). However, there is all zero on one month, such as Dec, 1980.  
    How can I set the 4-D variables in Dec, 1980 with missing value, so the calculation should be ignore it.
    Any help would be appreciated.
 
Dawn
 
 


Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2¢/min or less.

[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement