# Re: About the 2-dimensiontal lon and lat

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 06 2013 - 08:45:16 MST

Yes, sorry, that was a typo on my part. If you read the documentation for getind_latlon2d:

The first dimension represents the number of points you passed to getind_latlon2d, and the second dimension, which is always 2, represents the lat,lon index.

So, nm(:,0) always refers to lat indexes, and nm(:,1) refers to lon indexes.

The subsetting should be done just as you suggested:

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

--Mary

On Feb 5, 2013, at 9:32 PM, Ke Deng wrote:

> Hi, mary
>
> I have a question abou this step sst_CW(lat | nm(0,0):nm(0,1), lon | nm(1,0):nm(1,1), time | :). Whether this should be sst_CW(lat | nm(0,0):nm(1,0), lon | nm(0,1):nm(1,1), time | :) ? Thanks!
>
> Best,
> DK
>
>
>
> On Tue, Feb 5, 2013 at 5:33 PM, Mary Haley <haley@ucar.edu> wrote:
> 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
>
> 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

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Feb 6 08:45:25 2013

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