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

From: Colin Zarzycki <zarzycki_at_nyahnyahspammersnyahnyah>
Date: Fri Nov 09 2012 - 15:13:31 MST

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
Received on Fri Nov 9 15:13:45 2012

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