[Thread Prev][Thread Next][Index]

Re: [ferret_users] how to count the number of irregularly-spaced observations in each gridbox



Hi Billy,
There are a couple of very recent functions  SCAT2GRID_NBIN_XY and SCAT2GRID_NBIN_XYT, which we developed for our use and which are included in Ferret v6.7. 
yes? sh func scat2grid_nbin*
SCAT2GRID_NBIN_XY(XPTS,YPTS,F,XAXPTS,YAXPTS)
    Count observations when putting scattered data into  XY grid by binning
    XPTS: X coordinates of scattered XY locations
    YPTS: Y coordinates of scattered XY locations
    F: F(X,Y) Data at scattered input XY locations
    XAXPTS: X axis coordinates of output grid
    YAXPTS: Y axis coordinates of output grid
SCAT2GRID_NBIN_XYT(XPTS,YPTS,TPTS,F,XAXPTS,YAXPTS,TAXPTS)
...

If that Ferret version isn't available to you we could give it to you as an external function.

Ansley

On 8/31/2011 10:23 PM, William S. Kessler wrote:
I have a long list of data triplets (x,y,value) that I am putting on a regular grid. No problem doing that, but how can I count the number of data points that fall in each gridbox?

I want to end up with a gridded field whose values are the number of the original (x,y) points within each box.

It seems like a simple task, but I can't think of a way to do it without a (double) repeat loop, or sorting and writing data out (twice). Ugly.

Anyone have a straightforward way to do this?

Frustratingly, the function SCAT2GRID_BIN_XY produces the bin-average. To do that it must compute the number of points in each bin. That number should be available to the user.

Thanks ... Billy K

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

Privacy Policy | Disclaimer | Accessibility Statement