# Re: scatter plot of gridded and non-gridded data

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Fri, 03 Jul 2009 08:40:05 -0600

NCL is an iterpreted language and multiple
'do loops' tend to be slow. Particular attention
should be paid to the innermost operations

; loop over all the grid points
do n=0,149
do m=0,265
; find locations [subscripts] of all non-gridded points
; within boundary limits
i = ind((lat_nongrid.gt.(lat_grid(n)-kmtodeg)) .and. \
(lat_nongrid.lt.(lat_grid(n)+kmtodeg)) .and. \
(lon_nongrid.gt.(lon_grid(m)-kmtodeg)) .and. \
(lon_nongrid.gt.(lon_grid(m)+kmtodeg)))

if (.not.ismissing(i(0))) then
.....
end if

delete(i) ; size may change on the next iteration
end do
end do

Deniz Bozkurt wrote:
> 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.
>
>
> Thanks in advance
>
>
> deniz
> _______________________________________________
> 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 Fri Jul 03 2009 - 08:40:05 MDT

This archive was generated by hypermail 2.2.0 : Tue Jul 07 2009 - 11:13:18 MDT