month.stats {bReeze} R Documentation

## Calculation of monthly statistics

### Description

Calculates monthly statistics.

### Usage

```month.stats(mast, set, signal="v.avg",
fun=c("mean", "median", "min", "max", "sd"), subset,
digits=3, print=TRUE)
ms(mast, set, signal="v.avg",
fun=c("mean", "median", "min", "max", "sd"), subset,
digits=3, print=TRUE)

## S3 method for class 'month.stats'
plot(x, set, ...)
```

### Arguments

 `mast` Met mast object created by `mast`. `set` Set used for calculation or plotting specified as set number or set name. If missing, the calculation or plotting is carried out for all datasets that contain the specified `signal`. `signal` The signal to be used, as string value. Default is `"v.avg"`. `fun` Statistical function, as string value – one of `"mean"` (arithmetic mean), `"median"`, `"min"` (minimum), `"max"` (maximum) or `"sd"` (standard deviation). `subset` Optional start and end time stamp for a data subset, as string vector `c(start, end)`. The time stamps format shall follow the rules of ISO 8601 international standard, e.g. "2012-08-08 22:55:00". `digits` Number of decimal places to be used for results as numeric value. Default is `3`. `print` If `TRUE` (the default), results are printed directly. `x` Monthly statistics object created by `month.stats`. `...` Arguments to be passed to methods. For optional graphical parameters see below.

### Details

`month.stats` calculates statistics of valid data for each month and year in the measurement period. Usually this function is used for the calculation of average wind speeds. Means strongly depend on the measurement period and the number of samples. One important requirement for a reliable wind assessment is a measurement period covering the full seasonal cycle of variations. A typical bias is a measurement limited to winter months, which usually results in overestimated wind speeds.

### Value

Returns a list of data frames (one for each dataset) containing monthly, annual and total statistics of the specified signal.

### Optional graphical parameters

The following graphical parameters can optionally be added to customize the plot:

• `border`: Colour to be used for the border of the bars – default value is `"black"`. Use `border=NA` to omit borders.

• `bty`: Type of box to be drawn around the plot region. Allowed values are `"o"` (the default), `"l"`, `"7"`, `"c"`, `"u"`, or `"]"`. The resulting box resembles the corresponding upper case letter. A value of `"n"` suppresses the box.

• `bty.leg`: Type of box to be drawn around the legend. Allowed values are `"n"` (no box, the default) and `"o"`.

• `cex`: Amount by which text on the plot should be scaled relative to the default (which is `1`), as numeric. To be used for scaling of all texts at once.

• `cex.axis`: Amount by which axis annotations should be scaled, as numeric value.

• `cex.lab`: Amount by which axis labels should be scaled, as numeric value.

• `cex.leg`: Amount by which legend text should be scaled, as numeric value.

• `col`: Vector of colours, one for each year in the measurement period.

• `col.axis`: Colour to be used for axis annotations – default is `"black"`.

• `col.box`: Colour to be used for the box around the plot region (if `bty`) – default is `"black"`.

• `col.lab`: Colour to be used for axis labels – default is `"black"`.

• `col.leg`: Colour to be used for legend text – default is `"black"`.

• `col.ticks`: Colours for the axis line and the tick marks respectively – default is `"black"`.

• `las`: Style of axis labels. One of `0` (always parallel to the axis, default), `1` (always horizontal), `2` (always perpendicular to the axis), `3` (always vertical).

• `legend`: If `TRUE` (the default) a legend is drawn.

• `mar`: A numerical vector of the form c(bottom, left, top, right) which gives the number of lines of margin to be specified on the four sides of the plot (only for plots with one dataset) – default is `c(4, 5, 1, 1)`.

• `mgp`: A numerical vector of the form c(label, annotation, line), which gives the margin line for the axis label, axis annotation and axis line. The default is `c(2.5, 1, 0)`.

• `plot.names`: If `TRUE` (the default), the names of the datasets is plotted as second label of the y axis.

• `pos.leg`: Position of legend – one of `"bottomright"`, `"bottom"`, `"bottomleft"`, `"left"`, `"topleft"`, `top`, `"topright"`, `"right"` or `"center"`.

• `xlab`: Alternative label for the x axis.

• `ylab`: Alternative label for the y axis.

• `ylim`: Limits of the y axis, as vector of two values.

• `x.intersp`: Horizontal interspacing factor for legend text, as numeric – default is `0.4`.

Christian Graul

### References

Brower, M., Marcus, M., Taylor, M., Bernadett, D., Filippelli, M., Beaucage, P., Hale, E., Elsholz, K., Doane, J., Eberhard, M., Tensen, J., Ryan, D. (2010) Wind Resource Assessment Handbook. http://www.renewablenrgsystems.com/TechSupport/~/media/Files/PDFs/wind_resource_handbook.ashx

`mast`

### Examples

```## Not run:
data("winddata", package="bReeze")
set40 <- set(height=40, v.avg=winddata[,2], v.max=winddata[,3])
set30 <- set(height=30, v.avg=winddata[,6], v.max=winddata[,7])
set20 <- set(height=20, v.avg=winddata[,10])
ts <- timestamp(timestamp=winddata[,1])
neubuerg <- mast(timestamp=ts, set40, set30, set20)
neubuerg <- clean(mast=neubuerg)

## calculate monthly means
neubuerg.stats <- month.stats(mast=neubuerg)  # default
month.stats(mast=neubuerg, set=1)  # one dataset
month.stats(mast=neubuerg, set="set1")  # same as above
month.stats(mast=neubuerg, signal="v.max")  # change signal

# calculate monthly median, min, max and standard deviation
month.stats(mast=neubuerg, fun="median")
month.stats(mast=neubuerg, fun="min")
month.stats(mast=neubuerg, fun="max")
month.stats(mast=neubuerg, fun="sd")

# data subsets
month.stats(mast=neubuerg,
subset=c("2009-12-01 00:10:00", "2009-12-31 23:50:00"))
month.stats(mast=neubuerg,
subset=c("2010-01-01 00:10:00", NA)) # just 'start' time stamp
month.stats(mast=neubuerg,
subset=c(NA, "2009-12-31 23:50:00")) # just 'end' time stamp

month.stats(mast=neubuerg, digits=2)  # change number of digits
neubuerg.ms <- month.stats(mast=neubuerg, print=FALSE)  # hide results
neubuerg.ms

## plot month stats object
plot(neubuerg.ms)  # default
plot(neubuerg.ms, set=1)  # one dataset
plot(neubuerg.ms, set="set1")  # same as above

# customize plot
plot(neubuerg.ms, border="darkgray", bty="l", cex.axis=0.7,
cex.lab=0.9, col=c(gray(0.3), gray(0.7)), col.axis="darkgray",
col.box="darkgray", col.lab="darkgray", col.ticks="darkgray", las=0,
legend=FALSE, mgp=c(2, 0.7, 0), plot.names=FALSE, ylim=c(0,7),
ylab="Wind speed [m/s]")

## End(Not run)
```

[Package bReeze version 0.4-3 Index]