# [ncl-talk] dsgrid interpolation problem station data)

Stavros Dafis sdafis at cc.uoi.gr
Mon May 22 06:07:18 MDT 2017

```Dear NCL users,

I am facing a problem when interpolating unstructured station data. I read an
ascii file with lat/lon and rainfall data. The problem is that the interpolated
values with dsgrid2 do not match with the real data, for example in the map
attached 69mm of rainfall (North Greece) is printed on the map but the shaded
rainfall is far away from the actual position of the station. Moreover, near
Athens, we have some stations with up to 20mm of accumulated rainfall but
interpolation gives 0-5mm.

I have to mention that with temperature data, from the same ascii, using the
same method with dsgrid2, the result is almost flawless (attached png with
Attica).

I have also tried ESMF method (attached), obj_anal_ic, triple2grid, natgrid but
the problem is the same. Here is the part of the code doing calculations:

x = stations(:,2)  ; Column 3 of file contains LONGITUDE values.
y = stations(:,1)  ; Column 2 of file contains LATITUDE values.
z = stations(:,15)  ; Column 11 of file contains RAINFALL values.

numxout = 100  ; Define output grid for call to "dsgrid2".
numyout = 100
xmin    = min(x)
ymin    = min(y)
xmax    = max(x)
ymax    = max(y)
zmin    = min(z)
zmax    = max(z)

xc      = (xmax-xmin)/(numxout-1)
yc      = (ymax-ymin)/(numyout-1)
xo      = xmin + ispan(0,numxout-1,1)*xc
yo      = ymin + ispan(0,numyout-1,1)*yc

;zo = natgrid(x, y, z, xo, yo)  ; Interpolate.
;zo = natgrids(x, y, z, xo, yo) ; Interpolate.
rscan = (/0.25, 0.1, 0.01/)
;zo = obj_anal_ic(x,y,z, xo,yo, rscan, False)
opt  = True
opt at distmx = 30      ; kilometers
;zo = triple2grid(x, y, z, xo, yo, opt)

zo = dsgrid2(x, y, z, xo, yo)  ; Interpolate.

zo!0 = "i"  ; Name the dimensions of "zo".
zo!1 = "j"

contour = gsn_csm_contour_map(wks,zo(j|:,i|:),res)

;--------
;ESMF
Opt                 = True
Opt at SrcGridLat      = y
Opt at SrcGridLon      = x
Opt at DstLLCorner     = (/floor(min(y)),floor(min(x))/)
Opt at DstURCorner     = (/ ceil(max(y)), ceil(max(x))/)
Opt at DstGridType     = "0.1deg"
Opt at ForceOverwrite  = True
Opt at Debug           = True
Opt at InterpMethod    = "patch"
;zo = ESMF_regrid(z,Opt)

Any help would be appreciated.

--
Stavros NTAFIS (DAFIS)
-----------------------------------------------
Physicist - Meteorologist, M.Sc.
Research Associate, National Observatory of Athens
Tel. : (+33)9 81 94 22 12
Mobile: (+33) 066 030 0147
(+30) 697 04 20 242
---------------
Weather charts:
http://www.meteo.gr
http://www.meteo.gr/meteomaps/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: noa_dayrain_test.png
Type: image/png
Size: 283108 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170522/92e5c8ca/attachment-0003.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: noa_dayrain_ESMF.png
Type: image/png
Size: 254579 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170522/92e5c8ca/attachment-0004.png
-------------- next part --------------
A non-text attachment was scrubbed...
Name: noa_Attica_temp14.png
Type: image/png
Size: 268493 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170522/92e5c8ca/attachment-0005.png
```