Set of columns from 3D dataset using 'getind_latlon2d'

From: Jakob Tendel <tendel_at_nyahnyahspammersnyahnyah>
Date: Fri Jun 11 2010 - 15:13:11 MDT

Hi,

SITUATION:
        I have model data on a (40layer x 400lat x 550lon) grid, converted out
of a rotated lat/lon grid. I have lat2D and lon2D fields for this data.

  I want to extract whole vertical columns of this data at a set of
specific coordinates (lat/lon). I use the function 'getind_latlon2d' to
give me the indices into lat2D/lon2D for the nearest grid points to
these locations, which is acceptable.

PROBLEM:
        The output of 'getind_latlon2d' has the form (n_points x 2), a set of
indices into the rightmost two dimensions of my data. I want to use
these indices to subscript into the data to give me a set of columnar
data for each of the locations, i.e. a 2D array. However, when I
subscript the data in the form 'data( : , idx(:,0) , idx(:,1) ), I get a
3D array in return. What I actually want is the horizontal diagonal of
this array (:,0,0), (:,1,1,),(:,2,2) etc.

QUESTION:
        Is there a sensible way of extracting a set of vertical columns out of
3D data and writing them into a 2D array using proper array indexing
notation? Yes of course this can be done with loops but that is horribly
slow and not really the point, is it?

Thanks for any tips,

Jakob

--
Jakob Tendel					Phone  303 497 2713
Research Applications Laboratory		Office 3106b
National Center for Atmospheric Research	Building FL2
3450 Mitchell Lane
Boulder CO 80301


_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Fri Jun 11 15:13:23 2010

This archive was generated by hypermail 2.1.8 : Wed Jun 16 2010 - 15:28:33 MDT