<div dir="ltr"><div class="gmail_default" style="font-size:small">Hi all,</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default" style="font-size:small">The issue is that natgrid and dsgrid2 return the array as XO x YO, which corresponds to LON x LAT.  This is very confusing!</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">If you transpose the array, then the coordinate array assignments should work without reversing the axes:</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">zo_natgrid = transpose(natgrid(x, y, z, xo, yo))  ; Interpolate                                                    </font></div><div class="gmail_default"><font face="monospace, monospace">zo_natgrid!0  = &quot;yo&quot;</font></div><div class="gmail_default"><font face="monospace, monospace">zo_natgrid!1  = &quot;xo&quot;</font></div><div class="gmail_default"><font face="monospace, monospace">zo_natgrid&amp;yo =  yo</font></div><div class="gmail_default"><font face="monospace, monospace">zo_natgrid&amp;xo =  xo</font></div><div class="gmail_default"><br></div><div class="gmail_default">and</div><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace">zo_dsg2 = transpose(dsgrid2(x, y, z, xo, yo))</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">zo_dsg2!0  = &quot;yo&quot;</font></div><div class="gmail_default"><font face="monospace, monospace">zo_dsg2!1  = &quot;xo&quot;</font></div><div class="gmail_default"><font face="monospace, monospace">zo_dsg2&amp;yo =  yo</font></div><div class="gmail_default"><font face="monospace, monospace">zo_dsg2&amp;xo =  xo</font></div><div class="gmail_default"><br></div><div class="gmail_default">--Mary</div><div class="gmail_default"><br></div></div></div><div class="gmail_default" style="font-size:small"><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 1, 2017 at 2:24 PM, Dennis Shea <span dir="ltr">&lt;<a href="mailto:shea@ucar.edu" target="_blank">shea@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Ricks approach should work. However, for some unuknown rease (?bug?) the coordinates had to be reversed to attain the correct plot. A JIRA-2621 (bug) ticket has been created.<br><br></div>The attached uses x11 and creates the gridded data via several methods. Of course, these could be tuned for better results but I&#39;ll let that up to you.<br><br></div><div>%&gt; ncl noa_test.ncl_stavros<br></div><div><br></div>Good luck<br></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, May 22, 2017 at 11:15 AM, Rick Brownrigg <span dir="ltr">&lt;<a href="mailto:brownrig@ucar.edu" target="_blank">brownrig@ucar.edu</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi Stavros,<br><br></div>I don&#39;t see where the array zo returned from dsgrid2() has any coordinate information (?)<br><br></div>I&#39;m not expert at this, but if I correctly understand what&#39;s going on, I think you need to do something like:<br><br></div><div>; make coordinate variables; i.e, varname == dimension name<br></div>xo!0 = &quot;xo&quot;<br></div>yo!0 = &quot;yo&quot;<br><br></div>; associate coord vars to data variable<br><div><div><div>zo!0 = &quot;xo&quot;<br></div><div>zo!1 = &quot;yo&quot;<br></div><div>zo&amp;xo = xo<br></div><div>zo&amp;yo = yo<br><br></div><div>and then of course, to reorder for plotting you&#39;d write  zo(yo|:, xo|:)<br><br></div><div>I hope that helps.<br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote"><span>On Mon, May 22, 2017 at 6:07 AM, Stavros Dafis <span dir="ltr">&lt;<a href="mailto:sdafis@cc.uoi.gr" target="_blank">sdafis@cc.uoi.gr</a>&gt;</span> wrote:<br></span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="m_3797509102975225829h5">Dear NCL users,<br>
<br>
I am facing a problem when interpolating unstructured station data. I read an<br>
ascii file with lat/lon and rainfall data. The problem is that the interpolated<br>
values with dsgrid2 do not match with the real data, for example in the map<br>
attached 69mm of rainfall (North Greece) is printed on the map but the shaded<br>
rainfall is far away from the actual position of the station. Moreover, near<br>
Athens, we have some stations with up to 20mm of accumulated rainfall but<br>
interpolation gives 0-5mm.<br>
<br>
I have to mention that with temperature data, from the same ascii, using the<br>
same method with dsgrid2, the result is almost flawless (attached png with<br>
Attica).<br>
<br>
I have also tried ESMF method (attached), obj_anal_ic, triple2grid, natgrid but<br>
the problem is the same. Here is the part of the code doing calculations:<br>
<br>
<br>
x = stations(:,2)  ; Column 3 of file contains LONGITUDE values.<br>
y = stations(:,1)  ; Column 2 of file contains LATITUDE values.<br>
z = stations(:,15)  ; Column 11 of file contains RAINFALL values.<br>
<br>
<br>
  numxout = 100  ; Define output grid for call to &quot;dsgrid2&quot;.<br>
  numyout = 100<br>
  xmin    = min(x)<br>
  ymin    = min(y)<br>
  xmax    = max(x)<br>
  ymax    = max(y)<br>
  zmin    = min(z)<br>
  zmax    = max(z)<br>
<br>
  xc      = (xmax-xmin)/(numxout-1)<br>
  yc      = (ymax-ymin)/(numyout-1)<br>
  xo      = xmin + ispan(0,numxout-1,1)*xc<br>
  yo      = ymin + ispan(0,numyout-1,1)*yc<br>
<br>
  ;zo = natgrid(x, y, z, xo, yo)  ; Interpolate.<br>
  ;zo = natgrids(x, y, z, xo, yo) ; Interpolate.<br>
   rscan = (/0.25, 0.1, 0.01/)<br>
  ;zo = obj_anal_ic(x,y,z, xo,yo, rscan, False)<br>
opt  = True<br>
opt@distmx = 30      ; kilometers<br>
;zo = triple2grid(x, y, z, xo, yo, opt)<br>
<br>
<br>
zo = dsgrid2(x, y, z, xo, yo)  ; Interpolate.<br>
<br>
zo!0 = &quot;i&quot;  ; Name the dimensions of &quot;zo&quot;.<br>
zo!1 = &quot;j&quot;<br>
<br>
<br>
contour = gsn_csm_contour_map(wks,zo(j|:<wbr>,i|:),res)<br>
<br>
<br>
;--------<br>
;ESMF<br>
  Opt                 = True<br>
  Opt@SrcGridLat      = y<br>
  Opt@SrcGridLon      = x<br>
  Opt@DstLLCorner     = (/floor(min(y)),floor(min(x))/<wbr>)<br>
  Opt@DstURCorner     = (/ ceil(max(y)), ceil(max(x))/)<br>
  Opt@DstGridType     = &quot;0.1deg&quot;<br>
  Opt@ForceOverwrite  = True<br>
  Opt@Debug           = True<br>
  Opt@InterpMethod    = &quot;patch&quot;<br>
  ;zo = ESMF_regrid(z,Opt)<br>
<br>
<br>
Any help would be appreciated.<br>
<span class="m_3797509102975225829m_-6429159146205618730HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
Stavros NTAFIS (DAFIS)<br>
------------------------------<wbr>-----------------<br>
Physicist - Meteorologist, M.Sc.<br>
Research Associate, National Observatory of Athens<br>
Tel. : <a href="tel:%28%2B33%299%2081%2094%2022%2012" value="+33981942212" target="_blank">(+33)9 81 94 22 12</a><br>
Mobile: <a href="tel:%28%2B33%29%20066%20030%200147" value="+33660300147" target="_blank">(+33) 066 030 0147</a><br>
<a href="tel:%28%2B30%29%20697%2004%2020%20242" value="+306970420242" target="_blank">(+30) 697 04 20 242</a><br>
---------------<br>
Weather charts:<br>
<a href="http://www.meteo.gr" rel="noreferrer" target="_blank">http://www.meteo.gr</a><br>
<a href="http://www.meteo.gr/meteomaps/" rel="noreferrer" target="_blank">http://www.meteo.gr/meteomaps/</a><br>
<br>
<br>
<br>
</font></span><br></div></div><span>______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></span></blockquote></div><br></div>
<br>______________________________<wbr>_________________<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/mailma<wbr>n/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">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/<wbr>mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>