compute.Q.percentile.longterm: Compute long term annual (calendar and water year)...

Description Usage Arguments Value Examples

View source: R/compute.Q.percentile.longterm.R

Description

Computes many percentiles on the flow$Q variable between start.year and end.year inclusive for both calendar and water years. It (optionally) saves the results in *.csv and *.pdf files.

Usage

1
2
3
4
5
6
compute.Q.percentile.longterm(Station.Code = "XXXXX", flow,
  start.year = 9999, end.year = 0, per.list = c(1, 2, seq(5, 95, 5), 98,
  99), write.cy.stat.csv = TRUE, write.cy.stat.trans.csv = TRUE,
  write.wy.stat.csv = TRUE, write.wy.stat.trans.csv = TRUE,
  report.dir = ".", csv.nddigits = 3, na.rm = list(na.rm.global = TRUE),
  debug = FALSE)

Arguments

Station.Code

A character string. Used to name any *.csv or *.pdf files created so be careful that the Station.Code will be acceptable in a file name.

flow

Dataframe with two variables (1) Date with the date as a R date class variable and (2) Q a numeric variable with the flow for that day.

Missing values for Q can be explicitly represented using NA with the associated date, or implicitly represented by excluding the date from the data.frame.

The date range of flow can be wider than the start.year and end.year. This is useful for statistics on the water year (starting 1 October of the previous year) when you may wish to include flow data for the latter part of the year. Similarly, it may be useful for statistics that use a 3, 7, or 30 day rolling average as this will be missing for the first few days of each year.

A water year runs from 1 October of the previous year to 30 Sept of the current year

All other variables in the data frame will be ignored. Data does NOT have to be sorted by Date order.

start.year, end.year

Starting and ending year for statistics in YYYY format, e.g. start.year=2013.

per.list

Percentiles to be computed

write.cy.stat.csv

Should a file be created with the computed calendar year percentiles? The file name will be file.path(report.dir,paste(Station.Code,'-longterm-cy-percentile-stat.csv')).

write.cy.stat.trans.csv

Should a file be created with the transposed of the calendar year percentile report? The file name will be file.path(report.dir,paste(Station.Code,'-longterm-cy-percentile-stat-trans.csv')).

write.wy.stat.csv

Should a file be created with the computed water year percentiles? The file name will be file.path(report.dir,paste(Station.Code,'-longterm-wy-percentile-stat.csv')).

write.wy.stat.trans.csv

Should a file be created with the transposed of the water year percentile report? The file name will be file.path(report.dir,paste(Station.Code,'-longterm-wy-percentile-stat-trans.csv')).

report.dir

Directory in which *.csv or *.pdf files are stored.

csv.nddigits

Number of decimal digits to be rounded to when creating *.csv files.

na.rm

List of logical values indicating how to deal with missing values. na.rm$na.rm.global control if missing values are to be globally excluded (TRUE) or propogated (FALSE). If missing values are to be propogated, then any statistic computed over a missing value is also set to missing. For example, if a flow value was missing on 2014-01-03, then any statistics for January of 2014, JFM of 2014, calendar year 2014, water year 2014, 3 day rolling average of 1, 2, 3 of January 2014 and all statistics that depend on those rolling averages, will also be set to missing.

debug

Internal flag used for debugging

Value

A list with the following elements:

Q.cy.percentile.stat

Data frame with the calendar year percentiles of flow$Q by month and overall between start.year and end.year

Q.cy.percentile.stat.trans

Data frame with the calendar year percentiles of flow$Q transposed.

file.cy.stat.csv

Object with file name of *.csv file with calendar year percentile statistics.

file.cy.stat.trans.csv

Object with file name of *.csv file with transposed calendar year percentile statistics.

Q.wy.percentile.stat

Data frame with the water year percentiles of flow$Q by month and overall between start.year and end.year

Q.wy.percentile.stat.trans

Data frame with the water year percentiles of flow$Q transposed.

file.wy.stat.csv

Object with file name of *.csv file with water year percentile statistics.

file.wy.stat.trans.csv

Object with file name of *.csv file with transposed water year percentile statistics.

na.rm

Missing value flags.

Version

Version of this function.

Date

Date function was run.

Examples

1
2
3
4
5
6
7
8
## Not run: 
percentile.longterm <- compute.Q.percentile.longterm(
                         Station.Code  ='ABCDE',
                         flow          =flow,
                         start.year    =1960,
                         end.year      =2015)

## End(Not run)

bcgov/BCWaterDischargeAnalysis documentation built on Dec. 21, 2020, 2:20 p.m.