>I have 2180 tree ring sites with lat(0:2179) and lon(0:2179)
>and ringwidth(0:2179,0:99) for (site,time).
>
>I also have a gridded dataset with sfct(0:99,0:359,0:719)
>for (time,lat,lon) and lato(0:359) for the latitudes and lono(0:719)
>for the longitudes.
>
>For each tree ring site, I want to find within which lat/lon box in the
>gridded dataset that it lies and use that sfct. What is the
>fastest way to do this, avoiding too many do loops?
>_______________________________________________
Mike ...
Adam's solution is close.
Would the following work?
It might not find the "nearest" but rather the lower
left corner of the box. Given a 1x1 grid, I don't think
it makes much difference.
nTim = 100
nTree = 2178
SFCT = new ( (/nTree,ntim/) , typeof(ringwidth), getFillValue(sfct))
do n=0,nTree-1
SFCT(n,:) = (/ sfct(:,{lat(n)},{lon(n)}) /) ; don't transfer meta data
end do
; optional meta data
SFCT!0 = "tree"
SFCT!1 = "time"
SFCT&time = sfct&time
SFCT_at_long_name = sfct_at_long_name +: nearby grid point"
printVarSummary(SFCT)
D
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Jul 17 2006 - 12:02:59 MDT
This archive was generated by hypermail 2.2.0 : Mon Jul 17 2006 - 14:09:20 MDT