[ncl-talk] lat-lon to ij for NARR
Mary Haley
haley at ucar.edu
Thu Mar 17 08:52:45 MDT 2016
Ashish,
>From your script, I'm not sure how you are determining the values are
wrong, as I didn't see that you were actually printing any lat/lon values.
Did you try doing any debugging of your code to see where the problem was?
It first helps to verify that the min/max lat/lon values you are inputting
to getind_latlon2d are close in the range of your 2D lat/lon arrays.
A simple "printMinMax" will give you that information:
printMinMax(lat2d_narr,0)
printMinMax(lon2d_narr,0)
If this looks good then print "nm" to make sure these values look okay:
print("lat2d_narr dims = " + dimsizes(lat2d_narr))
print("nm = " + nm) ; To make sure nm values are not out-of-range of
your 2D lat/lon array
If the above looks okay then try:
iStrt = nm(0,0)
jStrt = nm(0,1)
iLast = nm(1,0)
jLast = nm(1,1)
lat_strt = lat2d_narr(iStrt,jStrt)
lat_last = lat2d_narr(iLast,jLast)
lon_strt = lon2d_narr(iStrt,jStrt)
lon_last = lon2d_narr(iLast,jLast)
print("lat/lon start = " + lat_strt + "/" + lon_strt)
print("lat/lon last = " + lat_last + "/" + lon_last)
Hopefully the above code will help you locate the source of the error.
--Mary
On Wed, Mar 16, 2016 at 1:12 PM, Ashish Sharma <asharma7 at nd.edu> wrote:
> Hello,
>
> I am trying to find corresponding ij for lat-lon pair from NARR data using
> *getind_latlon2d* command, but the values are wrong.
>
> Please advise.
>
> thanks,
> Ashish
>
> minlat = 37.37814
>
> maxlat = 46.64286
>
> minlon = -98.91251
>
> maxlon = -73.89026
>
>
> ;=================================================;
>
> f3 = addfile("land.nc","r")
>
> lat2d_narr = f3->lat ; (277,349)
>
> lon2d_narr = f3->lon
>
>
> printMinMax(lat2d_narr, 0)
>
> printMinMax(lon2d_narr, 0)
>
>
> lat = (/ minlat,maxlat /) ; user specified coordinate pairs
>
> lon = (/minlon,maxlon /)
>
>
> nm = *getind_latlon2d* (lat2d_narr,lon2d_narr, lat, lon)
>
> print(nm)
>
> iStrt = nm(0,0)
>
> jStrt = nm(0,1)
>
> iLast = nm(1,0)
>
> jLast = nm(1,1)
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> 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/20160317/444d5b0c/attachment.html
More information about the ncl-talk
mailing list