Matthew H. Savoie wrote:
>
> Hi,
>
> I'm sure this has been done before, so as to not re-invent the wheel...has
> anyone out there written a wind barb plotting routine for IDL? Would you be
> interested in sharing the source?
>
> Thanks in advance.
>
> MHS
Matt, here's what we use:
;----------------------------------------------------------- ------------
pro windbarb,x,y,spd,dir,len,aspect,prot
;
; procedure to plot staffs with 10 kt speed barbs
; x = x coordinate (0-1)
; y = y coordinate (0-1)
; spd = wind speed (kts)
; dir = wind direction (deg cw from north)
; len = length of staff (in normalized x coordinate)
; aspect = aspect ratio of plot window (ysize/xsize)
; prot = cw rotation of wind direction due to map projection (radians)
;
; from subroutine pg_barbs by M. Peroutka, NWS CLE
; du is size of station symbol
; du=0.1*len ; use this if cloud indicator is plotted at station
du=0 ; use this for gridded winds
s=len-du
b=s*0.5
a=s*0.3
if(spd lt 2.5) then begin
s=0.1*len
t=s/aspect
plots,[x-s,x+s,x+s,x-s,x-s],[y+t,y+t,y-t,y-t,y+t],/norm
return
end
dr=dir*!dtor+prot
dr1=(dir+60)*!dtor+prot
sind=sin(dr)
sind1=sin(dr1)
cosd=cos(dr)
cosd1=cos(dr1)
n50=0
n10=0
sp=spd+2.5
while(sp ge 50) do begin
n50=n50+1
sp=sp-50
end
while(sp ge 10) do begin
n10=n10+1
sp=sp-10
end
; draw staff
x1=x+sind*du
y1=y+cosd*du/aspect
x2=x1+sind*s
y2=y1+cosd*s/aspect
plots,[x1,x2],[y1,y2],/norm
; plot half barb
if(sp ge 5) then begin
x1=x2+sind1*a
y1=y2+cosd1*a/aspect
plots,[x1,x2],[y1,y2],/norm
if(n50 eq 0 and n10 eq 0) then begin
x1=x2+sind*a
y1=y2+cosd*a/aspect
plots,[x1,x2],[y1,y2],/norm
end
end
x1=x2
y1=y2
; plot barbs
for i=1,n10 do begin
x2=x1+sind*a
y2=y1+cosd*a/aspect
x3=x2+sind1*b
y3=y2+cosd1*b/aspect
plots,[x1,x2,x3],[y1,y2,y3],/norm
x1=x2
y1=y2
end
; plot flags
for i=1,n50 do begin
x2=x1+sind*a
y2=y1+cosd*a/aspect
x3=x2+sind1*b
y3=y2+cosd1*b/aspect
plots,[x1,x2,x3],[y1,y2,y3],/norm
x1=x2
y1=y2
end
return
end
------------------------------------------------------------ ----------
Dr. David J. Schwab
NOAA Great Lakes Environmental Research Laboratory
2205 Commonwealth Blvd.
Ann Arbor, MI 48105
313-741-2120 schwab@glerl.noaa.gov
|