[ncl-talk] Interpolation of wind station data

Dennis Shea shea at ucar.edu
Wed Apr 27 16:15:59 MDT 2016

```Hello

[1]
Generally, do not interpolate wind speed and direction directly. One issue
... think
combining winds from 355 and 5 ... :-)

[2]
Technically, on the sphere you should not interpolate u and v separately.
There is a rotation angle (rot) that must be used

uNew =  u*cos(rot) + v*sin(rot)
vNew = -u*sin(rot) + v*cos(rot)

==
[3]

The most common method on the sphere is to calculate the
scalar quantities: divergence and relative vorticity;
interpolate the scalar quantities to the new grid;
back-out the rotational and divergent wind components
on the new grid.

uNew = uRot+uDiv
vNew = vRot+vDiv

==

[1-3] said ... I think you can ignore the above. :-)

Greece is not large so the earth's curvature can be ignored.

[a]  derive the wind components

[b]  interpolate the u and v independently

[c] rederive the wind speeds and directions.

I have not used dgrid2 or natgrid so I have no recommendation.

====

NOTE: The ESMF regrid may also be used.

https://www.ncl.ucar.edu/Applications/ESMF.shtml

ESMF_regrid_21.ncl
<https://www.ncl.ucar.edu/Applications/Scripts/ESMF_regrid_21.ncl>

Or, if you have a lot of stations, use ESMF's nearest neighbor

ESMF_regrid_31.ncl

The latter uses a grid as input but (I think) you can use the

location of the stations.

Good Luck

On Wed, Apr 27, 2016 at 4:33 AM, Stavros Dafis <sdafis at cc.uoi.gr> wrote:

> Dear users,
>
> I would like your help concerning the interpolation of u,v components
> derived by
> weather stations in Greece. I have found only one message from Mr Wang
> back in
> 2008, who faced the same problem, but as far as I know, it was not solved.
> I
> tried to find Mr Wang though, but with no response to the e-mail provided
> in
> the message:
> https://www.ncl.ucar.edu/Support/talk_archives/2008/0497.html
>
> The stations record wind speed and direction in degrees. I first derive
> the u,v
> components and interpolate them using the dsgrid2 method (I have also tried
> with natgrid). Do I have to make explicit calculations for u>0, v<0 etc?
> Mathematically speaking, I think the code is correct, but please make your
> suggestions, because if I change the wind speed somewhere (for example in
> West
> Greece) the vectors are always the same in North Greece (Macedonia) and in
> SW
> parts.
> Part of my code is shown below and the plot derived is attached:
>
>
>   x = stations(:,2)  ; Column 3 of file contains LONGITUDE values.
>   y = stations(:,1)  ; Column 2 of file contains LATITUDE values.
> WDIR1 = stations(:,15)  ; Column 15 of file contains WIND DIRECTION values.
>   z = stations(:,12)  ; Column 13 of file contains WIND SPEED values.
>
> ;WDIR = 270 - WDIR1
>
> y!0 = "lat"
> x!0 = "lon"
>
>   numxout = 200   ; nflds
>   numyout = 200   ; nflds
>   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
>
> yo!0 = "lat"
> xo!0 = "lon"
>
>   ;zo = natgrid(x, y, z, xo, yo)  ; Interpolate.
>   ;zo = natgrids(x, y, z, xo, yo) ; Interpolate.
>   ;zo = dspnt2(x, y, z, xo, yo)  ; Interpolate.
>
>   zo = dsgrid2(x, y, z, xo, yo)  ; Interpolate.
>
>   diro = dsgrid2(x, y, WDIR, xo, yo)  ; Interpolate.
>
> diro!0 = "lon"
> diro!1 = "lat"
> diro&lat = yo
> diro&lon = xo
> ;------- (operational) ---------------
>
>
> u1 = dsgrid2(x, y, uo, xo, yo)  ; Interpolate.
> v1 = dsgrid2(x, y, vo, xo, yo)  ; Interpolate.
>
> u1!0 = "lon"
> u1!1 = "lat"
> u1&lat = yo
> u1&lon = xo
>
> v1!0 = "lon"
> v1!1 = "lat"
> v1&lat = yo
> v1&lon = xo
>
> ;----------------------------------------------------------------------------
>
> nlat = dimsizes(yo)
> nlon = dimsizes(xo)
>
> u = generate_2d_array(-50,50,min(u1),max(u1),50,(/nlat,nlon/))
> u!0 = "lon"
> u&lon = yo
> u!1 = "lat"
> u&lat = xo
>
> v = generate_2d_array(-50,50,min(v1),max(v1),50,(/nlat,nlon/))
>
> v!0 = "lon"
> v&lon = yo
> v!1 = "lat"
> v&lat = xo
>
> ;------------------------------------------------------
>   xo at long_name = "Lon"   ; Define some attributes.
>   yo at long_name = "Lat"
>   zo at long_name = "10-min Wind speed(km/h)"
>
>
> --
> Stavros Dafis
> MSc student Atmospheric Sciences and Environment
> University of Ioannina
> LATMOS Laboratoire Atmospheres, Milieux,Observations Spatiales; Versailles,
> France.
> Tel: +33 0981942212,  Mobile: +30 6970420242
> e-mails: sdafis at noa.gr or dafis91 at yahoo.gr
> Weather charts: http://www.metar.gr
> http://www.meteo.gr
> http://www.meteovolos.gr
>
>
> _______________________________________________
> 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/20160427/d3c3c620/attachment.html
```