<div dir="ltr"><div><div>Hi John,<br><br></div>I think your latitude dimension might indeed be flipped. The header gives the lon/lat for the lower-left corner, but the first row in the file -- which will be the zero-ith row in NCL -- is the northern-most row of the raster:<br>
<br><a href="http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=ESRI%20ASCII%20Raster%20format">http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=ESRI%20ASCII%20Raster%20format</a><br><br></div>Hope that helps...<br>
Rick<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Aug 12, 2014 at 5:31 PM, john koudelka <span dir="ltr"><<a href="mailto:john.koudelka@gmail.com" target="_blank">john.koudelka@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I need help sorting out reading in an ArcGIS ascii raster file. The<br>
values I pull for lat/lon locations don't match up with the values I<br>
am showing in ArcGIS.<br>
<br>
The result of line 8 below should be 22.47, which is the value I get<br>
in ArcGIS for this Lat/Lon. It's not a matter of a slight shift due to<br>
the center of the pixel, since the values surrounding 22.47 range from<br>
21-23. I'm thinking that something's flipped in the way the ascii file<br>
is read. Can someone shed some light on this for me? Hopefully this is<br>
an easy answer that I'm missing. I wasn't able to figure this out<br>
searching the ncl-talk archives or reading the reference manual.<br>
Apologies if I did miss something glaring there.<br>
<br>
<br>
Here is the header of the ascii file:<br>
ncols 481<br>
nrows 481<br>
xllcorner -114.004167<br>
yllcorner 38.995833<br>
cellsize 0.008333<br>
<br>
Here is my code:<br>
<br>
ncl 0> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"<br>
ncl 1> tempgrid=readAsciiTable("otgrid_20091001120000.asc",481,"float",5)<br>
ncl 2> tempgrid!0="lat"<br>
ncl 3> tempgrid!1="lon"<br>
ncl 4> endLat=38.995833+(0.008333*481)<br>
ncl 5> endLon=-114.004167+(0.008333*481)<br>
ncl 6> lat=fspan(38.995833,endLat,481)<br>
ncl 7> lon=fspan(-114.004167,endLon,481)<br>
ncl 8> tempgrid&lat=lat<br>
ncl 9> tempgrid&lon=lon<br>
ncl 10> print(tempgrid({41.713438},{-111.71767}))<br>
<br>
Variable: tempgrid (subsection)<br>
Type: float<br>
Total Size: 4 bytes<br>
1 values<br>
Number of Dimensions: 1<br>
Dimensions and sizes: [1]<br>
Coordinates:<br>
Number Of Attributes: 3<br>
lon : -111.7162<br>
lat : 41.7097<br>
_FillValue : 9.96921e+36<br>
(0) 25.88<br>
ncl 11> print(lat(1)-lat(0))<br>
(0) 0.008350372<br>
ncl 12> print(lon(1)-lon(0))<br>
(0) 0.008346558<br>
ncl 13> print(41.713438-41.7097)<br>
(0) 0.003734589<br>
ncl 14> print(-111.7167-(-111.7162))<br>
(0) -0.0004959106<br>
ncl 15> print(tempgrid({41.704:41.722},{-111.726:-111.708}))<br>
<br>
Variable: tempgrid (subsection)<br>
Type: float<br>
Total Size: 16 bytes<br>
4 values<br>
Number of Dimensions: 2<br>
Dimensions and sizes: [lat | 2] x [lon | 2]<br>
Coordinates:<br>
lat: [41.7097..41.71805]<br>
lon: [-111.7245..-111.7162]<br>
Number Of Attributes: 1<br>
_FillValue : 9.96921e+36<br>
(0,0) 26.64<br>
(0,1) 25.88<br>
(1,0) 26.28<br>
(1,1) 25.98<br>
ncl 16><br>
<br>
<br>
Thanks,<br>
john<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>
</blockquote></div><br></div>