Re: Binning point data into lat-lon grid for 2D frequency/density plots

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Sat Nov 10 2012 - 13:12:32 MST

No matter what, I think you must define the grid.

I think you could use
   http://www.ncl.ucar.edu/Document/Functions/Built-in/bin_sum.shtml
Just use the count that is returned. A complicated example of
use is at http://www.ncl.ucar.edu/Applications/binning.shtml

However, I have attached an untested script that does what you want.
You must read in the data ...

On 11/9/12 3:13 PM, Colin Zarzycki wrote:
> Hello,
>
> I'm attempting to generate track density plots for tropical cyclones (i.e., the number of times/frequency a tropical cyclone passes over a given location within the global domain). Essentially a 2-D histogram. Here is a rough example of what I'd like to do: http://mpo581-hw2.wikispaces.com/file/view/colbert_tdall.jpeg/206350210/colbert_tdall.jpeg
>
> I have generated two arrays:
>
> cyclone_lat(:)
> cyclone_lon(:)
>
> which for a given ith value, provides the corresponding lat/lon location of a specific tropical cyclone at a given time. What I'm interested in doing is generating a lat-lon bin grid and then incrementing the count of each bin every time I have a cyclone lat/lon which falls in that bin's "domain."
>
> The only way I have been able to see doing this is generating a large zeros matrix and then for each ith value of cyclone_lat and cyclone_lon looping over the matrix until it finds the closest lat-lon pair and incrementing that bin's value by 1, although that would seem to require array reshaping and a lot of seemingly unnecessary loops for large data sets.
>
> So before starting that I figured I'd dig around - I wasn't able to find a similar example on the webpage, but is there a function or feature that takes point data and accumulates it onto a spatial grid in this fashion that would be more efficient than the above proposal?
>
> Apologies in advance if this is a simpleton question!
>
> Cheers,
>
> -Colin
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Sat Nov 10 13:12:43 2012

This archive was generated by hypermail 2.1.8 : Tue Nov 13 2012 - 14:27:24 MST