Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,7 @@ wheels/
CLAUDE.md

# documentation builds
docs/_build/
docs/_build/

# notebook checkpoints
docs/user_guide/.ipynb_checkpoints/
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ A Python package for detection of deviations in groundwater time series.

## Features

- Manage reference and observation wells with ease
- Programmatically fit observation wells to reference wells
- Visualize fits and deviations
- Save your work, share and pick up later with a custom `.gwref` file format
- More to come...
- Review statistics on fits and deviations

## Installation

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
project = "gwrefpy"
copyright = ""
author = ""
release = "0.4.0"
release = "0.4.1"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
Expand Down
45 changes: 5 additions & 40 deletions docs/user_guide/8_using_sgu_wells.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,7 @@
"cell_type": "markdown",
"id": "0f0cc3fb-4041-4c96-a87e-c6464a51a4d3",
"metadata": {},
"source": [
"# Using SGU wells\n",
"\n",
"This notebook demonstrates the use of the python package `sgu-client` and how to integrate with `gwrefpy`. The package is installed along with `gwrefpy` if recommened add-ons are included: `pip install \"gwrefpy[recommended]\"`\n",
"\n",
"The Geological Survey of Sweden (SGU) serves an API for their groundwater monitoring network. A Python implementation of an API client has been developed in [`sgu-client`](https://github.com/officialankan/sgu-client) which makes getting observed groundwater levels from SGU into Python a breeze. \n",
"\n",
"\n",
"\n",
"```{note}\n",
"The `sgu-client` package is not affiliated with, supported or endorsed by SGU.\n",
"```"
]
"source": "# Using SGU wells\n\nThis notebook demonstrates the use of the python package `sgu-client` and how to integrate with `gwrefpy`. The package is installed along with `gwrefpy` if recommended add-ons are included: `pip install \"gwrefpy[recommended]\"`\n\nThe Geological Survey of Sweden (SGU) serves an API for their groundwater monitoring network. A Python implementation of an API client has been developed in [`sgu-client`](https://github.com/officialankan/sgu-client) which makes getting observed groundwater levels from SGU into Python a breeze. \n\n\n\n```{note}\nThe `sgu-client` package is not affiliated with, supported or endorsed by SGU.\n```"
},
{
"cell_type": "code",
Expand Down Expand Up @@ -45,16 +33,7 @@
"cell_type": "markdown",
"id": "fed96e2d-5a13-4522-a9ce-9274f1fa30d7",
"metadata": {},
"source": [
"## Getting observed groundwater levels\n",
"\n",
"This basic example will show how to fetch observed groundwater levels. For more options, please refer to [these docs](https://github.com/officialankan/sgu-client?tab=readme-ov-file#observed-groundwater-levels).\n",
"\n",
"Below, we wrangle the data in two steps:\n",
"\n",
"1. remove the UTC timezone from the fetched timeseries to achieve compatability with the example model we will load later,\n",
"2. resample to daily medians to align the frequency with that of the example model we will load later"
]
"source": "## Getting observed groundwater levels\n\nThis basic example will show how to fetch observed groundwater levels. For more options, please refer to [these docs](https://github.com/officialankan/sgu-client?tab=readme-ov-file#observed-groundwater-levels).\n\nBelow, we wrangle the data in two steps:\n\n1. remove the UTC timezone from the fetched timeseries to achieve compatibility with the example model we will load later,\n2. resample to daily medians to align the frequency with that of the example model we will load later"
},
{
"cell_type": "code",
Expand Down Expand Up @@ -330,19 +309,7 @@
"cell_type": "markdown",
"id": "1ba49a2e-e227-4558-82a0-7e8489a3695c",
"metadata": {},
"source": [
"## Fitting to modeled groundwater levels\n",
"\n",
"SGU serves an API for accessing modeled groundwater levels. Let's explore how we can integrate it with `gwrefpy`. \n",
"\n",
"More examples on fetching modeled groundwater levels can be found [here](https://github.com/officialankan/sgu-client?tab=readme-ov-file#modeled-groundwater-levels).\n",
"\n",
"Below, we first get the metadata for the monitoring well *4_3* to retrieve its coordinates. We use that to get modeled groundwater levels at the site. Lastly, we get the observed levels which we will need for the fitting.\n",
"\n",
"```{note}\n",
"The example below assumes we are interested in modeled **minor resources** (i.e. shallow or fast responding groundwater systems). To use this in production, the user should make sure to now the modeling workflow and the associated uncertainties related to SGUs modeled groundwater levels.\n",
"```"
]
"source": "## Fitting to modeled groundwater levels\n\nSGU serves an API for accessing modeled groundwater levels. Let's explore how we can integrate it with `gwrefpy`. \n\nMore examples on fetching modeled groundwater levels can be found [here](https://github.com/officialankan/sgu-client?tab=readme-ov-file#modeled-groundwater-levels).\n\nBelow, we first get the metadata for the monitoring well *4_3* to retrieve its coordinates. We use that to get modeled groundwater levels at the site. Lastly, we get the observed levels which we will need for the fitting.\n\n```{note}\nThe example below assumes we are interested in modeled **minor resources** (i.e. shallow or fast responding groundwater systems). For real-world applications, users should familiarize themselves with SGU's modeling methodology and the associated uncertainties of the modeled groundwater levels.\n```"
},
{
"cell_type": "code",
Expand Down Expand Up @@ -370,9 +337,7 @@
"cell_type": "markdown",
"id": "ee8d43a6-4869-48a1-b85b-529a1182bd4c",
"metadata": {},
"source": [
"Below, we create a model and add the observed levels as a observation well and the modeled levels as a reference well."
]
"source": "Below, we create a model and add the observed levels as an observation well and the modeled levels as a reference well."
},
{
"cell_type": "code",
Expand Down Expand Up @@ -660,4 +625,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "gwrefpy"
version = "0.4.0"
description = "A python implementation of the Akvifär reference method for detecting deviations in groundwater level time series."
version = "0.4.1"
description = "A Python package for detection of deviations in groundwater time series."
readme = "README.md"
license = "MIT"
authors = [
Expand Down Expand Up @@ -39,6 +39,7 @@ dev = [
"sphinx-autobuild",
"myst-nb>=1.3.0",
"sphinx-design>=0.6.1",
"sgu-client"
]
recommended = ["notebook", "sgu-client"]

Expand Down
2 changes: 1 addition & 1 deletion src/gwrefpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
__name__ = "gwrefpy"
__version__ = "0.4.0"
__version__ = "0.4.1"

from .constants import print_constants
from .methods.timeseries import analyze_offsets
Expand Down
11 changes: 9 additions & 2 deletions src/gwrefpy/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,8 +905,15 @@ def _plot_settings(self, ax, num):
# Skip custom styling, use matplotlib defaults
pass

# limit x axis to data range
ax.set_xlim(left=self._xmin, right=self._xmax)
# limit x axis to data range if not tmax or tmin provided
if self._plot_tmax:
ax.set_xlim(right=pd.Timestamp(self._plot_tmax))
else:
ax.set_xlim(right=self._xmax)
if self._plot_tmin:
ax.set_xlim(left=pd.Timestamp(self._plot_tmin))
else:
ax.set_xlim(left=self._xmin)

# Apply custom formatting only if plot_style is not None
if self._plot_style is not None:
Expand Down
8 changes: 3 additions & 5 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading