[ncl-talk] getind_latlon2d with rectilinear grid

Dennis Shea shea at ucar.edu
Wed Sep 17 06:57:51 MDT 2014


Using getind_latlon2d should have failed. The 1st two arguments are
prototyped as 2-dimensional. You are inputting one-dimensional arrays.

	function getind_latlon2d (
		lat2d [*][*] : numeric,     <=== you are inputting lat[*]
		lon2d [*][*] : numeric,     <===                   lon[*]
		lat      [*] : numeric,
		lon      [*] : numeric
	)

==========
Let NCL do it

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

    diri = "/Users/shea/Downloads/"
    fili = "cVeg_CanESM2_1time.nc"
    pthi = diri+fili
    fi   = addfile(pthi,  "r")
   ;print(fi)

    latpt = (/ 42.5, 25.4, 35.0 /)
    lonpt = (/-72.2,-81.1,-84.3 /)
    lonpt = where(lonpt.lt.0, lonpt+360, lonpt)
    npt   = dimsizes(latpt)

    cVegpt= new ( npt, getfilevartypes(fi, "cVeg"), 1e20)

    do np=0,npt-1
       cVegpt(np) = fi->cVeg({latpt(np)},{lonpt(np)})
    end do
    print(cVegpt)


On Tue, Sep 16, 2014 at 1:29 PM, Jiaxin Zhang <jiaxinzhang3 at gmail.com>
wrote:

> Dear NCL users,
>
> I am trying to follow the example provided for getind_latlon2d in:
>
>
> http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml
>
> My data is in a rectilinear grid that can be completely described by one
> dimensional lat and lon arrays, whereas getind_latlon2d requires 2d arrays
> for lat and lon. How can I solve this problem? Is it better to use a
> different function from getind_latlon2d for 1d lat and lon arrays?
>
> I am attaching my NCL script and my file. I have 3 different sites (with
> given coordinates in attached script), that I would need to locate in the
> data grid. After that I would need to extract the value in that particular
> location (extract only the value of the 3 grids that contain the 3 sites).
> I was using getind_latlon2d to locate the 3 points in the data grid, but
> maybe there is better option to do that for rectilinear grids.
>
> Your help is very appreciated.
> Thank you!
>
> Jiaxin
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140917/458a9412/attachment.html 


More information about the ncl-talk mailing list