[Thread Prev][Thread Next][Index]

[ferret_users] Re: [Ferret_Users] SAMPLEIJ of an array of size [680,380]



Hi Zhen,
The function SAMPLEIJ samples the function at a set of coordinate pairs (xpts,ypts) where the x coordinates of the sample points are listed in argument 2 and the y coordinates are listed in argument 3. So yes, the number of points in argument 2 and in argument 3 must be the same and if they are not, Ferret will use the first n pairs of (xpts,ypts) where n is the size of the smaller list, 380 in your case.

Here is a simple example:

yes? ! define a simple grid and variable
yes? def axis/x=1:51:10 xax
yes? def axis/y=1:3:1 yax
yes? let var = i[gx=xax]+10*j[gy=yax]

yes? list var
VARIABLE : I[GX=XAX]+10*J[GY=YAX]
SUBSET : 6 by 3 points (X-Y)
1 11 21 31 41 51 1 2 3 4 5 6
1 / 1: 11.00 12.00 13.00 14.00 15.00 16.00
2 / 2: 21.00 22.00 23.00 24.00 25.00 26.00
3 / 3: 31.00 32.00 33.00 34.00 35.00 36.00

yes? let xpts = {1,41,11}
yes? let ypts = {3,1,2}
yes? list sampleij(var,xpts,ypts)
VARIABLE : SAMPLEIJ(VAR,XPTS,YPTS)
SUBSET : 3 points (X)
1 / 1: 31.00
2 / 2: 15.00
3 / 3: 22.00


The function returns the value of the variable at the locations of the coordinate pairs (xpts,ypts) = (1,3) , (41,1), and (11,2).

What did you want from the function? I'm sure we can help you define things so that you can return the result you want.

Ansley

zhen.li@gsfc.nasa.gov wrote:

Dear Ferret_Users:

It seems to me that SAMPLEIJ only subsamples the array that has the same number of
points in "i" and "j" direction. For example, my effort to use the following
script to subsample the array of size [680,380] failed, because it only subsampled
the point in the "I" direction. The new array "var_ij" has a size of [390,1]. I wonder
if anyone can help me with this case.

!FILE/VAR="ipts" ipts.dat (ipts=2,4,6,....,680)
!FILE/VAR="jpts" jpts.dat (jpts=2,4,6,....,380)
!use ocean_density.res.nc
!let var_ij=sampleij(RHO_TAUM1,ipts[d=1],jpts[d=2])

Thanks!

Zhen



[Thread Prev][Thread Next][Index]

Dept of Commerce / NOAA / OAR / PMEL / TMAP

Contact Us | Privacy Policy | Disclaimer | Accessibility Statement