Re: About the 2-dimensiontal lon and lat

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Feb 05 2013 - 16:33:00 MST

Dear Ke Deng,

In the future, please only send your messages to ncl-talk, and don't post questions to individual people.
Whenever you do this, folks on the list assume that the individual will answer, and everybody else ignores
the question.

I think what you want is the "getind_latlon2d" function, but this will only work if your lat/lon grid
has a pretty rectangular structure to start with.

This is UNTESTED:

  lat2d = f->lat
  lon2d = f->lon
  nm = getind_latlon2d(lat2d,lon2d,(/20,70,/),(/110,260/))

  Then, you can subscript with:

    sst_CW(lat | nm(0,0):nm(0,1), lon | nm(1,0):nm(1,1), time | :)

If your grid doesn't have a nice rectangular structure, then you will need to consider regridding it
to a rectilinear grid.

See rcm2rgrid_Wrap, or ESMF_regrid:

http://www.ncl.ucar.edu/Document/Functions/Contributed/rcm2rgrid_Wrap.shtml
http://www.ncl.ucar.edu/Document/Functions/ESMF/ESMF_regrid.shtml

--Mary

On Feb 5, 2013, at 11:32 AM, Ke Deng wrote:

> Hi, Mary
> I meet with the problem of the 2-dimensional lon and lat.
> dimensions:
> time = UNLIMITED ; // (1872 currently)
> j = 384 ;
> i = 320 ;
> bnds = 2 ;
> vertices = 4 ;
> variables:
> double time(time) ;
> time:bounds = "time_bnds" ;
> time:units = "days since 0000-01-01 00:00:00" ;
> time:calendar = "noleap" ;
> time:axis = "T" ;
> time:long_name = "time" ;
> time:standard_name = "time" ;
> double time_bnds(time, bnds) ;
> int j(j) ;
> j:units = "1" ;
> j:long_name = "cell index along second dimension" ;
> int i(i) ;
> i:units = "1" ;
> i:long_name = "cell index along first dimension" ;
> float lat(j, i) ;
> lat:standard_name = "latitude" ;
> lat:long_name = "latitude coordinate" ;
> lat:units = "degrees_north" ;
> lat:bounds = "lat_vertices" ;
> float lon(j, i) ;
> lon:standard_name = "longitude" ;
> lon:long_name = "longitude coordinate" ;
> lon:units = "degrees_east" ;
> lon:bounds = "lon_vertices" ;
>
> I have seen your reply to someone's same problem. But in my script I need to choose one certain area. For example I use this function evecv = eofunc(sst_CW({lat|20.:70.},{lon|110.:260.},time|:),1,False). So I want the regular lon and lat. Do u know how to solve this. Attached is my script about how to calculate the PDO. Thanks!
>
> Best,
> Ke Deng
> <new file (copy)>_______________________________________________
> 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 Tue Feb 5 16:33:17 2013

This archive was generated by hypermail 2.1.8 : Wed Feb 06 2013 - 16:37:00 MST