I've noticed some strange results using the ind() and ind_resolve() functions, that I can't explain. I'm using the functions to find all indices on the POP ocean grid within a certain domain, viz:
> f = addfile(filename,"r") ;file could be any CCSM4 or CESM ocean data
;read lat/lon coords
>lat = f->lat
>lon = f->lon
;convert to 1d arrays
>lat1d = ndtooned(lat)
>lon1d = ndtooned(lon)
;find all coords in a band across the mid-lat N. Atlantic
>ii = ind(lon1d.ge.270..and.lon1d.le.360..and.lat1d.gt.39.5.and.lat1d.lt.40.5)
>jj = ind_resolve(ii, dimsizes(lat)) ; find array elements on the 2-d grid
>printMinMax(lon(jj(:,0),jj(:,1)), True) ;returns range of 270.296 to 359.746 ; so far so good
>printMinMax(lat(jj(:,0),jj(:,1)), True)
;returns range of 38.0728 to 41.8587, which is outside the initial query of 39.5 to 40.5
Any thoughts?
Will
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Thu Feb 27 20:35:07 2014
This archive was generated by hypermail 2.1.8 : Mon Mar 03 2014 - 14:26:18 MST