Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update groundwater signatures module #636

Merged
merged 30 commits into from
Feb 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
12e7e53
rename baseflow and recession and recovery formulas
raoulcollenteur Mar 20, 2023
1828088
Merge branch 'dev' into signatures
raoulcollenteur Jun 6, 2023
d7a0a06
Update signatures.py
raoulcollenteur Jun 21, 2023
396dc8e
Merge branch 'dev' into signatures
raoulcollenteur Sep 5, 2023
27b4f04
Merge branch 'dev' into signatures
raoulcollenteur Nov 29, 2023
7f1dec9
Merge branch 'dev' into signatures
raoulcollenteur Dec 11, 2023
d9312b2
Fix warnings and tests
raoulcollenteur Dec 11, 2023
ed7784b
Update signatures descriptions and code
raoulcollenteur Dec 11, 2023
481ae8d
black format
raoulcollenteur Dec 11, 2023
168a152
add smooting to high and low pulses
raoulcollenteur Dec 12, 2023
57b91ad
rename autocorrelation to autocorr_time
raoulcollenteur Dec 12, 2023
ec54dd6
Some code optimization
raoulcollenteur Dec 12, 2023
828ab5c
change some defaults for normalize and update notebook
raoulcollenteur Dec 12, 2023
cfba3f3
Date_min_max (#672)
mvremec Dec 13, 2023
69adafe
cv_date_min/max using circular statistics
raoulcollenteur Dec 13, 2023
a59a82c
Update test_signatures.py
raoulcollenteur Dec 13, 2023
6d1464b
Update test_signatures.py
raoulcollenteur Dec 14, 2023
e3e1df6
fix error in recession and recovery constants
raoulcollenteur Jan 3, 2024
6f6dfcb
make summary method available for DataFrames and Series
raoulcollenteur Jan 7, 2024
1a7d693
Add min_event_length to recession constant
raoulcollenteur Jan 8, 2024
36072f2
Update signatures.py
raoulcollenteur Jan 8, 2024
f73f915
apply more pastas-like estimate of recession
raoulcollenteur Jan 10, 2024
267ebe4
reversals return nan if frequency is not daily
raoulcollenteur Jan 29, 2024
c999d90
apply black formatting
raoulcollenteur Jan 29, 2024
f6e5081
Remove richards_baker_index
raoulcollenteur Jan 30, 2024
66ae0b3
update formulas for recession and recovery
raoulcollenteur Jan 31, 2024
8e714c9
Update documentation
raoulcollenteur Jan 31, 2024
3262844
Fix readthedocs issues
raoulcollenteur Jan 31, 2024
2545844
Update signatures.py
raoulcollenteur Jan 31, 2024
d453175
Merge branch 'dev' into signatures
raoulcollenteur Feb 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 19 additions & 30 deletions doc/examples/signatures.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
"source": [
"# Groundwater signatures\n",
"\n",
"*R.A. Collenteur, University of Graz, 2022*\n",
"*R.A. Collenteur, Eawag, 2023*\n",
"\n",
"In this notebook we introduce the **groundwater signatures** module available in Pastas. The signatures methods can be accessed through the `signatures` module in the `pastas.stats` sub-package. This module is partly based on the work from [Heudorfer et al. (2019)](#References) and others (see [References](#References)).\n",
"In this notebook we introduce the **groundwater signatures** module available in Pastas. The signatures methods can be accessed through the `signatures` module in the `pastas.stats` sub-package.\n",
"\n",
"Groundwater signatures characterize different aspects of a groundwater time series, and can be subdivided in different categories: shape, distribution, and structure. Groundwater signatures are also referred to as 'indices' or 'quantitative' metrics. In Pastas, 'signatures' is adopted to avoid any confusion with time indices and goodness-of-fit metrics. \n",
"Groundwater signatures are quantitative metrics that characterize different aspects of a groundwater time series. They are commonly subdivided in different categories: shape, distribution, and structure. Groundwater signatures are also referred to as 'indices' or 'quantitative' metrics. In Pastas, 'signatures' is adopted to avoid any confusion with time indices and goodness-of-fit metrics. \n",
"\n",
"The signatures can be used to *objectively* characterize different groundwater systems, for example distinquishing between fast and slow groundwater systems. The use of signatures is common in other parts of hydrology (e.g., rainfall-runoff modeling) and can be applied in all phases of modeling (see, for example [McMillan, 2020](#References) for an overview). \n",
"The signatures can be used to *objectively* characterize different groundwater systems, for example, distinguishing between fast and slow groundwater systems. The use of signatures is common in other parts of hydrology (e.g., rainfall-runoff modeling) and can be applied in all phases of modeling (see, for example, [McMillan, 2021](#References) for an overview). \n",
"\n",
"<div class=\"alert alert-warning\">\n",
"<b>Note:</b>\n",
"The `signatures` module is still work in progress and needs further verification. Please report any issues and bugs on the Pastas GitHub repository!\n",
"The `signatures` module is under active development and any help is welcome. Please report any issues and bugs on the Pastas GitHub repository!\n",
"</div>"
]
},
Expand Down Expand Up @@ -103,34 +103,21 @@
"source": [
"## 3. Plot the results\n",
"\n",
"Depending on the signature, different ranges of parameters can be expected. We therefore split the signatures in two range for visualization purposes."
"Depending on the signature, different ranges of parameters can be expected. We therefore normalize the signatures values by the mean value of each signature. This way we can easily compare the two groundwater systems."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "63e5dfaa",
"id": "e8fe7d8d-5ae1-4cae-a267-080f5cdcbf75",
"metadata": {},
"outputs": [],
"source": [
"fig = plt.figure(constrained_layout=True, figsize=(10, 4))\n",
"gs = GridSpec(1, 5, figure=fig)\n",
"ax1 = fig.add_subplot(gs[0, :4])\n",
"ax2 = fig.add_subplot(gs[0, 4])\n",
"\n",
"low_values = df.where(df < 2).dropna()\n",
"low_values.plot(ax=ax1)\n",
"ax1.set_xticks(np.arange(len(low_values.index)))\n",
"ax1.set_xticklabels(low_values.index, rotation=90)\n",
"ax1.grid()\n",
"high_values = df.where(df > 2).dropna()\n",
"high_values.plot(ax=ax2)\n",
"ax2.set_xticks(np.arange(len(high_values)))\n",
"ax2.set_xticklabels(high_values.index, rotation=90)\n",
"ax2.grid()\n",
"\n",
"ax1.set_title(\"Low value signatures\")\n",
"ax2.set_title(\"High value signatures\");"
"_, ax = plt.subplots(1,1, figsize=(10, 4))\n",
"df.div(df.mean(axis=1), axis=0).mul(100).plot(ax=ax)\n",
"ax.set_xticks(np.arange(len(df.index)), df.index, rotation=90, )\n",
"ax.set_ylabel(\"% Change from the mean\\n signature value\")\n",
"ax.grid()"
]
},
{
Expand All @@ -141,14 +128,16 @@
},
"source": [
"## 4. Interpretation of signatures\n",
"The different signatures can be used to compare the different systems or characterize a single system. For example, the first head time series has a high bimodality coefficient (>0.7), indicating a bimodel distribution of the data. This makes sense, as this time series is used as an example for the non-linear threshold model (see notebook). Rather than (naively) testing all model structures, this is an example where we can potentially use a groundwater signature to identify a 'best' model structure beforehand.\n",
"\n",
"Another example. The second time series is observed in a much slower groundwater system than the first. This is for example clearly visible and quantified by the different values for the 'pulse_duration', the 'recession and recovery constants', and the 'slope of the duration curves'. We could use this type of information to determine whether we should use a 'fast' or 'slow' response function (e.g., an Exponential or Gamma function). These are just some examples of how groundwater signatures can be used to improve groundwater modeling, more research on this topic is required. Please contact us if interested!\n",
"The different signatures can be used to compare the different systems or characterize a single system. For example, the first head time series has a high bimodality coefficient (>0.7), indicating a bimodal distribution of the data. This makes sense, as this time series is used as an example for the non-linear threshold model (see notebook). Rather than (naively) testing all model structures, this is an example where we can potentially use a groundwater signature to identify a 'best' model structure beforehand.\n",
"\n",
"A little disclaimer: from the plot above it is actually not that straightforward to compare the indices, because the range in values is large. For example, the rise and fall rate visually show no differences, but their numbers vary by over 200%. Thus, interpretation requires some more work. \n",
"Another example. The second time series is observed in a much slower groundwater system than the first. This is, for example, clearly visible and quantified by the different values for the 'pulse_duration', the 'recession and recovery constants', and the 'slope of the duration curves'. We could use this type of information to determine whether we should use a 'fast' or 'slow' response function (e.g., an Exponential or Gamma function). These are just some examples of how groundwater signatures can be used to improve groundwater modeling, more research on this topic is required. Please contact us if interested!\n",
"\n",
"A little disclaimer: from the data above, it is actually not that straightforward to compare the signature values because the range in values is large. For example, the rise and fall rate show small differences in absolute values, but their numbers vary by over 200%. Thus, interpretation requires some more work. \n",
"\n",
"### References\n",
"The following references are helpfull in learning about the groundwater signatures:\n",
"\n",
"The following references are helpful in learning about the groundwater signatures:\n",
"\n",
"- Heudorfer, B., Haaf, E., Stahl, K., Barthel, R., 2019. [Index-based characterization and quantification of groundwater dynamics.](https://agupubs.onlinelibrary.wiley.com/doi/full/10.1029/2018WR024418) Water Resources Research.\n",
"- Haaf, E., Giese, M., Heudorfer, B., Stahl, K., Barthel, R., 2020. [Physiographic and Climatic Controls on Regional Groundwater Dynamics.](https://agupubs.onlinelibrary.wiley.com/doi/10.1029/2019WR026545) Water Resources Research.\n",
Expand All @@ -173,7 +162,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
"version": "3.11.3"
},
"vscode": {
"interpreter": {
Expand Down
Loading
Loading