# windrose color ramp issue

 Classic List Threaded
5 messages
Reply | Threaded
Open this post in threaded view
|

## windrose color ramp issue

 Greetings! I'm having an issue with the windrose produced by the windrose function from the circular package.  For our weather stations in North Carolina I'm helping with a script which takes hourly wind speed and direction data to create windroses for our end users.  One of the stations in the mountains frequently reaches wind speed of 40 to 60 mph and in storms can reach wind speed over 80 mph.  This has brought up an issue with the color ramp. Currently the color ramp works one of two ways: #1) Holding the pedal colors fixed: incrspeeds = 2 # fills out the increments argument pedalcolors =  c("darkblue","blue","royalblue","darkturquoise","forestgreen","green","yellowgreen","yellow4","yellow","orange","red","darkred","violetred","mediumorchid","purple") #or 2) Making the pedal colors dynamic based on the increments and the max wind speed. incrspeeds = 2 # fills out the increments argument breaks=seq(0,round(maxwind),incrspeeds) # maxwind is the maximum wind speed numcolors=length(breaks) if(numcolors>length(pedalcolors)){ pedalcolors=rev(rainbow(numcolors)) } # In either case the result ends up in the wind rose function rose=windrose(wr,breaks=NULL,bins=numpedals,increment=incrspeeds,main=NULL,fill.col=pedalcolors,plot.mids=FALSE,units="degrees",template="geographics",ticks=FALSE,osize=0.05,cir.ind =0.05,cex=0.9,zero=NULL,rotation=NULL,right=FALSE,shrink=NULL,label.freq=TRUE,calm=c("0"),number.calm=TRUE) The issue when there are really large wind speeds in the first case, the windrose wraps the color ramp twice in both the legend and the windrose itself, and then gives only white for the remaining bands of each pedal.  For the second case, when pedalcolors will have the same number of colors as numcolors, the legend has the right color ramp, but the pedals of the windrose don't have all the colors that are passed to it.  Say pedalcolors has 40 colors, which are included in the legend, but the windrose only includes the first 16 colors in pedalcolors. Any thoughts as to why this might be happening in either case?  Thanks! Adrienne -- Adrienne Wootten Graduate Research Assistant State Climate Office of North Carolina Department of Marine, Earth and Atmospheric Sciences North Carolina State University ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

## Re: windrose color ramp issue

 An update on this particular problem I've been having.  It seems that the number of pedals (the bins argument of the windrose command) is somehow effecting the number of colors that will be plotted.  This makes no sense since it only controls the number of pedals in the windrose not the number of colors. A On Mon, Dec 12, 2011 at 4:20 PM, Adrienne Wootten <[hidden email]> wrote: > Greetings! > > I'm having an issue with the windrose produced by the windrose > function from the circular package.  For our weather stations in North > Carolina I'm helping with a script which takes hourly wind speed and > direction data to create windroses for our end users.  One of the > stations in the mountains frequently reaches wind speed of 40 to 60 > mph and in storms can reach wind speed over 80 mph.  This has brought > up an issue with the color ramp. > > Currently the color ramp works one of two ways: > > #1) Holding the pedal colors fixed: > > incrspeeds = 2 # fills out the increments argument > pedalcolors =  c("darkblue","blue","royalblue","darkturquoise","forestgreen","green","yellowgreen","yellow4","yellow","orange","red","darkred","violetred","mediumorchid","purple") > > #or 2) Making the pedal colors dynamic based on the increments and the > max wind speed. > > incrspeeds = 2 # fills out the increments argument > > breaks=seq(0,round(maxwind),incrspeeds) # maxwind is the maximum wind speed > numcolors=length(breaks) > > if(numcolors>length(pedalcolors)){ > pedalcolors=rev(rainbow(numcolors)) > } > > # In either case the result ends up in the wind rose function > > rose=windrose(wr,breaks=NULL,bins=numpedals,increment=incrspeeds,main=NULL,fill.col=pedalcolors,plot.mids=FALSE,units="degrees",template="geographics",ticks=FALSE,osize=0.05,cir.ind > =0.05,cex=0.9,zero=NULL,rotation=NULL,right=FALSE,shrink=NULL,label.freq=TRUE,calm=c("0"),number.calm=TRUE) > > The issue when there are really large wind speeds in the first case, > the windrose wraps the color ramp twice in both the legend and the > windrose itself, and then gives only white for the remaining bands of > each pedal.  For the second case, when pedalcolors will have the same > number of colors as numcolors, the legend has the right color ramp, > but the pedals of the windrose don't have all the colors that are > passed to it.  Say pedalcolors has 40 colors, which are included in > the legend, but the windrose only includes the first 16 colors in > pedalcolors. > > Any thoughts as to why this might be happening in either case?  Thanks! > > Adrienne > > -- > Adrienne Wootten > Graduate Research Assistant > State Climate Office of North Carolina > Department of Marine, Earth and Atmospheric Sciences > North Carolina State University -- Adrienne Wootten Graduate Research Assistant State Climate Office of North Carolina Department of Marine, Earth and Atmospheric Sciences North Carolina State University ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

## Re: windrose color ramp issue

 The issue is solved.  For those who wish to use windrose out of the circular package and have more groups magnitude than they do pedals, please note the following line in the windrose function - fill.col = rep(fill.col,length.out=bins) # where bins is the number of pedals, fill.col is the fill colors for the pedals This line the function forces the number of colors in the windrose to be equal to the number of pedals, which frankly makes no sense to me. I have since fixed the windrose function in the circular package, replacing the above line with the following: if(length(fill.col) wrote: > An update on this particular problem I've been having.  It seems that > the number of pedals (the bins argument of the windrose command) is > somehow effecting the number of colors that will be plotted.  This > makes no sense since it only controls the number of pedals in the > windrose not the number of colors. > > A > > On Mon, Dec 12, 2011 at 4:20 PM, Adrienne Wootten <[hidden email]> wrote: >> Greetings! >> >> I'm having an issue with the windrose produced by the windrose >> function from the circular package.  For our weather stations in North >> Carolina I'm helping with a script which takes hourly wind speed and >> direction data to create windroses for our end users.  One of the >> stations in the mountains frequently reaches wind speed of 40 to 60 >> mph and in storms can reach wind speed over 80 mph.  This has brought >> up an issue with the color ramp. >> >> Currently the color ramp works one of two ways: >> >> #1) Holding the pedal colors fixed: >> >> incrspeeds = 2 # fills out the increments argument >> pedalcolors =  c("darkblue","blue","royalblue","darkturquoise","forestgreen","green","yellowgreen","yellow4","yellow","orange","red","darkred","violetred","mediumorchid","purple") >> >> #or 2) Making the pedal colors dynamic based on the increments and the >> max wind speed. >> >> incrspeeds = 2 # fills out the increments argument >> >> breaks=seq(0,round(maxwind),incrspeeds) # maxwind is the maximum wind speed >> numcolors=length(breaks) >> >> if(numcolors>length(pedalcolors)){ >> pedalcolors=rev(rainbow(numcolors)) >> } >> >> # In either case the result ends up in the wind rose function >> >> rose=windrose(wr,breaks=NULL,bins=numpedals,increment=incrspeeds,main=NULL,fill.col=pedalcolors,plot.mids=FALSE,units="degrees",template="geographics",ticks=FALSE,osize=0.05,cir.ind >> =0.05,cex=0.9,zero=NULL,rotation=NULL,right=FALSE,shrink=NULL,label.freq=TRUE,calm=c("0"),number.calm=TRUE) >> >> The issue when there are really large wind speeds in the first case, >> the windrose wraps the color ramp twice in both the legend and the >> windrose itself, and then gives only white for the remaining bands of >> each pedal.  For the second case, when pedalcolors will have the same >> number of colors as numcolors, the legend has the right color ramp, >> but the pedals of the windrose don't have all the colors that are >> passed to it.  Say pedalcolors has 40 colors, which are included in >> the legend, but the windrose only includes the first 16 colors in >> pedalcolors. >> >> Any thoughts as to why this might be happening in either case?  Thanks! >> >> Adrienne >> >> -- >> Adrienne Wootten >> Graduate Research Assistant >> State Climate Office of North Carolina >> Department of Marine, Earth and Atmospheric Sciences >> North Carolina State University > > > > -- > Adrienne Wootten > Graduate Research Assistant > State Climate Office of North Carolina > Department of Marine, Earth and Atmospheric Sciences > North Carolina State University -- Adrienne Wootten Graduate Research Assistant State Climate Office of North Carolina Department of Marine, Earth and Atmospheric Sciences North Carolina State University ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

## Re: windrose color ramp issue

 In reply to this post by Adrienne Wootten There is also a windrose (though not with that name) function in the openair package. -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 12/12/11 1:20 PM, "Adrienne Wootten" <[hidden email]> wrote: >Greetings! > >I'm having an issue with the windrose produced by the windrose >function from the circular package.  For our weather stations in North >Carolina I'm helping with a script which takes hourly wind speed and >direction data to create windroses for our end users.  One of the >stations in the mountains frequently reaches wind speed of 40 to 60 >mph and in storms can reach wind speed over 80 mph.  This has brought >up an issue with the color ramp. > >Currently the color ramp works one of two ways: > >#1) Holding the pedal colors fixed: > >incrspeeds = 2 # fills out the increments argument >pedalcolors =   >c("darkblue","blue","royalblue","darkturquoise","forestgreen","green","yel >lowgreen","yellow4","yellow","orange","red","darkred","violetred","mediumo >rchid","purple") > >#or 2) Making the pedal colors dynamic based on the increments and the >max wind speed. > >incrspeeds = 2 # fills out the increments argument > >breaks=seq(0,round(maxwind),incrspeeds) # maxwind is the maximum wind >speed >numcolors=length(breaks) > >if(numcolors>length(pedalcolors)){ >pedalcolors=rev(rainbow(numcolors)) >} > ># In either case the result ends up in the wind rose function > >rose=windrose(wr,breaks=NULL,bins=numpedals,increment=incrspeeds,main=NULL >,fill.col=pedalcolors,plot.mids=FALSE,units="degrees",template="geographic >s",ticks=FALSE,osize=0.05,cir.ind >=0.05,cex=0.9,zero=NULL,rotation=NULL,right=FALSE,shrink=NULL,label.freq=T >RUE,calm=c("0"),number.calm=TRUE) > >The issue when there are really large wind speeds in the first case, >the windrose wraps the color ramp twice in both the legend and the >windrose itself, and then gives only white for the remaining bands of >each pedal.  For the second case, when pedalcolors will have the same >number of colors as numcolors, the legend has the right color ramp, >but the pedals of the windrose don't have all the colors that are >passed to it.  Say pedalcolors has 40 colors, which are included in >the legend, but the windrose only includes the first 16 colors in >pedalcolors. > >Any thoughts as to why this might be happening in either case?  Thanks! > >Adrienne > >-- >Adrienne Wootten >Graduate Research Assistant >State Climate Office of North Carolina >Department of Marine, Earth and Atmospheric Sciences >North Carolina State University > >______________________________________________ >[hidden email] mailing list >https://stat.ethz.ch/mailman/listinfo/r-help>PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html>and provide commented, minimal, self-contained, reproducible code. ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

## Re: windrose color ramp issue

 library(openair) ?windRose -- Clint Bowman INTERNET: [hidden email] Air Quality Modeler INTERNET: [hidden email] Department of Ecology VOICE: (360) 407-6815 PO Box 47600 FAX: (360) 407-7534 Olympia, WA 98504-7600          USPS:           PO Box 47600, Olympia, WA 98504-7600          Parcels:        300 Desmond Drive, Lacey, WA 98503-1274 On Wed, 14 Dec 2011, MacQueen, Don wrote: > There is also a windrose (though not with that name) function in the > openair package. > -Don > > ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.