Learn R Programming

hydroTSM (version 0.2-0)

hydroplot: Hydrological time series plotting and extraction.

Description

hydroplot: When x is a zoo object it plots (a maximum of) 9 graphs (lines plot, boxplots and/or histograms) of the daily, monthly and/or annual time series. sname2plot: When x is a data frame whose columns contain the time series of several gauging stations, it takes the name of one gauging station and plots the graphs described before.

Usage

hydroplot(x, sname = "X", var.type = "", FUN, na.rm = TRUE, 
          var.unit = "mm", main, win.len1 = 365 * 1, win.len2 = 365 * 3, 
          ptype = "ts+boxplot+hist", pfreq = "dma", 
          tick.tstep= "months", lab.tstep= "years")

sname2plot(x, sname, var.type = "", FUN, na.rm = TRUE, var.unit = "mm", main, win.len1 = 365 * 1, win.len2 = 365 * 3, ptype = "ts+boxplot+hist", pfreq = "dma", tick.tstep= "months", lab.tstep= "years", dates, date.fmt = "%Y-%m-%d")

Arguments

x
zoo object or data.frame with columns storing the time series of several gauging stations.
sname
character with the name of the station whose values will be plotted. This name MUST exist as column name in x
var.type
ONLY required when FUN is missing. character representing the type of variable being plotted. Used for determining the function used for computing the monthly and annual values when FUN is missing. Valid values are: -) Pre
FUN
ONLY required when var.type is missing. Function that have to be applied for transforming from daily to monthly or annual time step (e.g., For precipitation FUN=sum and for temperature and flow ts, FUN=mean)
na.rm
Logical. Should missing values be removed before the computations?
var.unit
Character representing the measurement unit of the variable being plotted. ONLY used for labelling the axes (e.g., "mm" for precipitation, "C" for temperature, and "m3/s" for flow.)
main
Character representing the main title of the plot. If the user do not provide a title, this is created automatically as: main= paste(var.type, "at", sname, sep=""),
win.len1
number of days for being used in the computation of the first moving average. A value equal to zero indicates that this moving average is not going to be computed.
win.len2
number of days for being used in the computation of the second moving average. A value equal to zero indicates that this moving average is not going to be computed.
ptype
Character indicating the type of plot that will be plotted. Valid values are: -) ts => only time series -) ts+boxplot => only time series + boxplot -) ts+hist => only ti
pfreq
Character indicating how many plots are desired by the user. Valid values are: -) dma: Daily, Monthly and Annual values are plotted -) dm : Daily and Monthly values are plotted -) ma : Monthly and Annual values are plo
tick.tstep
Character indicating the time step that have to be used for putting the ticks on the time axis. Valid values are: -) days, -) months, -) years
lab.tstep
Character indicating the time step that have to be used for putting the labels on the time axis. Valid values are: -) days, -) months, -) years
dates
ONLY required when x is a data frame. It is a numeric, factor or Date object indicating how to obtain the dates corresponding to the sname station. If dates is a number, it indicates the index of the column in
date.fmt
Character indicating the format in which the dates are stored in dates, e.g. %Y-%m-%d. See format in format.Date. ONLY required when class(dates)=="factor"<

Details

Plots of the daily/monthly/annual time series given as input. Depending on the value of pfreq, daily, monthly and/or annual time series plots, boxplots and histograms are produced. Depending on the value of ptype, time series plots, boxplots and/or histograms are produced.

See Also

sname2ts

Examples

Run this code
## Loading daily streamflows at the station Oca en Ona (Ebro River basin, Spain) ##
data(OcaEnOnaQts)

hydroplot(OcaEnOnaQts, FUN=mean, var.unit = "m3/s")

#############
## Loading the monthly time series of precipitation within the Ebro River basin.
data(EbroPPtsMonthly)

## Plotting the monthly and annual values of precipitation at station "P9001", 
## stored in 'EbroPPtsMonthly'.
sname2plot(EbroPPtsMonthly, sname="P9001", var.type="Precipitation", dates=1, pfreq="ma")

Run the code above in your browser using DataLab