[Thread Prev][Thread Next][Index]

Re: [ferret_users] extracting



Hi,
The LIST/ORDER= (See Note 2 in that section) command will list out data and control what is in each record. For instance, /ORDER=T will put all the time requested across the record.
yes? use monthly_navy_winds
yes? list/order=t/x=65/y=5/L=1:7 uwnd
             VARIABLE : ZONAL WIND (M/S)
             FILENAME : monthly_navy_winds.cdf
             FILEPATH : /home/users/tmap/ferret/linux/fer_dsets/data/
             SUBSET   : 7 points (TIME)
             LONGITUDE: 65E
             LATITUDE : 5N
           1982   1982   1982   1982   1982   1982   1982 
            1      2      3      4      5      6      7
         -1.703 -2.818 -1.552 -0.132  3.240  4.078  4.615
So, how to also list the lon,lat values at the start of each record?  Here are the coordinate values corresponding to x=65,y=5.  Get x[gx=var] and y[gy=var], in case the coordinates don't match the values you request. Say for instance if the grid values were at x=60,62,64, ...  You want to list the coordinates from the dataset.
yes? let loc = {`x[gx=uwnd,x=65]`, `y[gy=uwnd,y=5]`}
 !-> DEFINE VARIABLE loc = {65, 5}
Now define a variable which combines the locations and the timesteps of the variable.  Make this variable a list in the T direction, so we can still list this on one record using /ORDER=T. 
yes? let outvar = TCAT(tsequence(loc), uwnd[x=65,y=5,L=1:7])
yes? list/order=T/noheader outvar
          65.00   5.00  -1.70  -2.82  -1.55  -0.13   3.24   4.08   4.62

You could use the /FORMAT= qualifier to control the number of digits written out.

OK. To list out a record like this for all the locations, use REPEAT.  Here are the range of indices for the region in X and Y:
let i1 = i[g=uwnd,x=65]
let i2 = i[g=uwnd,x=80]

let j1 = j[g=uwnd,y=5]
let j2 = j[g=uwnd,y=10]
Here are variables at the coordinate locations:
let xx = x[gx=uwnd]
let yy = y[gy=uwnd]

repeat/i=`i1`:`i2` ( repeat/j=`j1`:`j2` (\
 let loc = tsequence({`xx`,`yy`}); \
 list/append/file=list.out/nohead/order=t tcat(loc,uwnd[x=`xx`,y=`yy`,L=1:7])
))
I'd suggest writing some header lines to the file before you start.  SAY/OUTFILE=  could be used to do that. For your data you'll also need the /WIDTH qualifier on the LIST command, to allow those extra long records.

The file I wrote above looks like this:

          65.00   5.00  -1.70  -2.82  -1.55  -0.13   3.24   4.08   4.62
          65.00   7.50  -3.45  -3.23  -1.92  -0.79   1.45   8.35   6.38
          65.00  10.00  -4.10  -3.64  -2.68  -1.65   0.07   6.95   7.40
          67.50   5.00  -1.75  -2.38   0.74   0.74   0.27   5.20   0.92
          67.50   7.50  -3.12  -2.18  -0.76   0.04   0.73   7.40   4.76
          67.50  10.00  -3.06  -1.44  -0.28  -0.96   0.53   6.08   5.17
          70.00   5.00  -1.17  -0.44  -0.67   2.14  -0.35   4.01   2.80
          70.00   7.50  -1.81  -2.50  -0.04   0.36  -0.41   4.47   4.00
          70.00  10.00  -2.69  -1.37   0.54  -0.42   0.70   5.20   4.86
          72.50   5.00   0.35   0.42   0.28   2.89   2.13   6.01   3.91
          72.50   7.50  -1.63  -1.34   0.72   2.13   2.42   6.92   6.79
          72.50  10.00  -1.71  -0.33   1.13   1.60   1.57   6.37   7.39
          75.00   5.00  -0.85  -0.52   1.29   3.44   3.48   6.63   4.26
          75.00   7.50  -2.04  -1.11   1.92   2.50   3.31   7.61   5.36
          75.00  10.00  -1.94  -0.43   1.65   3.37   2.81   7.93   7.44
          77.50   5.00  -1.59  -2.89   1.17   3.40   5.86   5.27   4.57
          77.50   7.50  -3.23  -1.95   0.32   2.53   4.08   4.84   4.18
          77.50  10.00  -1.01  -0.05   0.37   0.98   0.87   0.82   0.90
          80.00   5.00  -2.38  -2.45  -0.08   2.37   4.94   6.71   7.00
          80.00   7.50  -2.68  -1.61   0.75   1.49   2.68   4.11   2.74
          80.00  10.00  -4.23  -1.70   0.70   1.64   3.02   5.05   3.75



On 2/9/2015 2:47 AM, Nitin Patil wrote:
Dear ferret users,

I am extracting data at all pixel for 120 days using:

let data="">

What I have to do is to extract as given below in ascii file as specified columns:

lat lon day1 day2 day3 day4 ..........day1220

anyone knows how to do 



--
Regards,
Nitin Patil



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

Privacy Policy | Disclaimer | Accessibility Statement