Article View: aus.stats.s
Article #16149Re: Wind Rose
From: chappell
Date: Tue, 21 Jan 1992 00:00
Date: Tue, 21 Jan 1992 00:00
97 lines
4410 bytes
4410 bytes
In article <9201201912.AA29195@statsci.com> statsci!gordana@uunet.UU.NET (Gordana Butorac) writes:
>One of our customers who does not have access to e-mail
>network asked us to send his question to S-news group.
>He is a meteorologist and is interested if someone has
>developed an S-PLUS function to create a WIND ROSE plot.
>
>Wind Rose is a diagram that shows the distribution of wind
>direction experienced at a given location over a considerable
>period, it thus shows the prevailing wind direction. The
>most common form is a polar type plot consisting of a circle
>from which 16 lines emanate, one for each compass point. The
>length of each line is proportional to the frequency of the
>wind from that direction, with the frequency of calm conditions
>entered in the center. Typically, the plot will also indicate
>the range of wind speeds from each direction.
>
>Please send me your name and number if you would like to help
>out, and I will forward it to the customer.
>Thanks for your support.
>
> Gordana Butorac
>Internet: support@statsci.com
>UUCP: uunet!statsci!support
>
This may be interesting to others, so I will post it. Xiaohua Zhou
wrote a circular histogram function last year which I modified
and "cleaned up" (for my purposes). Except for the range of wind
speeds and frequency of calms in the middle, it sounds like it could
do what you want. Suppose "directions" is a vector of directions
(in fractions, from 0 to 1). Then try
> cirhist(directions)
If there are 16 distinct directions,
> unique(directions)
[1] 0.0000 0.0625 0.1250 0.1875 0.2500 0.3125 0.3750 0.4375 0.5000 0.5625
[11] 0.6250 0.6875 0.7500 0.8125 0.8750 0.9375
then there will be 16 arrows.
It is still a little crude: it will only accomodate a maximum of
about 20 observtions per direction without looking cramped.
Good luck, Rick.
---------------
Rick Chappell <> Asst. Professor, Depts. of Statistics and Human Oncology
<> University of Wisconsin at Madison <> chappell@stat.wisc.edu
(608) 263-5572 / 262-2733 <> take logs
-------------------------------- cut here ----------------------------
#cirhist(angvec)
# This function was written in March, 1991, by Xiaohua Zhou.
# It produces circular histograms for data that are presented as
# fractions (0 to 1) and superimposes a clock face or dial with
# 0%, 25%, 50% and 75% indicated.
#
# Modified in October, 1991 by Rick Chappell. Some extra plotting bells and
# whistles.
cirhist <- function(angvec){
pi <- 3.1415926535
angvec[angvec==0] <- 1
angvec <- 1 - angvec
sangvec_sin(2*pi*angvec+pi/2)
cangvec_cos(2*pi*angvec+pi/2)
ang.com_complex(real=cangvec,imaginary=sangvec)
distang_unique(sort(ang.com))
repang_matrix(table(sort(ang.com)))
meanang.com_complex(real=mean(cangvec),imaginary=mean(sangvec))
angbb_(1/9)*distang*repang+distang
maxlength <- 1+max(abs(angbb-distang),2/9)
par(pty="s")
plot(0,0,xlim=c(-maxlength,maxlength),ylim=c(-maxlength,maxlength),
xlab="",ylab="",type="n",
xaxt="n",yaxt="n",
sub="Arrow direction: circular mean",
main=paste("Circular histogram of",as.character(substitute(angvec)))
)
arrows(Re(distang),
Im(distang),Re(angbb),Im(angbb),size=0.05)
lines(complex(arg=pi*(-100:100)/100))
# points(complex(arg=runif(700,-pi,pi)))
text(0,0.9,"0%",cex=.5)
text(0.9,0,"25%",cex=.5)
text(0,-0.9,"50%",cex=.5)
text(-0.9,0,"75%",cex=.5)
lines(.1*complex(arg=pi*(-100:100)/100))
# points(0.1*complex(arg=runif(150,-pi,pi)))
arrows(c(0,0.1,0,-0.1),c(0.1,0,-0.1,0),c(0,0.8,0,-0.8),c(0.8,0,-0.8,0))
meanang.com <- meanang.com/abs(meanang.com)
arrows(0,0,Re(meanang.com),Im(meanang.com))
axis(1,at=c(1,maxlength),labels=c("0",as.character(round((maxlength-1)*9,0))))
}
Technical Details
Message-ID:
<9201202332.AA17353@mercury.stat.wisc.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!dmssyd.syd.dms.CSIRO.AU!newsShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa931,fe0c7280d74ce1a X-Google-Attributes: gidfa931,public X-Google-ArrivalTime: 1992-01-20 16:32:44 PST Newsgroups: aus.stats.s Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!metro!dmssyd.syd.dms.CSIRO.AU!news From: chappell@stat.wisc.edu Subject: Re: Wind Rose Message-ID: <9201202332.AA17353@mercury.stat.wisc.edu> X-Gateway: dmssyd.syd.dms.CSIRO.AU Lines: 97 Sender: daemon@syd.dms.CSIRO.AU Organization: CSIRO Div. Maths & Stats, CSIRO Div. Applied Physics Date: Tue, 21 Jan 1992 00:00:32 GMT