Create annual aggregations of WRTDS output

annual_agg(dat_in, ...)

# S3 method for default
annual_agg(dat_in, mo_strt = 10, min_mo = 9, logspace = TRUE, ...)

Arguments

dat_in

input tidal or tidalmean object

...

arguments passed to or from other methods

mo_strt

numeric indicating month to start aggregation years, defaults to October for USGS water year from October to September

min_mo

numeric value from one to twelve indicating the minimum number of months with observations for averaging by years

logspace

logical indicating if aggregated data are to be shown in log-space or not

Value

An aggregated data object for plotting, returns only model output and response variable.

Details

WRTDS output is averaged by year for both predictions and flow-normalized predictions. Years are averaged only if one observation is contained in each of the minimum number of months specified by min_mo averaging, otherwise results are not returned for the given year. Note that setting min_mo to values smaller than the default can produce inaccurate trends for years with very few results.

The function is used internally within prdnrmplot and fitplot.

Examples

## tidal object
annual_agg(tidfit)
#> # A tibble: 40 × 8
#>    date       fit0.1 fit0.5 fit0.9 norm0.1 norm0.5 norm0.9   res
#>    <date>      <dbl>  <dbl>  <dbl>   <dbl>   <dbl>   <dbl> <dbl>
#>  1 1974-10-01   2.70   2.99   3.54    2.70    2.95    3.45  3.01
#>  2 1975-10-01   2.67   3.02   3.43    2.66    3.04    3.45  2.98
#>  3 1976-10-01  NA     NA     NA      NA      NA      NA    NA   
#>  4 1977-10-01   2.56   3.15   3.53    2.57    3.15    3.51  3.23
#>  5 1978-10-01   2.53   3.15   3.59    2.52    3.13    3.53  3.12
#>  6 1979-10-01   2.49   3.12   3.62    2.42    3.08    3.55  3.15
#>  7 1980-10-01   2.45   3.13   3.62    2.36    3.05    3.53  2.91
#>  8 1981-10-01   2.26   2.95   3.46    2.29    3.00    3.51  3.26
#>  9 1982-10-01   2.26   2.97   3.48    2.24    2.94    3.46  3.21
#> 10 1983-10-01   2.32   2.97   3.54    2.16    2.90    3.42  3.12
#> # ℹ 30 more rows

## tidalmean object
annual_agg(tidfitmean)
#> # A tibble: 40 × 6
#>    date       bt_fits bt_norm  fits  norm   res
#>    <date>       <dbl>   <dbl> <dbl> <dbl> <dbl>
#>  1 1974-10-01    24.8    23.6  3.10  3.05  3.01
#>  2 1975-10-01    24.3    24.1  3.08  3.07  2.98
#>  3 1976-10-01    NA      NA   NA    NA    NA   
#>  4 1977-10-01    24.5    24.8  3.08  3.09  3.23
#>  5 1978-10-01    25.5    24.5  3.12  3.08  3.12
#>  6 1979-10-01    25.0    23.7  3.09  3.04  3.15
#>  7 1980-10-01    24.5    23.0  3.07  3.00  2.91
#>  8 1981-10-01    21.5    22.3  2.93  2.97  3.26
#>  9 1982-10-01    21.9    21.3  2.94  2.92  3.21
#> 10 1983-10-01    21.6    20.1  2.93  2.86  3.12
#> # ℹ 30 more rows