Skip to content

Commit 899cae4

Browse files
authored
Merge pull request #21 from atsyplenkov/dev
better website
2 parents eeb01ea + 262dc12 commit 899cae4

6 files changed

Lines changed: 46 additions & 28 deletions

File tree

README.Rmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ requireNamespace("bench", quietly = TRUE)
3535

3636
The `tidyhydro` package provides a set of commonly used metrics in hydrology (such as _NSE_, _KGE_, _pBIAS_) for use within a [`tidymodels`](https://www.tidymodels.org/) infrastructure. Originally inspired by the [`yardstick`](https://github.com/tidymodels/yardstick/tree/main) and [`hydroGOF`](https://github.com/hzambran/hydroGOF) packages, this library is mainly written in C++ and provides a very quick estimation of desired goodness-of-fit criteria.
3737

38-
Additionally, you'll find here a C++ implementation of lesser-known yet powerful metrics and descriptive statistics recommended in the United States Geological Survey (USGS) and the National Environmental Monitoring Standards (NEMS) guidelines. Examples include _PRESS_ (Prediction Error Sum of Squares), _SFE_ (Standard Factorial Error), _MSPE_ (Model Standard Percentage Error) and others. Based on the equations from _Helsel et al._ ([2020](https://pubs.usgs.gov/publication/tm4A3)), _Rasmunsen et al._ ([2008](https://pubs.usgs.gov/tm/tm3c4/)), _Hicks et al._ ([2020](https://www.nems.org.nz/documents/suspended-sediment)) and etc. (see documentation for details).
38+
Additionally, you'll find here a C++ implementation of lesser-known yet powerful metrics and descriptive statistics recommended in the United States Geological Survey (USGS) and the New Zealand National Environmental Monitoring Standards (NEMS) guidelines. Examples include _PRESS_ (Prediction Error Sum of Squares), _SFE_ (Standard Factorial Error), _MSPE_ (Model Standard Percentage Error) and others. Based on the equations from _Helsel et al._ ([2020](https://pubs.usgs.gov/publication/tm4A3)), _Rasmunsen et al._ ([2008](https://pubs.usgs.gov/tm/tm3c4/)), _Hicks et al._ ([2020](https://www.nems.org.nz/documents/suspended-sediment)) and etc. (see documentation for details).
3939

4040
## Performance metrics
4141
The `tidyhydro` package follows the philosophy of [`yardstick`](https://github.com/tidymodels/yardstick/tree/main) and provides S3 class methods for vectors and data frames. For example, one can estimate `KGE`, `NSE` or `pBIAS` for a data frame like this:

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ desired goodness-of-fit criteria.
3030

3131
Additionally, you’ll find here a C++ implementation of lesser-known yet
3232
powerful metrics and descriptive statistics recommended in the United
33-
States Geological Survey (USGS) and the National Environmental
34-
Monitoring Standards (NEMS) guidelines. Examples include *PRESS*
35-
(Prediction Error Sum of Squares), *SFE* (Standard Factorial Error),
36-
*MSPE* (Model Standard Percentage Error) and others. Based on the
37-
equations from *Helsel et al.*
33+
States Geological Survey (USGS) and the New Zealand National
34+
Environmental Monitoring Standards (NEMS) guidelines. Examples include
35+
*PRESS* (Prediction Error Sum of Squares), *SFE* (Standard Factorial
36+
Error), *MSPE* (Model Standard Percentage Error) and others. Based on
37+
the equations from *Helsel et al.*
3838
([2020](https://pubs.usgs.gov/publication/tm4A3)), *Rasmunsen et al.*
3939
([2008](https://pubs.usgs.gov/tm/tm3c4/)), *Hicks et al.*
4040
([2020](https://www.nems.org.nz/documents/suspended-sediment)) and etc.
@@ -153,9 +153,9 @@ bench::mark(
153153
#> # A tibble: 3 × 6
154154
#> expression min median `itr/sec` mem_alloc `gc/sec`
155155
#> <bch:expr> <dbl> <dbl> <dbl> <dbl> <dbl>
156-
#> 1 tidyhydro 1 1 13.3 NaN NaN
157-
#> 2 hydroGOF 9.69 8.63 1 Inf Inf
158-
#> 3 baseR 5.80 5.54 2.27 Inf Inf
156+
#> 1 tidyhydro 1 1 16.5 NaN NaN
157+
#> 2 hydroGOF 9.74 11.5 1 Inf Inf
158+
#> 3 baseR 6.40 7.92 2.09 Inf Inf
159159
```
160160

161161
## Code of Conduct

paper/src/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.quarto/
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: "Available metrics"
3+
format:
4+
html:
5+
toc: false
6+
knitr:
7+
opts_chunk:
8+
collapse: true
9+
comment: '#>'
10+
message: false
11+
---
12+
13+
# Goodness-of-fit criteria
14+
15+
| Name | Abbr. | Function calls | Reference |
16+
|----------------|--------|--------|-------------|
17+
| Kling-Gupta Efficiency | $KGE$ | `kge` | <span style="font-size: 0.8em;">Gupta, H.V.; Kling, H.; Yilmaz, K.K.; Martinez, G.F. (2009). *Journal of Hydrology*, 377(1–2), 80–91.</span> |
18+
| Modified Kling-Gupta Efficiency | $KGE'$ | `kge2012` | <span style="font-size: 0.8em;">Kling, H., Fuchs, M., & Paulin, M. (2012). *Journal of Hydrology*, 424–425, 264–277.</span> |
19+
| Log-transformed Kling-Gupta Efficiency | $KGE_{log}$ | `kgelog`, `kgelog_low`, `kgelog_hi` | <span style="font-size: 0.8em;">Kling, J. (2023). *Journal of Hydrology*, 620, 129414.</span> |
20+
| Nash-Sutcliffe Efficiency | $NSE$ | `nse` | <span style="font-size: 0.8em;">Nash, J. E., & Sutcliffe, J. V. (1970). *Journal of Hydrology*, 10(3), 282–290.</span> |
21+
| Mean Squared Error | $MSE$ | `mse` | <span style="font-size: 0.8em;">Clark, M. P., Vogel, R. M., Lamontagne, J. R., Mizukami, N., Knoben, W. J. M., Tang, G., Gharari, S., Freer, J. E., Whitfield, P. H., Shook, K. R., & Papalexiou, S. M. (2021). The Abuse of Popular Performance Metrics in Hydrologic Modeling. Water Resources Research, 57(9), e2020WR029001.</span> |
22+
| Percent BIAS | $pBIAS$ | `pbias` | <span style="font-size: 0.8em;">Gupta, H. V., S. Sorooshian, and P. O. Yapo. (1999). Status of automatic calibration for hydrologic models: Comparison with multilevel expert calibration. J. Hydrologic Eng. 4(2): 135-143 </span> |
23+
| PRediction Error Sum of Squares | $PRESS$ | `press` | <span style="font-size: 0.8em;"> Rasmussen, P. P., Gray, J. R., Glysson, G. D. & Ziegler, A. C. Guidelines and procedures for computing time-series suspended-sediment concentrations and loads from in-stream turbidity-sensor and streamflow data. in U.S. Geological Survey Techniques and Methods book 3, chap. C4 53 (2009)</span> |
24+
| Standard Factorial Error | $SFE$ | `sfe` | <span style="font-size: 0.8em;"> Herschy, R.W. 1978: Accuracy. Chapter 10 In: Herschy, R.W. (ed.) Hydrometry - principles and practices. John Wiley and Sons, Chichester, 511 p.</span> |
25+
26+
: Metrics currently implemented in `tidyhydro` v`r packageVersion("tidyhydro")`

vignettes/articles/benchmarks.qmd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ knitr:
99

1010
Since `tidyhydro` uses C++ under the hood, it performs slightly faster than similar R packages (like `hydroGOF`). The results are particularly noticeable in large datasets with $N$ observations exceeding 1000.
1111

12+
Below are benchmarking results ran during CI process. See machine specs [below](#machine-specs).
13+
1214
```{r}
1315
#| label: setup
1416
library(tidyhydro)
@@ -79,4 +81,11 @@ bench::mark(
7981
filter_gc = FALSE
8082
)
8183
84+
```
85+
86+
# Machine specs
87+
88+
```{r}
89+
system("lscpu | grep -v '^Flags'")
90+
system("lsmem")
8291
```

vignettes/articles/tidyhydro.qmd

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,7 @@ theme_set(
2121
)
2222
```
2323

24-
# Available metrics
25-
26-
In `tidyhydro` v`r packageVersion("tidyhydro")`, `r length(getNamespaceExports("tidyhydro"))/2` metrics are implemented.
27-
28-
| Name | Abbr. | Function calls | Reference |
29-
|----------------|--------|--------|-------------|
30-
| Kling-Gupta Efficiency | $KGE$ | `kge`, `kge_vec` | <span style="font-size: 0.8em;">Gupta, H.V.; Kling, H.; Yilmaz, K.K.; Martinez, G.F. (2009). *Journal of Hydrology*, 377(1–2), 80–91.</span> |
31-
| Modified Kling-Gupta Efficiency | $KGE'$ | `kge2012`, `kge_vec` | <span style="font-size: 0.8em;">Kling, H., Fuchs, M., & Paulin, M. (2012). *Journal of Hydrology*, 424–425, 264–277.</span> |
32-
| Nash-Sutcliffe Efficiency | $NSE$ | `nse`, `nse_vec` | <span style="font-size: 0.8em;">Nash, J. E., & Sutcliffe, J. V. (1970). *Journal of Hydrology*, 10(3), 282–290.</span> |
33-
| Mean Squared Error | $MSE$ | `mse`, `mse_vec` | <span style="font-size: 0.8em;">Clark, M. P., Vogel, R. M., Lamontagne, J. R., Mizukami, N., Knoben, W. J. M., Tang, G., Gharari, S., Freer, J. E., Whitfield, P. H., Shook, K. R., & Papalexiou, S. M. (2021). The Abuse of Popular Performance Metrics in Hydrologic Modeling. Water Resources Research, 57(9), e2020WR029001.</span> |
34-
| Percent BIAS | $pBIAS$ | `pbias`, `pbias_vec` | <span style="font-size: 0.8em;">Gupta, H. V., S. Sorooshian, and P. O. Yapo. (1999). Status of automatic calibration for hydrologic models: Comparison with multilevel expert calibration. J. Hydrologic Eng. 4(2): 135-143 </span> |
35-
| PRediction Error Sum of Squares | $PRESS$ | `press`, `press_vec` | <span style="font-size: 0.8em;"> Rasmussen, P. P., Gray, J. R., Glysson, G. D. & Ziegler, A. C. Guidelines and procedures for computing time-series suspended-sediment concentrations and loads from in-stream turbidity-sensor and streamflow data. in U.S. Geological Survey Techniques and Methods book 3, chap. C4 53 (2009)</span> |
36-
| Standard Factorial Error | $SFE$ | `sfe`, `sfe_vec` | <span style="font-size: 0.8em;"> Herschy, R.W. 1978: Accuracy. Chapter 10 In: Herschy, R.W. (ed.) Hydrometry - principles and practices. John Wiley and Sons, Chichester, 511 p.</span> |
37-
38-
: Metrics currently implemented in `tidyhydro` v`r packageVersion("tidyhydro")`
39-
40-
# `avacha` dataset
41-
42-
The package includes the mean daily water discharge values (`obs` in m³/s) measured at the state gauging station Avacha River — Elizovo City (site No. 2090). Alongside the measured water discharge, the mean water discharge in the last 24 hours derived from the [GloFAS-ERA5 v4.0](https://confluence.ecmwf.int/display/CEMS/GloFAS+v4.0) reanalysis is provided (`sim`).
24+
The package includes the mean daily water discharge values (`obs` in m³/s) measured at the state gauging station [Avacha River — Elizovo City](https://www.openstreetmap.org/#map=18/53.183111/158.393269) (site No. 2090). Alongside the measured water discharge, the mean water discharge in the last 24 hours derived from the [GloFAS-ERA5 v4.0](https://confluence.ecmwf.int/display/CEMS/GloFAS+v4.0) reanalysis is provided (`sim`).
4325

4426
```{r}
4527
#| fig-cap: Avacha River - Elizovo City hydrograph

0 commit comments

Comments
 (0)