[Thread Prev][Thread Next][Index]

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



Hi Zhen,
If what you want is a sub-sampling of the data at every second point (or other regular interval) in a NetCDF file, then you can use the "strides" syntax, [i=LO:HI:STRIDE,j=LO:HI:STRIDE]

yes? use ocean_density.res.nc
yes? show grid RHO_TAUM1

! I don't have the file, but if it shows 680 points in x and 380 points in the y direction, then
! defining the following variable would read every second point in each direction. This is done
! by the call to the netcdf library.
yes? let var_ij=RHO_TAUM1[i=2:680:2,j=2:380:2]

! Any value can be used for the stride, and changing the start value will sample different points.

yes? let var_ij = RHO_TAUM1[i=1:680:5,j=1:380:3]


Jaison Kurian wrote:

Hi Zhen,
          Yes, SAMPLEIJ needs same length for the ipts and jpts. The
resulting variable from this external function will have only one
abstract axis which corresponds to the length of ipts(=jpts) instead
of X and Y (Z and T will be inherited from the original variable).

  From the values given for ipts (=2,4,6,....,680) & jpts (=2,4,6,..
..,380) it seems that you are trying to regrid the density variable
to a coarser grid (without any averaging) which does have alternate
positions as grid points. For doing this there are proper methods like
--> defining a coarser destination grid, regrid the variable onto
that grid using @XACT regridding. If you can explain what exactly
you want to do, I can offer you a better help.

Let me know if you have any questions.

Regards,

Jaison

On Wed, 31 May 2006 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