<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body 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 !important">(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>
</body>
</html>