doubleHydrograph: Creates hydrograph from 2 MESH output files

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/doubleHydrograph.R

Description

Creates a ggplot hydrograph from MESH output. This function only uses values from two MESH data frames (as read in using readOutputTimeseriesCSV). It is assumed that the observed data are the same in both cases - only the simulations differ. Because this function returns a ggplot object, you can change its format in any way you like. The plots produced may be faceted using the commands facet_wrap or facet_grid.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
doubleHydrograph(
  MESHvals1,
  stationNames1 = "",
  MESHname1 = "MESH1",
  MESHvals2,
  stationNames2 = "",
  MESHname2 = "MESH2",
  byStation = TRUE,
  byYear = FALSE,
  meas = TRUE,
  sim = TRUE,
  calStart = "",
  calEnd = "",
  alpha = 1
)

Arguments

MESHvals1

Required. A data frame of output from a MESH run, as produced by read_MESH_OutputTimeseries_csv.

stationNames1

Optional. A vector of strings holding station names. If specified, the station names will be used in the plots. Otherwise the MESH station numbers will be used.

MESHname1

Optional. A string giving the name of the first MESH output. Default is "MESH1".

MESHvals2

Required. A data frame of output from a MESH run, as produced by read_MESH_OutputTimeseries_csv.

stationNames2

Optional. A vector of strings holding station names.

MESHname2

Optional. A string giving the name of the second MESH output. Default is "MESH2".

byStation

Optional. If TRUE (the default) then the plots will be coloured according to the station names. You may want to set this to FALSE if you are facetting by station name.

byYear

Optional. If TRUE then the plots will be able to be facetted by year. Note that this means that the dates are all plotted using the year 2000, so you will see strange results if you set this to TRUE and don't facet by year. Default is FALSE

meas

Optional. Should the measured values be plotted? Default is TRUE. If FALSE, they will be omitted.

sim

Optional. Should the simulated values be plotted? Default is TRUE. If FALSE, they will be omitted.

calStart

Optional. The start date of the calibration period. Must be a string in the format yyyy-mm-dd. If specified, values on and after this date will be designated as the Calibration period. The remaining values will be designated as the Validation period.

calEnd

Optional. The start date of the calibration period. Must be a string in the format yyyy-mm-dd. If specified, values on and after this date will be designated as the Calibration period. The remaining values will be designated as the Validation period.

alpha

Optional. Sets the alpha channel (transparency) of the plots. The default value is 1, i.e. opaque. Setting alpha to less than 1 makes the plots transparent, which can be useful to see overlapping hydrographs.

Value

If successful, returns a ggplot2 object. If unsuccessful, returns FALSE. The object can be facetted by the name of the station (the variable is called station). If the option byYear = TRUE, then the object can be facetted by the variable YEAR.

Note

Specifying the calibration start and/or end dates will allow the resulting plot to be facetted by the variable period.

Author(s)

Kevin Shook

See Also

simpleHydrograph read_MESH_OutputTimeseries_csv hydroStats

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
p <- doubleHydrograph(MESHvals1 = capa, MESHname1 = "CaPa precip", 
MESHvals2 = kevin, MESHname2 = "Station precip",  byStation = TRUE, 
alpha = 0.6)
p
# facet by station
p2 <- p + facet_wrap(~station, scales = "free_y", strip.position = "right") 
p2
# add scale colour
colours <- c("red", "blue", "black")
p3 <- p2 + + scale_colour_manual(values = colours)
# restrict plot to a range of dates
p3
startDate <- as.Date("2005-04-01")
endDate <- as.Date("2005-10-01")
p4 <- p3 + scale_x_date(limits = c(startDate, endDate))
p4

## End(Not run)

CentreForHydrology/MESHr documentation built on Jan. 11, 2021, 8:34 p.m.