# scatter plot of gridded and non-gridded data

From: Deniz Bozkurt <deniboz_at_nyahnyahspammersnyahnyah>
Date: Fri, 3 Jul 2009 16:02:28 +0300

Hi all,

I have a time averaged gridded data with a horizontal resolution of 27
km (lat|0:149, lon|0:265). I'd like to plot scatter diagram of the
gridded data with non-gridded data (lat|0:249, lon|0:249) by finding
and writing the every non-gridded data within each grid box, if
there's. However, each lat/lon coordinates of the gridded data
corresponds to the center of the grid, so I need to determine borders
of the grid by using the horizontal resolution in units of degree,
something like this:

lat_nongrid =(0:249)
lon_nongrid=(0:249)
lat_grid = (0:149)
lon_grid = (0:265)
kmtodeg=0.12

do k=0,249
do j=0,265
do i=0,149
if ((lat_nongrid(k).gt.(lat_grid(i)-kmtodeg)).and.(lat_nongrid(k).le.
(lat_grid(i)+kmtodeg)).and.(lon_nongrid(k).gt.(lon_grid(j)-
kmtodeg)).and.(lon_nongrid(k).le.(lon_grid(j)+kmtodeg))) then
...

but I'm not sure this is an efficient way to determine each values and
then plot the diagram. Any comments or ideas are welcome.