[Thread Prev][Thread Next][Index]

Re: [ferret_users] List only valid data points



Hi,
Leave the "else 0" off your mask definition; then the mask keeps locations where the variable is > 26.5, and otherwise marks them missing.  So, here's a look at some data and show the mask in action:

yes? list/l=1/y=15/x=65:100 sst, msk, msk*sst
             DATA SET: /home/users/tmap/ferret/linux/fer_dsets/data/coads_climatology.cdf
             LONGITUDE: 65E to 100E
             LATITUDE: 15N
             TIME: 16-JAN 06:00
 Column  1: SST is SEA SURFACE TEMPERATURE (Deg C)
 Column  2: MSK is IF SST GE 26.5 THEN 1
 Column  3: EX#3 is MSK*SST
              SST    MSK   EX#3
65E   / 23:  25.74   ....   ....
67E   / 24:  26.48   ....   ....
69E   / 25:  26.97  1.000  26.97
71E   / 26:  27.32  1.000  27.32
73E   / 27:  27.51  1.000  27.51
75E   / 28:  27.58  1.000  27.58
77E   / 29:   ....   ....   ....
79E   / 30:   ....   ....   ....
81E   / 31:  26.32   ....   ....
83E   / 32:  26.34   ....   ....
85E   / 33:  26.54  1.000  26.54
87E   / 34:  26.33   ....   ....
89E   / 35:  26.18   ....   ....
91E   / 36:  25.99   ....   ....
93E   / 37:  26.52  1.000  26.52
95E   / 38:  26.65  1.000  26.65
97E   / 39:  27.09  1.000  27.09
99E   / 40:  28.63  1.000  28.63

If you don't care about the location of the data, but just want a simple list of all the valid data with the mask applied, you can do this: Use XSEQUENCE to unravel the data in 3D to a list in X; then the COMPRESSI function to move all the valid data to the start of the list. You could perhaps choose a subset in XYT,
yes? let masked_sst = sst*msk
yes? let sst_masked_list = compressi(xsequence(masked_sst[x=300:360,y=-20:20,L=1:4]))
yes? let ngd = `sst_masked_list[i=@ngd]`
yes? list/file=sst_msk.dat/format=(e14.4)/clobber/i=1:`ngd` sst_masked_list


-Ansley
On 11/15/2013 7:59 AM, Ge Peng - NOAA Affiliate wrote:
I would like to mask out fields and list only the valid data points. For example,

use coads_climatology

let msk=IF sst GE 26.5 THEN 1 ELSE 0

let sst_msk=sst*msk

list/file=sst_msk.dat/format=(e14.4)/clobber sst_msk         

This lists values for all points. I am wondering if there is a way to list just the non-zero (valid) data points.

Thanks for your help,

--- Peng


--
Ge Peng, Ph.D
Research Scholar
Cooperative Institute for Climate and Satellites NC
North Carolina State University
NOAA's National Climatic Data Center
151 Patton Ave, Asheville, NC 28801
ge.peng@xxxxxxxx
o: +1 828 257 3009
f:  +1 828 257 3002

Following CICS-NC on Facebook





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

Privacy Policy | Disclaimer | Accessibility Statement