if (FALSE) {
## load and prepare data
data("winddata", package="bReeze")
set40 <- set(height=40, v.avg=winddata[,2], v.std=winddata[,5],
dir.avg=winddata[,14])
set30 <- set(height=30, v.avg=winddata[,6], v.std=winddata[,9],
dir.avg=winddata[,16])
set20 <- set(height=20, v.avg=winddata[,10], v.std=winddata[,13])
ts <- timestamp(timestamp=winddata[,1])
neubuerg <- mast(timestamp=ts, set40=set40, set30=set30,
set20=set20)
neubuerg <- clean(mast=neubuerg)
## calculate availability
neubuerg.avail <- availability(mast=neubuerg)
# compare the total availability of 'set40' and 'set30'
neubuerg.avail$set40$total
neubuerg.avail$set30$total
# check the daily availability of 'set40'
neubuerg.avail$set40$daily
# note: availability for 'set20' is missing - its availability is NULL,
# since it does not contain wind direction data
# calculate availability for 'set20' using wind direction data from 'set40'
set20.avail <- availability(mast=neubuerg, v.set=3, dir.set=1)
# same as above
set20.avail <- availability(mast=neubuerg, v.set="set20", dir.set="set40")
# calculate availability for all sets using wind direction data from 'set40'
neubuerg.avail <- availability(mast=neubuerg, v.set=c(1,2,3), dir.set=1)
# data subsets
availability(mast=neubuerg, v.set=1,
subset=c("2009-12-01 00:10:00", "2009-12-31 23:50:00"))
availability(mast=neubuerg, v.set=1,
subset=c("2010-01-01 00:10:00", NA)) # just 'start' time stamp
availability(mast=neubuerg, v.set=1,
subset=c(NA, "2009-12-31 23:50:00")) # just 'end' time stamp
# change number of digits and hide results
neubuerg.avail <- availability(mast=neubuerg, digits=0)
neubuerg.avail <- availability(mast=neubuerg, print=FALSE)
neubuerg.avail
## plot availability objects
plot(neubuerg.avail) # default
plot(neubuerg.avail, set=2) # one dataset
plot(neubuerg.avail, set="set30") # same as above
plot(neubuerg.avail, set=c(1,2)) # several datasets
# customize plot
plot(neubuerg.avail, border="darkgray", cex.axis=0.7,
cex.lab=0.9, col=c("darkgreen", "orange", "red4"), col.axis="blue",
col.lab="blue", fill=c("lightgreen", "yellow", "red"), lwd=0.5,
mar=c(1,1,1,1), plot.names=FALSE, xlab="jour", ylab="mois")
}
Run the code above in your browser using DataLab