vector subscripting

From: Timothy W. Hilton <hilton_at_nyahnyahspammersnyahnyah>
Date: Mon Mar 29 2010 - 01:01:01 MDT

Hello NCL-talk,

I have three 2D arrays: data_arr, lat_idx, and lon_idx. lat_idx and
lon_idx (both NxM) contain coordinate subscripts for data_arr; I need
the NxM array where
result(i,j) = data_arr( {lat_idx(i,j)}, {lon_idx(i,j)} )

It seems to me that vector subscripting does not work here, because
data_arr( ndtooned(lat_idx), ndtooned(lon_idx) )
results in an array with (N*M)^2 * (N*M)^2 elements, not N*M * N*M
elements.

I can do the job with nested loops, but it is too slow to be useful for
the amount of data I have. Can anyone suggest a more efficient way
using subscripting and/or built-in functions?

Any help greatly appreciated!

best,
Tim

--
Timothy W. Hilton
PhD Candidate, Department of Meteorology
The Pennsylvania State University
503 Walker Building, University Park, PA   16802
hilton@meteo.psu.edu
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Mar 29 01:01:18 2010

This archive was generated by hypermail 2.1.8 : Thu Apr 01 2010 - 11:31:45 MDT