[ncl-talk] Interpolation of wind station data

Stavros Dafis sdafis at cc.uoi.gr
Wed Apr 27 04:33:37 MDT 2016


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) ---------------
rad    = 4.*atan(1.0)/180.    ; degress to radians

uo = -(abs(z))*sin(WDIR*rad)
vo = -(abs(z))*cos(WDIR*rad)

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: noa_winddir.prob2.png
Type: image/png
Size: 197064 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20160427/6d005bcd/attachment.png 


More information about the ncl-talk mailing list