<div dir="ltr"><div>Using getind_latlon2d should have failed. The 1st two arguments are prototyped as 2-dimensional. You are inputting one-dimensional arrays.<br><br><pre>        function getind_latlon2d (
                lat2d [*][*] : numeric, <=== you are inputting lat[*]
                lon2d [*][*] : numeric, <=== lon[*]
                lat [*] : numeric,
                lon [*] : numeric
        )
</pre>==========<br></div>Let NCL do it<br><br>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br><br> diri = "/Users/shea/Downloads/"<br> fili = "cVeg_CanESM2_1time.nc"<br> pthi = diri+fili<br> fi = addfile(pthi, "r")<br> ;print(fi)<br><br> latpt = (/ 42.5, 25.4, 35.0 /)<br> lonpt = (/-72.2,-81.1,-84.3 /)<br> lonpt = where(lonpt.lt.0, lonpt+360, lonpt)<br> npt = dimsizes(latpt)<br><br> cVegpt= new ( npt, getfilevartypes(fi, "cVeg"), 1e20)<br><br> do np=0,npt-1<br> cVegpt(np) = fi->cVeg({latpt(np)},{lonpt(np)})<br> end do<br> print(cVegpt)<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 16, 2014 at 1:29 PM, Jiaxin Zhang <span dir="ltr"><<a href="mailto:jiaxinzhang3@gmail.com" target="_blank">jiaxinzhang3@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear NCL users,<div><br></div><div>I am trying to follow the example provided for getind_latlon2d in:</div><div><br></div><div><a href="http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml" target="_blank">http://www.ncl.ucar.edu/Document/Functions/Contributed/getind_latlon2d.shtml</a><br></div><div><br></div><div>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? </div><div><br></div><div>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. </div><div><br></div><div>Your help is very appreciated.</div><div>Thank you!</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Jiaxin</div><div> </div></font></span></div>
<br>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>