<div dir="ltr"><div>Hi,</div><div><br></div><div>As far as I can tell from visual inspection of the program logic and printing values from the constructed arrays, this looks to be correct. Are you seeing something that makes you doubt it? I'm suspect about the need to make 2D coordinate arrays, as, i) the grid is clearly rectilinear, and ii) the docs for gsn_coordinates state it will take either 2D or 1D values:</div><div><br></div><div> <a href="http://ncl.ucar.edu/Document/Graphics/Interfaces/gsn_coordinates.shtml">http://ncl.ucar.edu/Document/Graphics/Interfaces/gsn_coordinates.shtml</a></div><div><br></div><div>Hope that helps...</div><div>Rick<br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Jun 3, 2019 at 5:24 PM Vanúcia Schumacher <<a href="mailto:vanucia-schumacher@hotmail.com">vanucia-schumacher@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr">
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
Hi users,</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
Could anyone check if I am reading and associating correctly the lat and lon coordinates of this raster file <span style="font-family:Calibri,Helvetica,sans-serif;background-color:rgb(255,255,255);display:inline">(attachment)</span> with
NCL?<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
Thanks</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
Part of the script:</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Helvetica,sans-serif;font-size:14pt;color:rgb(0,0,0)">
<span> files = systemfunc("ls test.asc")</span>
<div> hdr = readAsciiHead(files, 6)<br>
</div>
<div> ncols = stringtoint ( str_get_field(hdr(0), 2, " ") )<br>
</div>
<div> nrows = stringtoint ( str_get_field(hdr(1), 2, " ") )<br>
</div>
<div> lonLL = stringtofloat( str_get_field(hdr(2), 2, " ") )<br>
</div>
<div> latLL = stringtofloat( str_get_field(hdr(3), 2, " ") )<br>
</div>
<div> deltaLon = stringtofloat( str_get_field(hdr(4), 2, " ") )<br>
</div>
<div> deltaLat = stringtofloat( str_get_field(hdr(4), 2, " ") )<br>
</div>
<div>missingVal = stringtofloat( str_get_field(hdr(5), 2, " ") )<br>
</div>
<div><br>
</div>
<div>data = readAsciiTable(files,ncols,"float",6) <br>
</div>
<div> data@_FillValue = missingVal<br>
</div>
<div><br>
</div>
<div>;----- construct 1D coordinates....<br>
</div>
<div>lons = ispan(0,ncols-1,1) * deltaLon + lonLL<br>
</div>
<div>lats = ispan(0,nrows-1,1) * deltaLat + latLL<br>
</div>
<div>lats = lats(::-1)<br>
</div>
<div><br>
</div>
<div>;---- gsn_coordinates wants 2D coordinate arrays<br>
</div>
<div>data@lon2d = conform_dims((/ nrows, ncols/), lons, 1)<br>
</div>
<div>data@lat2d = conform_dims((/ nrows, ncols/), lats, 0)<br>
</div>
<div><br>
</div>
<div> data!0 = "lat"<br>
</div>
<div> data&lat = lats <br>
</div>
<div> data&lat@units = "degrees-north"<br>
</div>
<div> data!1 = "lon"<br>
</div>
<div> data&lon = lons<br>
</div>
<div> data&lon@units = "degrees-east"<br>
</div>
<div><br>
</div>
<div>;---- Open shapefile and read lat/lon values.</div>
<div> ...</div>
<div> data_mask = shapefile_mask_data(data,shp_filename,True)<br>
</div>
<div> copy_VarMeta(data, data_mask)<br>
</div>
<div> data_point := (/data_mask({-34.64},{-70.32})/) <br>
</div>
<div>...</div>
</div>
</div>
_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
</blockquote></div>