# Re: [ferret_users] Number of occurrence of data in a coarse grid

```This topic has been discussed in this user group several times. Try searching the group archives for "counting by gridbox" or something similar.

You will find the message below.

Please do such a search BEFORE writing to the group. We have been discussing these topics for 20 years. The archives is a wonderful source of knowledge. You will often learn things about Ferret that you didn't realize it could do. Before writing to hundreds of busy people around the world, see if your question has already been answered.

You are more likely to get our attention if your message begins "I searched the archives but did not find the answer. My question is about ..."

Search the archives at:

http://ferret.pmel.noaa.gov/static/Ferret_search/ferret_mail_archives.html

> On 31 Aug 2011, at 11:44 PM, Russell Fiedler wrote:
>
> ! How can I count the number of data points that fall in each gridbox?
>
> ! put points into 1x1 bins on (0,2]x(0,2]
>
> ! here are the points we want to bin
>
> let xvals=zsequence({ 0.1, 2.0, 0.2 })
> let yvals=zsequence({ 0.1, 2.0, 0.2 })
>
> ! Define our bounds Note promotion to 2D
>
> let xl= i[i=1:2]-1+0*xvals
> let xh= i[i=1:2]+0*xvals
> let yl= j[j=1:2]-1+0*xvals
> let yh= j[j=1:2]+0*xvals
>
> let isinboxx = if ( xvals le xh and xvals gt xl ) then 1 else 0
> let isinboxy = if ( yvals le yh and yvals gt yl ) then 1 else 0
>
> let isinbothboxes = isinboxx*isinboxy
> let numinbox = isinbothboxes[z=@sum]
>
> list numinbox
>
>            VARIABLE : ISINBOTHBOXES[Z=@SUM]
>             SUBSET   : 2 by 2 points (X-Y)
>             Z        : 0.5 to 3.5
>             1      2
>             1      2
> 1   / 1:  2.000  0.000
> 2   / 2:  0.000  1.000

> On Jun 30, 2016, at 11:09 PM, Murali Kallungal <mkallungal@xxxxxxxxx> wrote:
>
> Hi All
> I have 4 km sst data, due to cloud cover during monsoon months some data is missing.
> I assume a coarse grid (say 2°) and would like to know how many good data points in coarse grid w.r.t. data point in each day for my computation.
>
> Muraleedharan
>
> --
> -------------------------------
>
> Muraleedharan K.R
> -------------------------------
> Scientist
> National Institute of Oceanography
> Regional Centre
> P.B. No. 1913
> Kochi - 682 018
> Kerala, India
> Ph (O): +91-484-2390306
> Fax:     +91-484-2390618
> Mob:    +91 9495254557
> E-mail: muraleedharan@xxxxxxx

```