compute.volume.frequency.analysis: Perform a volume frequency analysis on annual statistics.

Description Usage Arguments Value Examples

View source: R/compute.volume.frequency.analysis.R

Description

Performs a volume frequency analysis on annual statistics similar to HEC-SSP.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
compute.volume.frequency.analysis(Station.Code, flow, start.year = 9999,
  end.year = 0, use.water.year = FALSE, roll.avg.days = c(1, 3, 7, 15, 30,
  60, 90), use.log = FALSE, use.max = FALSE,
  prob.plot.position = c("weibull", "median", "hazen"),
  prob.scale.points = c(0.9999, 0.999, 0.99, 0.9, 0.5, 0.2, 0.1, 0.02, 0.01,
  0.001, 1e-04), fit.distr = c("PIII", "weibull"),
  fit.distr.method = ifelse(fit.distr == "PIII", "MOM", "MLE"),
  fit.quantiles = c(0.975, 0.99, 0.98, 0.95, 0.9, 0.8, 0.5, 0.2, 0.1, 0.05,
  0.01), na.rm = list(na.rm.global = TRUE), write.stat.csv = TRUE,
  write.stat.trans.csv = TRUE, write.plotdata.csv = FALSE,
  write.quantiles.csv = TRUE, write.quantiles.trans.csv = TRUE,
  write.frequency.plot = TRUE, write.frequency.plot.suffix = c("pdf",
  "png"), report.dir = ".", csv.nddigits = 3, 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.

use.water.year

Should results be computed on the water year (starting 1 October)? The 2013/2014 water year runs from 2013-10-01 to 2014-09-30.

roll.avg.days

Volume frequency analysis conducted on these rolling averages.

use.log

Transfrom to log-scale before analysis?

use.max

Analyze the maximums rather than the minimums.

prob.plot.position

Which plotting positions should be used in the frequency plots. Points are plotted against (i-a)/(n+1-a-b) where i is the rank of the value; n is the sample size and a and b are defined as: (a=0, b=0) for Weibull plotting positions; (a=.2; b=.3) for Median plotting postions; (a=.5; b=.5) for Hazen plotting positions.

prob.scale.points

What points should be plotted along the $X$ axis in the frequency plot.

fit.distr

Which distribution should be fit? PIII = Pearson Log III distribution; weibull=Weibull distribution.

fit.distr.method

Which method used to fit the distribution. MOM=Method of moments; MLE=maximum likelihood estimation.

fit.quantiles

Which quantiles should be estimated from the fitted distribution?

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.

write.stat.csv

Should a file be created with the computed percentiles? The file name will be file.path(report.dir,paste(Station.Code,"-annual-vfa-stat.csv", sep="")).

write.stat.trans.csv

Should a file be created with the computed percentiles in transposed format? The file name will be file.path(report.dir,paste(Station.Code,"-annual-vfa-stat-trans.csv", sep="")).

write.plotdata.csv

Should a file be created with the frequency plot data? The file name will be file.path(report.dir, paste(Station.Code,"-annual-vfa-plotdata.csv", sep="")).

write.quantiles.csv

Should a file be created with the fitted quantiles?. The file name will be file.path(report.dir, paste(Station.Code,"-annual-vfa-quantiles.csv", sep="")).

write.quantiles.trans.csv

Should a file be created with the (transposed) fitted quantiles? The file name will be file.path(report.dir, paste(Station.Code,"-annual-vfa-quantiles-trans.csv", sep="")).

write.frequency.plot

Should a file be created with the frequency plot.. The file name will be file.path(report.dir, paste(Station.Code,"-annual-vfa-frequency-plot.",write.frequency.plot.suffix[1],sep=""))

write.frequency.plot.suffix

Format of the frequency plot.

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.

debug

Internal flag used for debugging

Value

A list with the following elements:

Q.flow.summary

Data frame with flow summary.

start.year

Start year of the analysis

end.year

End year of the analysis

use.water.year

Were computations done on water year?

use.max

Were computations done on maximum values.

roll.avg.days

Rolling average days on which statistics computed.

Q.stat

Data frame with Computed annual summary statistics used in analysis

Q.stat.trans

Data frame with Computed annual summary statistics (transposed) used in analysis.

plotdata

Data frame with Co-ordinates used in frequency plot.

prob.plot.position

Which plotting position was used in frequency plot?

freqplot

ggplot2 object with frequency plot

fit.distr

Which distribution was fit to the data

fit

List of fitted objects from fitdistrplus.

fitted.quantiles

Data frame with fitted quantiles.

fitted.quantiles.trans

Data frame with fitted quantiles (transposed)

file.stat.csv

Object with file name of *.csv file with flow summary

file.stat.trans.csv

Object with file name of *.csv file with flow summary (transposed)

file.plotdata.csv

Object with file name of *.csv file with plotting information for frequency plot.

file.quantile.csv

Object with file name of fitted quantiles.

file.quantile.trans.csv

Object with file name of fitted quantiles (transposed)

file.frequency.plot

Object with file name of *.pdf or *.png file with frequency plot

Version

Version of this function.

Date

Date function was run.

Examples

1
2
3
4
5
6
7
8
## Not run: 
vfa.analysis <- compute.volume.frequency.analysis(
                     Station.Code ='XXX',
                     flow         =flow,
                     start.year   =1960,
                     end.year     =2014)

## End(Not run)

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