mast: Creation of met mast objects

View source: R/mast.R

mastR Documentation

Creation of met mast objects

Description

Creates met mast objects from one or more datasets (measurement heights). All datasets are sorted by height in descending order.

Usage

mast(timestamp, ..., loc=NULL, desc=NULL)

## S3 method for class 'mast'
plot(x, set, signal=c("v.avg", "dir.avg", "turb.int"), subset, ...)

Arguments

timestamp

Time stamp as POSIXlt vector, e.g. created by timestamp.

...

At least one dataset created by set. For plotting function: optional graphical parameters (see below).

loc

Lat/lon coordinates of the site in decimal degrees as vector of two numeric values (optional).

desc

Plain text information about the site, measurement, met mast condition, etc. as string (optional).

x

Met mast object, created by mast.

set

Set used for plotting specified as set number or set name. Argument is optional – if missing, all sets containing the given signal(s) are used.

signal

Signal(s) to be plotted as vector of strings giving the signal names.

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".

Details

Valuable information about a met mast is usually provided by an installation protocol.

Measurements of wind speed in several heights is required for the computation of the site's wind profile. Met masts might have mounted more than one sensor of the same type at the same height. Thus, the data of a broken sensor can later be substituted by the 'backup-sensor'.

Value

Returns a met mast object, which is necessary for all data analyses. A met mast object is a list of:

timestamp

Time stamp of the observations.

location

Lat/lon coordinates of the site (optional).

description

Mast information (optional).

sets

List of one or more datasets (measurement heights) consisting of height information and the data.

Optional graphical parameters

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

  • 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 set plotted.

  • 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.

  • lty: Vector of line types – one for each set plotted. See par for available line types.

  • 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(1, 4.5, 0, 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, 0.7, 0).

  • ylab: String vector of labels for the y axis.

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

Author(s)

Christian Graul

See Also

POSIXlt, set, timestamp

Examples

## Not run: 
## load data, prepare sets and time stamp
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])

## create met mast object
neubuerg <- mast(timestamp=ts, set40, set30, set20)  # default

# add location and description
neubuerg.2 <- mast(timestamp=ts, set40, set30, set20, 
  loc=c(49.8909,11.4017), desc="Site #247 - Neubuerg")

# name sets
neubuerg.3 <- mast(timestamp=ts, C1.A1=set40, C2.A2=set30, 
  C3=set20, loc=c(49.8909,11.4017), desc="Site #247 - Neubuerg")


## plot met mast (time series)
plot(neubuerg)  # default
plot(neubuerg, set=1, legend=FALSE)  # only one set
plot(neubuerg, set="set1", legend=FALSE)  # same as above 
plot(neubuerg, signal=c("v.avg", "dir.avg"))  # change signals

# change time scale
plot(neubuerg, subset=c("2010-01-01 00:10:00", NA))
plot(neubuerg, subset=c("2009-10-11 00:10:00", "2009-10-11 23:50:00"))
plot(neubuerg, set=1, signal="dir.avg", subset=c(NA, "2009-12-27 18:30:00"))

# customize plot
plot(neubuerg, bty="n", bty.leg="o", cex.axis=1.2, cex.lab=1.4, cex.leg=1.2, 
  col=c("darkblue", "red2", "darkgreen"), col.axis="darkgray", 
  col.lab="darkgray", col.leg="darkgray", col.ticks="darkgray", 
  las=0, lty=rep(1.5,3), mar=c(0.5,4,0,0.5), mgp=c(2,0.5,0), 
  ylab=c("v [m/s]","dir [deg]","ti [-]"), x.intersp=1)

## End(Not run)

chgrl/bReeze documentation built on Feb. 10, 2024, 2:27 a.m.