stfl_get_annual_stat: Extract annualized Statistics from HYDAT database using...

Description Usage Arguments Value Examples

Description

Extract annualized Statistics from HYDAT database using fasstr package Queries the HYDAT database to extract the daily data and then computes the annualized statistics

Usage

1
2
3
4
5
6
7
8
9
stfl_get_annual_stat(
  STATION_NUMBER,
  Parameter = c("Flow", "Level")[1],
  Statistic,
  water_year_start = 1,
  months_in_year = 12,
  ignore_missing = FALSE,
  debug = FALSE
)

Arguments

STATION_NUMBER

The 7 digit station code(s) used in the HYDAT databases. You can specify a vector to extract daily data from many stations in one call.

Parameter

If "Flow" or "Level" is to be returned from the HYDAT database.

Statistic

A vector of statistics to be computed from the daily data. The list of available statistics is given gy stfl_get_avail_stat(). A column in the returned data frame will have the statistic names.

water_year_start

Start month for the water year.

months_in_year

How many months, starting from the water_year_start should be included in the water year. These two parameters allows you, for example, to select June - Sept with water_year_start=6 and months_in_year=4. If you specify water_year_start=10 and months_in_year=4, statistics will be computed using October, November, December, and January (of the next year). The year in which the water year starts is used as the label for the annualized value – this differs from ther fasstr package.

ignore_missing

Should missing values be ignored when computing statistics. The default value of FALSE implies that only complete water years (or portions selected using water_year_start) can be used in computing annualized statistics.

debug

If true, then this code will break when called. Not useful unless you have access to the source code. Can be useful when debugging the SHINY app.

Value

Data frame in long format with the the following values

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
# needs the HYDAT package installed
station.id <- c("08NM116")
stfl_get_annual_stat(station.id, Statistic=c("MEAN","P10"),
      water_year_start=1, months_in_year=12)

station.id <- c("08NM053","08NM116")
res <- stfl_get_annual_stat(station.id, Statistic=c("MEAN","P10"),
      water_year_start=1, months_in_year=12)
head(res)
#' 
## End(Not run)

bcgov/StreamFlowTrend documentation built on Dec. 19, 2021, 7:38 a.m.