diff --git a/R/plot_annual_extremes_year.R b/R/plot_annual_extremes_year.R index c7401ef..6187393 100644 --- a/R/plot_annual_extremes_year.R +++ b/R/plot_annual_extremes_year.R @@ -313,8 +313,8 @@ plot_annual_extremes_year <- function(data, year_to_plot ), limits = names(fils))+ ggplot2::scale_colour_manual(values = stats::setNames("#264b96", disch_name), name = NULL, limits = names(stats::setNames("#264b96", disch_name)))+ - #ggplot2::guides(fill = ggplot2::guide_legend(override.aes = list(shape = shp, colour = colors), - # order = 1) )+ + ggplot2::guides(fill = ggplot2::guide_legend(override.aes = list(shape = shp, colour = colors), + order = 1) )+ ggplot2::xlab("Day of Year") + ggplot2::ylab(y_axis_title) + {if (include_title & .y != "XXXXXXX") ggplot2::ggtitle(paste(.y)) } + @@ -333,58 +333,6 @@ plot_annual_extremes_year <- function(data, legend.background = ggplot2::element_blank()) )) -# ggplot2::ggplot(data = timing_plots, ggplot2::aes(x = Date)) + -# {if(plot_normal_percentiles) ggplot2::geom_ribbon(ggplot2::aes_string(ymin = "MIN", ymax = "MAX"), -# alpha = 0.4, colour = "lightblue2", fill = "lightblue2", na.rm = FALSE) } + -# ggplot2::geom_line(ggplot2::aes(y = Value, colour = disch_name), size = 0.2, na.rm = TRUE) + -# {if(plot_min & roll_days_min > 1) ggplot2::geom_rect(ggplot2::aes(xmin = Min_Start, xmax = Min_End, ymax =Inf, ymin=0), -# fill = low_col, alpha = 0.2, na.rm = TRUE) }+ -# {if(plot_max & roll_days_max > 1) ggplot2::geom_rect(ggplot2::aes(xmin = Max_Start, xmax = Max_End, ymax =Inf, ymin=0), -# fill = high_col, alpha = 0.2, na.rm = TRUE) }+ -# {if(plot_min & roll_days_min > 1) ggplot2::geom_segment(ggplot2::aes(x = Min_Start, xend = Min_End, y = Min_Value, yend=Min_Value), -# colour = low_col, size = 1, na.rm = TRUE)}+ -# {if(plot_max & roll_days_max > 1) ggplot2::geom_segment(ggplot2::aes(x = Max_Start, xend = Max_End, y = Max_Value, yend=Max_Value), -# colour = high_col, size = 1, na.rm = TRUE)}+ -# {if(plot_min) ggplot2::geom_vline(data = dplyr::filter(timing_plots, !is.na(Min_Value)), ggplot2::aes(xintercept = Min_Start), colour = low_col, size = 1)}+ -# {if(plot_min & roll_days_min > 1) ggplot2::geom_vline(data = dplyr::filter(timing_plots, !is.na(Min_Value)), ggplot2::aes(xintercept = Min_End), colour = low_col, size = 1)}+ -# {if(plot_max) ggplot2::geom_vline(data = dplyr::filter(timing_plots, !is.na(Max_Value)), ggplot2::aes(xintercept = Max_Start), colour = high_col, size = 1)}+ -# {if(plot_max & roll_days_max > 1) ggplot2::geom_vline(data = dplyr::filter(timing_plots, !is.na(Max_Value)) ,ggplot2::aes(xintercept = Max_End), colour = high_col, size = 1)}+ -# {if(plot_min) ggplot2::geom_point(ggplot2::aes(x= Date, y = Min_Value, fill = low_lab), size = 3.5, na.rm = TRUE, shape = 21) }+ -# {if(plot_max) ggplot2::geom_point(ggplot2::aes(x= Date, y = Max_Value, fill = high_lab), size = 3.5, na.rm = TRUE, shape = 21) }+ -# {if(!log_discharge) ggplot2::scale_y_continuous(expand = ggplot2::expansion(mult = c(0, 0.05)), -# breaks = scales::pretty_breaks(n = 8), -# labels = scales::label_number(scale_cut = scales::cut_short_scale()))}+ -# {if(log_discharge) ggplot2::scale_y_log10(breaks = scales::log_breaks(n = 8, base = 10), -# labels = scales::label_number(scale_cut = scales::cut_short_scale()))} + -# {if(log_discharge & log_ticks) ggplot2::annotation_logticks(base= 10, "left", colour = "grey25", size = 0.3, -# short = ggplot2::unit(.07, "cm"), mid = ggplot2::unit(.15, "cm"), -# long = ggplot2::unit(.2, "cm"))} + -# ggplot2::scale_x_date(date_labels = "%b", date_breaks = "1 month", -# limits = as.Date(c(as.character(min(daily_stats$AnalysisDate, na.rm = TRUE)), -# as.character(max(daily_stats$AnalysisDate, na.rm = TRUE)))), -# expand = c(0,0)) + -# ggplot2::scale_fill_manual(values = fils, name = paste0("Annual Extremes\nfor ", -# ifelse(water_year_start == 1,"Year ","Water Year "), -# year_to_plot ))+ -# ggplot2::scale_colour_manual(values = stats::setNames("#264b96", disch_name), name = NULL)+ -# # ggplot2::guides(fill = ggplot2::guide_legend(override.aes = list(shape = shp, colour = colors), -# # order = 1) )+ -# ggplot2::xlab("Day of Year") + -# ggplot2::ylab(y_axis_title) + -# # {if (include_title & .y != "XXXXXXX") ggplot2::ggtitle(paste(.y)) } + -# ggplot2::theme_bw()+ -# ggplot2::theme(axis.text = ggplot2::element_text(size = 10, colour = "grey25"), -# axis.title = ggplot2::element_text(size = 12, colour = "grey25"), -# axis.ticks = ggplot2::element_line(size = .1, colour = "grey25"), -# axis.ticks.length = ggplot2::unit(0.05, "cm"), -# axis.title.y = ggplot2::element_text(margin = ggplot2::margin(0,0,0,0)), -# panel.border = ggplot2::element_rect(colour = "black", fill = NA, size = 1), -# panel.grid.minor = ggplot2::element_blank(), -# panel.grid.major = ggplot2::element_line(size = .1), -# legend.text = ggplot2::element_text(size = 9, colour = "grey25"), -# legend.key.size = ggplot2::unit(0.4, "cm"), -# legend.spacing = ggplot2::unit(-0.4, "cm"), -# legend.background = ggplot2::element_blank()) # Create a list of named plots extracted from the tibble diff --git a/docs/404.html b/docs/404.html index 1457c9f..1c89e4b 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@
@@ -144,7 +144,7 @@Site built with pkgdown 2.0.6.
+Site built with pkgdown 2.0.7.
diff --git a/docs/LICENSE.html b/docs/LICENSE.html index 64db1ee..adcfd66 100644 --- a/docs/LICENSE.html +++ b/docs/LICENSE.html @@ -17,7 +17,7 @@ @@ -159,7 +159,7 @@This vignette will use the following packages:
library(fasstr)
-library(dataRetrieval) # for getting USGS NWIS data
+library(dataRetrieval) # for getting USGS NWIS data
library(tidyhydat) # for getting ECCC HYDAT data
library(dplyr) # for data wrangling and pipelines
library(ggplot2) # for modifying fasstr plots
Site built with pkgdown 2.0.6.
+Site built with pkgdown 2.0.7.
diff --git a/docs/articles/fasstr_files/figure-html/plot1-1.png b/docs/articles/fasstr_files/figure-html/plot1-1.png index c3b22b8..0707d11 100644 Binary files a/docs/articles/fasstr_files/figure-html/plot1-1.png and b/docs/articles/fasstr_files/figure-html/plot1-1.png differ diff --git a/docs/articles/fasstr_files/figure-html/plot3-1.png b/docs/articles/fasstr_files/figure-html/plot3-1.png index dc6a689..eccbc6e 100644 Binary files a/docs/articles/fasstr_files/figure-html/plot3-1.png and b/docs/articles/fasstr_files/figure-html/plot3-1.png differ diff --git a/docs/articles/fasstr_frequency_analysis.html b/docs/articles/fasstr_frequency_analysis.html index be7dda9..19f86ef 100644 --- a/docs/articles/fasstr_frequency_analysis.html +++ b/docs/articles/fasstr_frequency_analysis.html @@ -33,7 +33,7 @@ @@ -556,17 +556,17 @@
freq_analysis$Freq_Fitted_Quantiles
Distribution Probability Return.Period X7.Day
-1 PIII 0.010 100.000000 0.1939235
-2 PIII 0.050 20.000000 0.2796278
-3 PIII 0.100 10.000000 0.3344622
-4 PIII 0.200 5.000000 0.4094482
-5 PIII 0.500 2.000000 0.5775901
-6 PIII 0.800 1.250000 0.7722251
-7 PIII 0.900 1.111111 0.8808996
-8 PIII 0.950 1.052632 0.9724210
-9 PIII 0.975 1.025641 1.0521211
-10 PIII 0.980 1.020408 1.0757757
-11 PIII 0.990 1.010101 1.1440783
+1 PIII 0.010 100.000000 0.1992962
+2 PIII 0.050 20.000000 0.2832672
+3 PIII 0.100 10.000000 0.3366830
+4 PIII 0.200 5.000000 0.4095274
+5 PIII 0.500 2.000000 0.5726658
+6 PIII 0.800 1.250000 0.7622194
+7 PIII 0.900 1.111111 0.8687835
+8 PIII 0.950 1.052632 0.9590939
+9 PIII 0.975 1.025641 1.0382486
+10 PIII 0.980 1.020408 1.0618442
+11 PIII 0.990 1.010101 1.1302692
Site built with pkgdown 2.0.6.
+Site built with pkgdown 2.0.7.
diff --git a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-10-1.png b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-10-1.png index 030636d..5b52d92 100644 Binary files a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-10-1.png and b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-10-1.png differ diff --git a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-12-1.png b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-12-1.png index 19ee90b..2647931 100644 Binary files a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-12-1.png and b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-12-1.png differ diff --git a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-38-1.png b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-38-1.png index 9171648..64e9d8d 100644 Binary files a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-38-1.png and b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-38-1.png differ diff --git a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-40-1.png b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-40-1.png index 25d5d30..a295885 100644 Binary files a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-40-1.png and b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-40-1.png differ diff --git a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-42-1.png b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-42-1.png index 95c6819..f1edbf8 100644 Binary files a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-42-1.png and b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-42-1.png differ diff --git a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-43-1.png b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-43-1.png index ce5bf66..4e6f924 100644 Binary files a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-43-1.png and b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-43-1.png differ diff --git a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-45-1.png b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-45-1.png index 0c099b9..9003207 100644 Binary files a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-45-1.png and b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-45-1.png differ diff --git a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-48-1.png b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-48-1.png index 998e466..4501721 100644 Binary files a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-48-1.png and b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-48-1.png differ diff --git a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-55-1.png b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-55-1.png index 57a311c..a29d75d 100644 Binary files a/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-55-1.png and b/docs/articles/fasstr_full_analysis_files/figure-html/unnamed-chunk-55-1.png differ diff --git a/docs/articles/fasstr_trending_analysis.html b/docs/articles/fasstr_trending_analysis.html index b838ca3..b41d357 100644 --- a/docs/articles/fasstr_trending_analysis.html +++ b/docs/articles/fasstr_trending_analysis.html @@ -33,7 +33,7 @@ @@ -603,27 +603,34 @@
trends_analysis$Annual_Trends_Results
STATION_NUMBER Statistic lbound trend trendp
-1 08NM116 Annual_Maximum -0.367741985 0.0570881358 2.34061357
-2 08NM116 Annual_Mean -0.074223140 -0.0210267951 -0.86209860
-3 08NM116 Annual_Median -0.035271167 -0.0124904912 -0.51211014
-4 08NM116 Annual_Minimum -0.006666193 -0.0009808113 -0.04021326
-5 08NM116 Annual_P10 -0.017499298 -0.0063876706 -0.26189449
-6 08NM116 Annual_P90 -0.255726706 -0.0302831595 -1.24160954
+ STATION_NUMBER Statistic lbound trend trendp
+1 08NM116 Annual_Maximum -0.367741985 0.0570881358 2.3406136
+2 08NM116 Annual_Mean -0.074223160 -0.0210267927 -0.8620985
+3 08NM116 Annual_Median -0.035271133 -0.0124905012 -0.5121105
+4 08NM116 Annual_Minimum -0.006666194 -0.0009808123 -0.0402133
+5 08NM116 Annual_P10 -0.017499298 -0.0063876706 -0.2618945
+6 08NM116 Annual_P90 -0.255726706 -0.0302831595 -1.2416095
ubound tau sig nruns autocor valid_frac linear
1 0.516666624 0.04026846 0.7192625 1 0.01369972 1 0.1380313468
-2 0.038457647 -0.07179487 0.5216482 4 0.08209108 1 -0.0019323059
-3 0.007693643 -0.14102565 0.2040979 3 0.06425806 1 -0.0088832751
-4 0.004085118 -0.04871795 0.6664041 3 0.08438438 1 0.0004937281
-5 0.005695283 -0.10512821 0.3453057 4 0.47516686 1 -0.0049319510
-6 0.199289847 -0.03333334 0.7708403 3 0.13185011 1 0.0101482580
- intercept min_year max_year n_years mean median min max
-1 50.9015322 1973 2013 41 51.9585367 52.299999 29.799999 86.20000
-2 6.9349162 1973 2013 41 6.1988672 6.235263 2.876137 11.13412
-3 1.9761653 1973 2013 41 1.9552683 1.710000 0.856000 3.95000
-4 0.5002090 1973 2013 41 0.4810732 0.485000 0.025000 0.82200
-5 0.8558584 1973 2013 41 0.8147268 0.730200 0.341000 1.50000
-6 20.3637020 1973 2013 41 20.2456342 19.700001 5.874000 36.62000
+2 0.038457631 -0.07179487 0.5216482 4 0.08208012 1 -0.0019323059
+3 0.007693628 -0.14102565 0.2040979 3 0.06435808 1 -0.0088832751
+4 0.004085119 -0.04871795 0.6664041 4 0.08440387 1 0.0004937281
+5 0.005695283 -0.10512821 0.3453057 5 0.47516677 1 -0.0049319510
+6 0.199289847 -0.03333334 0.7708403 4 0.13185024 1 0.0101482580
+ intercept lbound_intercept ubound_intercept min_year max_year n_years
+1 50.9015322 21.804136811 79.7152348 1973 2013 41
+2 6.9349161 2.866094958 10.5580963 1973 2013 41
+3 1.9761652 0.454868274 4.0202190 1973 2013 41
+4 0.5002090 0.166538940 0.8613161 1973 2013 41
+5 0.8558584 -0.007427143 1.9272266 1973 2013 41
+6 20.3637020 5.576070188 36.8692482 1973 2013 41
+ mean median min max
+1 51.9585367 52.299999 29.799999 86.20000
+2 6.1988672 6.235263 2.876137 11.13412
+3 1.9552683 1.710000 0.856000 3.95000
+4 0.4810732 0.485000 0.025000 0.82200
+5 0.8147268 0.730200 0.341000 1.50000
+6 20.2456342 19.700001 5.874000 36.62000
Site built with pkgdown 2.0.6.
+Site built with pkgdown 2.0.7.
Site built with pkgdown 2.0.6.
+Site built with pkgdown 2.0.7.
diff --git a/docs/articles/fasstr_users_guide.html b/docs/articles/fasstr_users_guide.html index 8ac0648..027954b 100644 --- a/docs/articles/fasstr_users_guide.html +++ b/docs/articles/fasstr_users_guide.html @@ -33,7 +33,7 @@ @@ -749,6 +749,7 @@
plot_annual_symbols(station_number = "08NM116")
$Annual_Symbols
+Warning:
[1m
[22mRemoved 144 rows containing missing values (`geom_tile()`).
custom_months_label
argument (ex. “Summer Flows”).
-+-calc_longterm_daily_stats(station_number = "08NM116", start_year = 1974)
+STATION_NUMBER Month Mean Median Maximum Minimum P10 P90 -1 08NM116 Jan 1.144262 0.940 9.50 0.160 0.5759 1.780 -2 08NM116 Feb 1.158765 0.960 5.81 0.140 0.5422 1.950 -3 08NM116 Mar 1.800957 1.290 17.50 0.380 0.7172 3.550 -4 08NM116 Apr 8.194391 5.875 53.50 0.505 1.4190 18.010 -5 08NM116 May 24.368688 21.800 80.80 2.550 10.3300 40.800 -6 08NM116 Jun 22.541514 20.300 86.20 0.450 6.1990 41.110 -7 08NM116 Jul 6.233644 3.940 76.80 0.332 1.1800 13.700 -8 08NM116 Aug 2.184697 1.560 22.40 0.427 0.8343 4.148 -9 08NM116 Sep 2.300251 1.600 17.60 0.364 0.7709 4.700 -10 08NM116 Oct 2.134815 1.650 15.20 0.267 0.8440 4.250 -11 08NM116 Nov 1.921402 1.510 11.70 0.260 0.5990 3.750 -12 08NM116 Dec 1.263718 1.070 7.30 0.244 0.5410 2.200 -13 08NM116 Long-term 6.282043 1.810 86.20 0.140 0.7100 20.100
STATION_NUMBER Month Mean Median Maximum Minimum P10 P90 +1 08NM116 Jan 1.122294 0.9340 9.50 0.160 0.5706 1.750 +2 08NM116 Feb 1.127140 0.9435 5.81 0.140 0.5064 1.900 +3 08NM116 Mar 1.748453 1.2400 17.50 0.380 0.6776 3.404 +4 08NM116 Apr 8.169997 5.8000 53.50 0.505 1.4200 18.300 +5 08NM116 May 25.182745 22.4000 95.40 2.550 10.4000 44.340 +6 08NM116 Jun 22.375935 19.9000 86.20 0.450 6.1390 40.800 +7 08NM116 Jul 6.237522 3.9700 76.80 0.332 1.2200 13.900 +8 08NM116 Aug 2.176655 1.6300 22.40 0.427 0.8466 4.008 +9 08NM116 Sep 2.319518 1.6300 17.60 0.364 0.7859 4.751 +10 08NM116 Oct 2.152216 1.7200 15.20 0.267 0.8576 4.122 +11 08NM116 Nov 1.950852 1.5600 11.70 0.260 0.6078 3.741 +12 08NM116 Dec 1.254868 1.0700 7.30 0.244 0.5468 2.150 +13 08NM116 Long-term 6.331062 1.8200 95.40 0.140 0.7060 20.100
The
plot_longterm_daily_stats()
will plot the monthly mean, median, maximum, and minimum values along with selected inner and outer percentiles ribbons on one plot. Change the inner and outer @@ -859,7 +860,7 @@Basic long-term statisticsouter_percentiles arguments, remove the maximum and minimum ribbon using
include_extremes = FALSE
, or add a specific year usingadd_year
. -+plot_longterm_daily_stats(station_number = "08NM116", start_year = 1974, inner_percentiles = c(25,75), @@ -872,41 +873,41 @@
Basic long-term statistics -
+calc_longterm_monthly_stats(station_number = "08NM116", start_year = 1974)
+1 1.643419 +2 1.696507 +3 2.764129 +4 12.821133 +5 33.928387 +6 36.802000 +7 12.742839 +8 3.365161 +9 3.991000 +10 3.628335 +11 3.316533 +12 2.093226 +13 8.441362STATION_NUMBER Month Mean Median Maximum Minimum P10 -1 08NM116 Jan 1.144262 0.9723548 6.117742 0.3155161 0.6245355 -2 08NM116 Feb 1.159891 0.9649821 3.831786 0.3528276 0.6002868 -3 08NM116 Mar 1.800957 1.4381613 6.926774 0.5067419 0.8427516 -4 08NM116 Apr 8.194391 7.7333333 23.880333 1.5993333 2.8767667 -5 08NM116 May 24.368688 23.8032259 44.987097 13.9861288 16.0945807 -6 08NM116 Jun 22.541514 22.0521668 48.640000 3.1504333 11.7849333 -7 08NM116 Jul 6.233644 4.4229032 25.639355 0.9213871 1.9778548 -8 08NM116 Aug 2.184697 1.7551613 10.193548 0.8721290 1.1265258 -9 08NM116 Sep 2.300251 1.7156667 8.109333 0.6999667 1.0055133 -10 08NM116 Oct 2.134815 1.8187097 5.661290 0.5329032 1.0166065 -11 08NM116 Nov 1.921402 1.5382167 5.413667 0.4982333 0.7148133 -12 08NM116 Dec 1.263718 1.0975645 3.648387 0.4502581 0.5481516 -13 08NM116 Annual 6.281955 6.2583836 11.134121 2.8761370 4.3651392 +1 08NM116 Jan 1.122294 0.9679032 6.117742 0.3155161 0.6246516 +2 08NM116 Feb 1.128056 0.9607586 3.831786 0.3528276 0.5149286 +3 08NM116 Mar 1.748453 1.4009677 6.926774 0.5067419 0.8168000 +4 08NM116 Apr 8.169997 7.7613333 23.880333 1.5993333 2.9978667 +5 08NM116 May 25.182745 23.8483871 48.122581 13.9861288 16.1646452 +6 08NM116 Jun 22.375935 21.8166669 48.640000 3.1504333 11.3063333 +7 08NM116 Jul 6.237522 4.5012903 25.639355 0.9213871 2.0231935 +8 08NM116 Aug 2.176655 1.7938710 10.193548 0.8721290 1.1316645 +9 08NM116 Sep 2.319518 1.7580000 8.109333 0.6999667 1.0131933 +10 08NM116 Oct 2.152216 1.8951613 5.661290 0.5329032 1.0350516 +11 08NM116 Nov 1.950852 1.5526667 5.413667 0.4982333 0.7192933 +12 08NM116 Dec 1.254868 1.0968065 3.648387 0.4502581 0.5574323 +13 08NM116 Annual 6.330833 6.2744794 11.134121 2.8761370 4.3721797 P90 -1 1.673323 -2 1.716647 -3 2.838355 -4 13.035733 -5 32.740968 -6 35.648000 -7 12.941419 -8 3.371935 -9 4.054300 -10 3.664829 -11 3.383433 -12 2.139194 -13 8.355335
The corresponding
-plot_longterm_monthly_stats()
function plots the data, with similar options asplot_longterm_daily_stats()
.+plot_longterm_monthly_stats(station_number = "08NM116", start_year = 1974)
@@ -919,7 +920,7 @@$`Long-term_Monthly_Statistics`
Basic annual statisticsplot_annual_stats() functions calculate the mean, median, maximum, minimum, and percentiles of daily flows for every year of data provided. In calculating, all daily flow values are grouped by year. -
+calc_annual_stats(station_number = "08NM116", start_year = 1974)
STATION_NUMBER Year Mean Median Maximum Minimum P10 P90 @@ -931,12 +932,12 @@
Basic annual statistics
The percentiles in the
-plot_annual_stats()
function are fully customizable like thecalc_
function.+plot_annual_stats(station_number = "08NM116", start_year = 1974, log_discharge = TRUE)
-$Annual_Statistics
+Warning: Transformation introduced infinite values in continuous y-axis
Warning: [1m [22mTransformation introduced infinite values in continuous y-axis
@@ -947,7 +948,7 @@Basic monthly statistics -
+calc_monthly_stats(station_number = "08NM116", start_year = 1974)
STATION_NUMBER Year Month Mean Median Maximum Minimum P10 P90 @@ -961,7 +962,7 @@
function. A plot for each different statistic (means, medians, percentiles, etc.) is created to visualize the monthly patterns over the years. -Basic monthly statisticscalc_
+plot_monthly_stats(station_number = "08NM116", start_year = 1974)[1]
@@ -978,23 +979,23 @@$Mean_Monthly_Statistics
Basic daily statistics -
+-calc_daily_stats(station_number = "08NM116", start_year = 1974)
+STATION_NUMBER Date DayofYear Mean Median Minimum Maximum P5 -1 08NM116 Jan-01 1 1.078136 0.9700 0.328 2.51 0.54025 -2 08NM116 Jan-02 2 1.050818 0.9195 0.310 2.26 0.52600 -3 08NM116 Jan-03 3 1.032045 0.8970 0.290 2.00 0.52450 -4 08NM116 Jan-04 4 1.044068 0.9025 0.284 2.52 0.50515 -5 08NM116 Jan-05 5 1.029909 0.8950 0.302 2.25 0.53450 -6 08NM116 Jan-06 6 1.028023 0.8760 0.315 2.32 0.51905 - P25 P75 P95 -1 0.69150 1.3800 1.8500 -2 0.69025 1.3500 1.8850 -3 0.70300 1.2200 1.9435 -4 0.73175 1.2900 1.9575 -5 0.70950 1.2300 1.9845 -6 0.74175 1.2975 1.9205
STATION_NUMBER Date DayofYear Mean Median Minimum Maximum P5 P25 +1 08NM116 Jan-01 1 1.070319 0.977 0.328 2.51 0.5455 0.6850 +2 08NM116 Jan-02 2 1.044745 0.929 0.310 2.26 0.5320 0.6795 +3 08NM116 Jan-03 3 1.024426 0.905 0.290 2.00 0.5290 0.7020 +4 08NM116 Jan-04 4 1.035596 0.910 0.284 2.52 0.5113 0.7235 +5 08NM116 Jan-05 5 1.021064 0.899 0.302 2.25 0.5390 0.7090 +6 08NM116 Jan-06 6 1.015681 0.870 0.315 2.32 0.5201 0.7335 + P75 P95 +1 1.300 1.850 +2 1.300 1.870 +3 1.195 1.927 +4 1.215 1.905 +5 1.190 1.929 +6 1.250 1.871
The plotting daily statistics function will plot the monthly mean, median, maximum, and minimum values along with selected inner and outer percentiles ribbons on one plot. Change the inner and outer percentile @@ -1002,12 +1003,12 @@
Basic daily statisticsouter_percentiles arguments, remove the maximum and minimum ribbon using
include_extremes = FALSE
, or add a specific year usingadd_year
. -+plot_daily_stats(station_number = "08NM116", start_year = 1974)
$Daily_Statistics
-
+@@ -1019,12 +1020,12 @@plot_daily_stats(station_number = "08NM116", start_year = 1974, add_year = 2000)
Flow Duration
+plot_flow_duration(station_number = "08NM116", start_year = 1974)
$Flow_Duration
-
+plot_flow_duration(station_number = "08NM116", start_year = 1974, months = 7:9, @@ -1039,30 +1040,30 @@
argument). It can also be known as the long-term mean annual discharge, MAD. -Other Long-term Statisticspercent_MAD
+calc_longterm_mean(station_number = "08NM116", start_year = 1974, percent_MAD = c(5,10,20))
+1 08NM116 6.331062 0.3165531 0.6331062 1.266212STATION_NUMBER LTMAD X5.MAD X10.MAD X20.MAD -1 08NM116 6.282043 0.3141021 0.6282043 1.256409
-
calc_longterm_percentile()
calculates the selected long-term percentiles of all the daily flow values.+calc_longterm_percentile(station_number = "08NM116", start_year = 1974, percentiles = c(25,50,75))
+1 08NM116 1.03 1.82 5.67STATION_NUMBER P25 P50 P75 -1 08NM116 1.03 1.81 5.72
-
calc_flow_percentile()
calculates the percentile rank of a specified flow value, provided asflow_value
. It compares the flow value to all daily flow values to determines the percentile rank.+calc_flow_percentile(station_number = "08NM116", start_year = 1974, flow_value = 6.270)
+1 08NM116 76.397STATION_NUMBER Percentile -1 08NM116 76.262
Basic statistics and plotting volumetric and yield flows @@ -1082,13 +1083,13 @@
Basic statisti functions, by listing the
values
argument as either ‘Volume_m3’ or ‘Yield_mm’ (from their respectiveadd_*
functions), the discharge axis title will adjust accordingly. -+add_daily_volume(station_number = "08NM116") %>% plot_annual_stats(values = "Volume_m3", start_year = 1974)
$Annual_Statistics
-
+@@ -1141,7 +1142,7 @@add_daily_yield(station_number = "08NM116") %>% plot_daily_stats(values = "Yield_mm", start_year = 1974)
Cumulative annual statisticscalc_annual_cumulative_stats() function provides the total annual volume or runoff yield (if
use_yield = TRUE
is used). It totals all flows for a given year in cubic metres. -+calc_annual_cumulative_stats(station_number = "08NM116", start_year = 1974)
STATION_NUMBER Year Total_Volume_m3 1 08NM116 1974 265854182 @@ -1156,7 +1157,7 @@
function. When usingCumulative annual statistics
+@@ -1178,7 +1179,7 @@calc_annual_cumulative_stats(station_number = "08NM116", start_year = 1974, include_seasons = TRUE)
Cumulative annual statisticsplot_annual_cumulative_stats()
include_seasons = TRUE
two additional plots will be created, one for two- and four-seasons. -+plot_annual_cumulative_stats(station_number = "08NM116", start_year = 1974)
@@ -1200,40 +1201,40 @@$Total_Volume
Cumulative monthly and statisticscalc_ function are flexible using the
percentiles
argument. -+calc_monthly_cumulative_stats(station_number = "08NM116", start_year = 1974)
+1 1950221 3407616 5231434 +2 3743410 6122650 10551946 +3 6587179 11744741 20279117 +4 24031642 36248083 63880462 +5 77104137 117601934 155839473 +6 123343214 185879578 228437522 +7 128909577 208896667 259840380 +8 132292699 219312101 265726294 +9 137414966 228368981 270057785 +10 143054726 231213701 274458404 +11 148326379 235173715 280909365 +12 152096011 239892883 284372018STATION_NUMBER Month Mean Median Maximum Minimum P5 -1 08NM116 Jan 3064791 2604355 16385760 845078.4 1477241 -2 08NM116 Feb 5893104 4954090 24560928 1729123.2 2696052 -3 08NM116 Mar 10716787 8909525 38265696 3086380.8 4877798 -4 08NM116 Apr 31956648 28939378 74097331 9895046.4 13004462 -5 08NM116 May 97225741 91484726 159751008 50343551.6 54586215 -6 08NM116 Jun 155653347 156396614 255162529 76246877.0 94118293 -7 08NM116 Jul 172349538 177471648 301884193 81422928.3 99584121 -8 08NM116 Aug 178201031 180792130 311904865 84962822.7 102593770 -9 08NM116 Sep 184163281 187290446 323685505 86777136.3 105063372 -10 08NM116 Oct 189881170 192634934 337755745 88204464.3 108435961 -11 08NM116 Nov 194861443 195413731 346120993 89495885.1 110337003 -12 08NM116 Dec 198246186 197364384 351125627 90701856.3 111818927 +1 08NM116 Jan 3005952 2592432 16385760 845078.4 1503135 +2 08NM116 Feb 5757593 4928947 24560928 1729123.2 2724589 +3 08NM116 Mar 10440650 8677498 38265696 3086380.8 4902707 +4 08NM116 Apr 31617282 28485389 74097331 9895046.4 13125819 +5 08NM116 May 99066747 93268887 159751008 50343551.6 54632431 +6 08NM116 Jun 157065172 158564131 255162529 76246877.0 90921640 +7 08NM116 Jul 173771752 177670628 301884193 81422928.3 99999127 +8 08NM116 Aug 179601706 181262189 311904865 84962822.7 103871315 +9 08NM116 Sep 185613898 188800847 323685505 86777136.3 106433697 +10 08NM116 Oct 191378392 192925325 337755745 88204464.3 109851699 +11 08NM116 Nov 196435000 196449148 346120993 89495885.1 111684986 +12 08NM116 Dec 199796039 197871983 351125627 90701856.3 113122665 P25 P75 P95 -1 1952813 3552120 5276405 -2 3821256 6449026 10836677 -3 6629623 11874924 20988806 -4 23204081 37045296 65757148 -5 77641977 112968280 153230729 -6 126292629 184640299 222609146 -7 130357425 206338168 250096900 -8 133904469 218750047 254809416 -9 139696574 227954197 258678192 -10 146308118 230884539 262619958 -11 151523806 234482947 267038372 -12 155162974 238912243 269723114
The
-plot_monthly_cumulative_stats()
function will plot the monthly total mean, median, maximum, and minimum values along with the 5th, 25th, 75th, and 95th percentiles all on one plot. The percentiles are not customizable for this function.+plot_monthly_cumulative_stats(station_number = "08NM116", start_year = 1974)
@@ -1256,28 +1257,28 @@$Monthly_Cumulative_Volumetric_Stats
Cumulative daily statistics
+calc_daily_cumulative_stats(station_number = "08NM116", start_year = 1974)
+1 59184.0 112320.0 159840.0 +2 117892.8 220320.0 325209.6 +3 176083.2 331344.0 482544.0 +4 239932.8 430272.0 621216.0 +5 307497.6 531792.0 778377.6 +6 367113.6 636163.2 958867.2STATION_NUMBER Date DayofYear Mean Median Minimum Maximum P5 -1 08NM116 Jan-01 1 93150.98 83808.0 28339.2 216864 46677.6 -2 08NM116 Jan-02 2 183941.67 160099.2 55123.2 412128 91756.8 -3 08NM116 Jan-03 3 273110.40 236304.0 80179.2 581472 135237.6 -4 08NM116 Jan-04 4 363317.89 313416.0 104716.8 768960 182023.2 -5 08NM116 Jan-05 5 452302.04 388411.2 130809.6 952992 231876.0 -6 08NM116 Jan-06 6 541123.20 466732.8 158025.6 1123200 280519.2 +1 08NM116 Jan-01 1 92475.57 84412.8 28339.2 216864 47131.2 +2 08NM116 Jan-02 2 182741.51 164678.4 55123.2 412128 92793.6 +3 08NM116 Jan-03 3 271251.88 241488.0 80179.2 581472 136987.2 +4 08NM116 Jan-04 4 360727.35 316137.6 104716.8 768960 183902.4 +5 08NM116 Jan-05 5 448947.27 391478.4 130809.6 952992 233496.0 +6 08NM116 Jan-06 6 536702.09 474681.6 158025.6 1123200 282398.4 P25 P75 P95 -1 59745.6 119232.0 159840.0 -2 119383.2 229392.0 325468.8 -3 178891.2 339249.6 483192.0 -4 241358.4 438480.0 623808.0 -5 309182.4 546696.0 783172.8 -6 368366.4 656596.8 973641.6
The
-plot_daily_cumulative_stats()
function will plot the daily cumulative total mean, median, maximum, and minimum values along with the 5th, 25th, 75th, and 95th percentiles all on one plot. The percentiles are not customizable for this function.+@@ -1354,7 +1355,7 @@plot_daily_cumulative_stats(station_number = "08NM116", start_year = 1974, use_yield = TRUE)
Annual flow timing
+calc_annual_flow_timing(station_number = "08NM116", start_year = 1974)
STATION_NUMBER Year DoY_25pct_TotalQ Date_25pct_TotalQ DoY_33.3pct_TotalQ @@ -1379,13 +1380,13 @@
Annual flow timing
+plot_annual_flow_timing(station_number = "08NM116", start_year = 1974)
$Annual_Flow_Timing
The timing of flows for a given year can also be plotted.
-+plot_annual_flow_timing_year(station_number = "08NM116", year_to_plot = 1999)
Warning: One or more calculations included missing values and NA's were @@ -1401,7 +1402,7 @@
Annual low-flowsThe
calc_annual_lowflows()
calculates the annual minimum values, the day of year, and dates of specified rolling mean days (can do multiple days if desired). -+calc_annual_lowflows(station_number = "08NM116", start_year = 1974)
STATION_NUMBER Year Min_1_Day Min_1_Day_DoY Min_1_Day_Date Min_3_Day @@ -1428,7 +1429,7 @@
Annual low-flowsThe annual low flow values and the day of the low flow values can be plotted, separately, using the
plot_annual_lowflows()
function. -+plot_annual_lowflows(station_number = "08NM116", start_year = 1974)
@@ -1443,7 +1444,7 @@$Annual_Low_Flows
Annual high flowscalc_annual_highflows() calculates the annual maximum values, the day of year, and dates of specified rolling mean days (can do multiple days if desired). -
+calc_annual_highflows(station_number = "08NM116", start_year = 1974)
STATION_NUMBER Year Max_1_Day Max_1_Day_DoY Max_1_Day_Date Max_3_Day @@ -1470,7 +1471,7 @@
function. -Annual high flowsplot_annual_highflows()
+plot_annual_highflows(station_number = "08NM116", start_year = 1974)
@@ -1487,7 +1488,7 @@$Annual_High_Flows
Annual extreme (both high and lo calculates the annual maximum and minimum values, the day of year, and dates of specified rolling mean days and specified months for each of the high and low flows. -
+calc_annual_extremes(station_number = "08NM116", roll_days_min = 7, roll_days_max = 3, @@ -1507,7 +1508,7 @@
Annual extreme (both high and lo 5 157 1978-06-06 6 147 1979-05-27
The annual extremes values and the days can be plotted:
-+plot_annual_extremes(station_number = "08NM116", roll_days_min = 7, roll_days_max = 3, @@ -1519,15 +1520,15 @@
Annual extreme (both high and lo
The annual extremes values and the days for a given year can also be plotted:
-+plot_annual_extremes_year(station_number = "08NM116", roll_days_min = 7, roll_days_max = 3, start_year = 1974, year_to_plot = 1999)
-$Annual_Extremes_Year
+Warning: Transformation introduced infinite values in continuous y-axis -Transformation introduced infinite values in continuous y-axis
Warning: [1m [22mTransformation introduced infinite values in continuous y-axis + [1m [22mTransformation introduced infinite values in continuous y-axis
@@ -1543,26 +1544,26 @@Number of normal ( all years and sums all days that are within and above or below the daily normal ranges for a given year. Rolling averages can also be used in this function using the
roll_days
argument. -+calc_annual_normal_days(station_number = "08NM116", start_year = 1974)
+1 08NM116 1974 209 78 78 +2 08NM116 1975 196 136 33 +3 08NM116 1976 168 51 147 +4 08NM116 1977 250 106 9 +5 08NM116 1978 236 17 112 +6 08NM116 1979 139 155 71STATION_NUMBER Year Normal_Days Below_Normal_Days Above_Normal_Days -1 08NM116 1974 216 72 77 -2 08NM116 1975 195 138 32 -3 08NM116 1976 168 54 144 -4 08NM116 1977 250 107 8 -5 08NM116 1978 230 21 114 -6 08NM116 1979 154 144 67
Each of the above, below, and normal days can be plotted using the
-plot_annual_normal_days()
function.+plot_annual_normal_days(station_number = "08NM116", start_year = 1974)
$Annual_Normal_Days
The daily flows with normal categories for a given year can also be plotted.
-+plot_annual_normal_days_year(station_number = "08NM116", year_to_plot = 1999)
@@ -1577,7 +1578,7 @@$Annual_Normal_Days_Year
Calculating all annual statisticscalc_monthly_statistics() functions. Several arguments provided for customization of the statistics. There is no corresponding plotting function for this calculation function. -
+colnames(calc_all_annual_stats(station_number = "08NM116", start_year = 1974))
[1] "STATION_NUMBER" "Year" "Annual_Maximum" @@ -1627,7 +1628,7 @@
Plotting annual means -
+plot_annual_means(station_number = "08NM116", start_year = 1974)
@@ -1775,12 +1776,12 @@$Annual_Means
Handling Missing Dates -
+calc_annual_stats(station_number = "08NM116")
If you want to calculate the statistics regardless of the number of missing dates per time period, use the
-ignore_missing = TRUE
argument.+calc_annual_stats(station_number = "08NM116", ignore_missing = TRUE)
Starting with fasstr 0.4.0, to allow a certain percentage of missing @@ -1805,7 +1806,7 @@
Handling Missing Datescompute_* functions. See function documentation to see if included. The following example allows the data to have 25%, or ~91 days, of missing dates, to calculate annual statistics: -
@@ -1830,12 +1831,12 @@+calc_annual_stats(station_number = "08NM116", allowed_missing = 25)
Water year and start month
Example of a default water year, starting in October:
-+calc_annual_stats(station_number = "08NM116", ignore_missing = TRUE, water_year_start = 9)
Example of a water year starting in August:
-+@@ -1850,18 +1851,18 @@calc_annual_stats(station_number = "08NM116", ignore_missing = TRUE, water_year_start = 8)
Selecting and excluding years
+calc_annual_stats(station_number = "08NM116", start_year = 1980, end_year = 2010)
Examples of removing certain years (outliers, bad data, etc.) using exclude_years:
-+-calc_annual_stats(station_number = "08NM116", start_year = 1980, end_year = 2010, exclude_years = 1982)
+calc_annual_stats(station_number = "08NM116", start_year = 1980, end_year = 2010, @@ -1876,13 +1877,13 @@
Using only years with complete data be filtered for years with complete data and statistics will be calculated. Only years with complete data will be included into the following example. -
+calc_longterm_daily_stats(station_number = "08NM116", complete_years = TRUE)
Some functions, like below, require only years with complete data (statistics are based on full years of data), so years with missing dates will be automatically ignored:
-+calc_annual_flow_timing(station_number = "08NM116")
@@ -1902,14 +1903,14 @@Selecting for monthscalc_all_annual_stats() and
compute_annual_trends()
.Example of filtering for months June through August:
-+calc_annual_stats(station_number = "08NM116", start_year = 1980, end_year = 2010, months = 6:8)
Example of flow timing / center of volume in winter/spring months:
-+calc_flow_timing(station_number = "08NM116", start_year = 1980, end_year = 2010, @@ -1924,7 +1925,7 @@
Selecting for months
+calc_longterm_daily_stats(station_number = "08NM116", start_year = 1980, end_year = 2010, @@ -1947,14 +1948,14 @@
andRolling averagesroll_days
roll_align
work together.Example of a 7-day rolling mean analysis (single
-roll_days
use):+calc_annual_stats(station_number = "08NM116", start_year = 1980, end_year = 2010, roll_days = 7)
Example of a 7- and 30-day rolling mean analysis (multiple
-roll_days
use):+plot_annual_lowflows(station_number = "08NM116", start_year = 1980, end_year = 2010, @@ -1978,13 +1979,13 @@
argument.Percentiles and other statisticspercentiles
This example shows the default percentiles for the
-calc_annual_stats()
function (10 and 90th percentiles):+calc_annual_stats(station_number = "08NM116", start_year = 1980, end_year = 2010)
This example shows custom percentiles for the
-calc_annual_stats()
function (5 and 25th percentiles):+calc_annual_stats(station_number = "08NM116", start_year = 1980, end_year = 2010, @@ -1994,7 +1995,7 @@
Percentiles and other statistics
Example of calculating dates of the 10 and 20 percent of total annual flow:
-+calc_annual_flow_timing(station_number = "08NM116", start_year = 1980, end_year = 2010, @@ -2002,7 +2003,7 @@
Percentiles and other statisticsExample of plotting the number of normal and above/below normal days per year of the 10th and 90th percentiles (25th and 75th percentiles are default): -
+plot_annual_normal_days(station_number = "08NM116", start_year = 1980, end_year = 2010, @@ -2016,7 +2017,7 @@
Data frame options
+@@ -2039,7 +2040,7 @@calc_longterm_daily_stats(station_number = "08NM116", start_year = 1980, end_year = 2010)
Data frame options
+calc_longterm_daily_stats(station_number = "08NM116", start_year = 1980, end_year = 2010, @@ -2070,7 +2071,7 @@
Logarithmic discharge scale
+@@ -2078,7 +2079,7 @@plot_annual_stats(station_number = "08NM116", start_year = 1980, end_year = 2010)
Logarithmic discharge scale
Set the discharge scale to be logarithmic (
-log_discharge = TRUE
):+plot_annual_stats(station_number = "08NM116", start_year = 1980, end_year = 2010, @@ -2095,7 +2096,7 @@
Including a standard title on th default is
FALSE
.Example of including a title when plotting (
-include_title = TRUE
):+plot_annual_stats(station_number = "08NM116", start_year = 1980, end_year = 2010, @@ -2105,7 +2106,7 @@
Including a standard title on th
Example of including a title when plotting
-include_title = TRUE
where the statistic is also displayed:+plot_monthly_stats(station_number = "08NM116", start_year = 1980, end_year = 2010, @@ -2113,10 +2114,11 @@
Including a standard title on th
Customizing a plot by using additional
-ggplot2
functions:@@ -2182,14 +2189,14 @@-library(ggplot2) - -# Create the plot list and extract the plot using [[1]] + +
+Warning: package 'ggplot2' was built under R version 4.2.3
++# Create the plot list and extract the plot using [[1]] plot <- plot_daily_stats(station_number = "08NM116", start_year = 1980)[[1]] # Customize the plot with various `ggplot2` functions @@ -2126,6 +2128,11 @@
Including a standard title on th geom_vline(xintercept = as.Date("1900-08-05"), colour = "darkgray", linetype = 1, size = 0.5) + ggtitle("Mission Creek Annual Hydrograph") + ylab("Flow (cms)")
Warning: [1m [22mUsing `size` aesthetic for lines was deprecated in ggplot2 3.4.0. + [36mℹ [39m Please use `linewidth` instead. + [90mThis warning is displayed once every 8 hours. [39m + [90mCall `lifecycle::last_lifecycle_warnings()` to see where this warning was [39m + [90mgenerated. [39m
Writing a flow data setThe following will write an “xlsx” file called “08NM116_data_data.xlsx” into your working directory that includes all daily flow data from that station in HYDAT: -
+write_flow_data(station_number = "08NM116")
The following is an example of possible customization:
-+write_flow_data(station_number = "08NM116", -start_year = 1960, - end_year = 1970 - fill_missing = TRUE, - file_name = "mission_creek.csv")
write_flow_data(station_number = "08NM116", +start_year = 1960, + end_year = 1970 + fill_missing = TRUE, + file_name = "mission_creek.csv")
Writing a data frame @@ -2203,7 +2210,7 @@
Writing a data frame
+annual_data <- calc_annual_stats(station_number = "08NM116") write_results(data = annual_data, @@ -2225,7 +2232,7 @@
, can also be used.Writing a list of plotsggplots2:ggsave()
The following will save each annual plot as a “png” file in a folder called “Annual Plots” in the working directory:
-+annual_plots <- plot_annual_stats(station_number = c("08NM116","08NM242")) write_plots(plots = annual_data, @@ -2234,7 +2241,7 @@
Writing a list of plotsThe following will save all annual plots as combined “pdf” document called “Annual Plots” in the working directory with each plot on a different page: -
+