[Thread Prev][Thread Next][Index]

Re: [ferret_users] monthly means



hi -
You need to define variables that contain the longitudes and latitudes and then make the gridded data into single list, being careful to choose the subset that you want.

First, let's see how to list a 2D variable as a 1-D list.  I'll use coads_climatology dataset that comes with Ferret, using the variable sst, and a smaller region.  If you wanted this data:
yes? use coads_climatology
yes? list sst[L=1,x=31e:35e,y=-30:-20]
The XSEQUENCE function unwraps a multi-dimensional variable onto a list on an abstract X axis. It's listed with the southernmost data coming first in the list.  (Look at the documentation about GRID-CHANGING functions to see why I put the region in square brackets).
yes? list xsequence(sst[L=1,x=31e:35e,y=-30:-20])
So that gives you the variable. To define a variable containing the longitudes from the grid of SST,
yes? let xx = x[gx=sst]
yes? list xx[x=31e:35e]
             VARIABLE : X[GX=SST]
             FILENAME : coads_climatology.cdf
             FILEPATH : /home/users/tmap/ferret/linux/fer_dsets/data/
             SUBSET   : 3 points (LONGITUDE)
 31E   / 6:  31.00
 33E   / 7:  33.00
 35E   / 8:  35.00
but this is just a 1D list. You want a variable with the longitude at each point of the XY grid of sst. It will be the same at each Y value.
yes? let xylon = x[gx=sst] + 0*y[gy=sst]
yes? list xylon[x=31e:35e,y=-30:-20]
             VARIABLE : X[GX=SST] + 0*Y[GY=SST]
             FILENAME : coads_climatology.cdf
             FILEPATH : /home/users/tmap/ferret/linux/fer_dsets/data/
             SUBSET   : 3 by 5 points (LONGITUDE-LATITUDE)
               31E    33E    35E  
                6      7      8
 21S   / 35:  31.00  33.00  35.00
 23S   / 34:  31.00  33.00  35.00
 25S   / 33:  31.00  33.00  35.00
 27S   / 32:  31.00  33.00  35.00
 29S   / 31:  31.00  33.00  35.00
And likewise for the latitudes,
yes? let xylat = 0*x[gx=sst] + y[gy=sst]
Putting all of this together, and using the /NOROW  qualifier to list only the variables,
yes? list/norow xsequence(xylon[x=31e:35e,y=-30:-20]), xsequence(xylat[x=31e:35e,y=-30:-20]),  xsequence(sst[L=1,x=31e:35e,y=-30:-20])
             DATA SET: /home/users/tmap/ferret/linux/fer_dsets/data/coads_climatology.cdf
             X: 0.5 to 15.5
 Column  1: XSEQUENCE(XYLON[X=31E:35E,Y=-30:-20])
 Column  2: XSEQUENCE(XYLAT[X=31E:35E,Y=-30:-20])
 Column  3: XSEQUENCE(SST[L=1,X=31E:35E,Y=-30:-20])
         (C001,V (C001,V010)
   31.00  -29.00   25.11
   33.00  -29.00   25.99
   35.00  -29.00   25.44
   31.00  -27.00    ....
   33.00  -27.00   26.63
   35.00  -27.00   26.75
   31.00  -25.00    ....
   33.00  -25.00   26.53
   35.00  -25.00   27.11
   31.00  -23.00    ....
   33.00  -23.00    ....
   35.00  -23.00   27.46
   31.00  -21.00    ....
   33.00  -21.00    ....
   35.00  -21.00   28.01
To make a nice listing you could define the variables for listing like this
let/units="Deg C"/title="SST" sst_out = XSEQUENCE(XYLON[X=31E:35E,Y=-30:-20])
and then list these variables, so that the "column 1" and so forth would contain the units and title of the variables.


On 6/27/2011 11:04 AM, Srinivas Chamarthi wrote:
hello everyone
Thanks for some immediate solutions...

I have a problem of saving data in ascii format. I am using the COADS mean monthly data and want 2
extract for zone 30E-120E and 30S -30N and write the same in 3 colums (longitude, latitude, uclim)
of ascii data. I have read and trying a lot but not able to work out of it.

can someone or anyone help

thanks in advance!


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

Privacy Policy | Disclaimer | Accessibility Statement