[ncl-talk] dsgrid interpolation problem station data)
Rick Brownrigg
brownrig at ucar.edu
Mon May 22 11:15:29 MDT 2017
Hi Stavros,
I don't see where the array zo returned from dsgrid2() has any coordinate
information (?)
I'm not expert at this, but if I correctly understand what's going on, I
think you need to do something like:
; make coordinate variables; i.e, varname == dimension name
xo!0 = "xo"
yo!0 = "yo"
; associate coord vars to data variable
zo!0 = "xo"
zo!1 = "yo"
zo&xo = xo
zo&yo = yo
and then of course, to reorder for plotting you'd write zo(yo|:, xo|:)
I hope that helps.
On Mon, May 22, 2017 at 6:07 AM, Stavros Dafis <sdafis at cc.uoi.gr> wrote:
> 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/
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20170522/4d5d00f4/attachment.html
More information about the ncl-talk
mailing list