<div dir="ltr"><div><div><div><div><div>Hi Stavros,<br><br></div>I don't see where the array zo returned from dsgrid2() has any coordinate information (?)<br><br></div>I'm not expert at this, but if I correctly understand what'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 = "xo"<br></div>yo!0 = "yo"<br><br></div>; associate coord vars to data variable<br><div><div><div>zo!0 = "xo"<br></div><div>zo!1 = "yo"<br></div><div>zo&xo = xo<br></div><div>zo&yo = yo<br><br></div><div>and then of course, to reorder for plotting you'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">On Mon, May 22, 2017 at 6:07 AM, Stavros Dafis <span dir="ltr"><<a href="mailto:sdafis@cc.uoi.gr" target="_blank">sdafis@cc.uoi.gr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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 "dsgrid2".<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 = "i" ; Name the dimensions of "zo".<br>
zo!1 = "j"<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 = "0.1deg"<br>
Opt@ForceOverwrite = True<br>
Opt@Debug = True<br>
Opt@InterpMethod = "patch"<br>
;zo = ESMF_regrid(z,Opt)<br>
<br>
<br>
Any help would be appreciated.<br>
<span class="HOEnZb"><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">(+33)9 81 94 22 12</a><br>
Mobile: <a href="tel:%28%2B33%29%20066%20030%200147" value="+33660300147">(+33) 066 030 0147</a><br>
<a href="tel:%28%2B30%29%20697%2004%2020%20242" value="+306970420242">(+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>______________________________<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>