Skip to content

Commit 472d2e1

Browse files
Merge pull request #75 from sgfsweden/dev
release v0.3.0
2 parents ddabd84 + eae5131 commit 472d2e1

21 files changed

+1324
-797
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<p>
88
<a href="https://pypi.org/project/gwrefpy/"><img src="https://img.shields.io/pypi/v/gwrefpy.svg" alt="PyPI version"></a>
99
<a href="https://pypi.org/project/gwrefpy/"><img src="https://img.shields.io/pypi/pyversions/gwrefpy.svg" alt="Python versions"></a>
10-
<a href="https://github.com/andersretznersgu/gwrefpy/blob/main/LICENSE"><img src="https://img.shields.io/github/license/andersretznersgu/gwrefpy.svg" alt="License"></a>
11-
<a href="https://andersretznersgu.github.io/gwrefpy/"><img src="https://img.shields.io/badge/docs-latest-brightgreen.svg" alt="Documentation"></a>
12-
<a href="https://github.com/andersretznersgu/gwrefpy/actions"><img src="https://img.shields.io/github/actions/workflow/status/andersretznersgu/gwrefpy/ci.yml?branch=main" alt="Build status"></a>
10+
<a href="https://github.com/sgfsweden/gwrefpy/blob/main/LICENSE"><img src="https://img.shields.io/github/license/andersretznersgu/gwrefpy.svg" alt="License"></a>
11+
<a href="https://sgfsweden.github.io/gwrefpy/"><img src="https://img.shields.io/badge/docs-latest-brightgreen.svg" alt="Documentation"></a>
12+
<a href="https://github.com/sgfsweden/gwrefpy/actions"><img src="https://img.shields.io/github/actions/workflow/status/sgfsweden/gwrefpy/.github/workflows/publish_on_pypi.yml?branch=main" alt="Build status"></a>
1313
<a href="https://github.com/astral-sh/ruff"><img src="https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json" alt="Ruff"></a>
14-
<a href="https://github.com/andersretznersgu/gwrefpy"><img src="https://img.shields.io/github/stars/andersretznersgu/gwrefpy?style=social" alt="GitHub stars"></a>
14+
<a href="https://github.com/sgfsweden/gwrefpy"><img src="https://img.shields.io/github/stars/sgfsweden/gwrefpy?style=social" alt="GitHub stars"></a>
1515
</p>
1616

1717
A Python implementation of the Akvifär reference method for detecting deviations in groundwater level time series.

docs/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
project = "gwrefpy"
1515
copyright = ""
1616
author = ""
17-
release = "0.2.0"
17+
release = "0.3.0"
1818

1919
# -- General configuration ---------------------------------------------------
2020
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -50,6 +50,7 @@
5050
html_theme = "pydata_sphinx_theme"
5151
html_title = "gwrefpy"
5252
html_logo = "_static/figures/logo.png"
53+
html_favicon = "_static/figures/logo.png"
5354
html_theme_options = {
5455
"navbar_align": "content",
5556
"icon_links": [

docs/tutorials/exercises/1_exercise1.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"\n",
99
"This notebook introduces how to create and fit a simple `gwrefpy` model. \n",
1010
"\n",
11-
"This notebook can be downloaded from the source code [here](https://github.com/andersretznerSGU/gwrefpy/blob/main/docs/tutorial/exercises/1_exerciese1.ipynb).\n",
11+
"This notebook can be downloaded from the source code [here](https://github.com/andersretznerSGU/gwrefpy/blob/main/docs/tutorials/exercises/1_exercise1.ipynb).\n",
1212
"\n",
1313
"In this exercise, you will:\n",
1414
"1. Import the `gwrefpy` package (already done for you)\n",

docs/tutorials/exercises/2_exercise2.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"\n",
99
"This notebook introduces how to use the best fit method for a large `gwrefpy` model. \n",
1010
"\n",
11-
"This notebook can be downloaded from the source code [here](https://github.com/andersretznerSGU/gwrefpy/blob/main/docs/tutorial/exercises/1_exerciese1.ipynb).\n",
11+
"This notebook can be downloaded from the source code [here](https://github.com/andersretznerSGU/gwrefpy/blob/main/docs/tutorials/exercises/2_exercise2.ipynb).\n",
1212
"\n",
1313
"In this exercise, you will:\n",
1414
"1. Import the `gwrefpy` package and load the model (already done for you)\n",

docs/tutorials/exercises/3_exercise3.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"\n",
99
"This notebook introduces how to create and fit a simple `gwrefpy` model. \n",
1010
"\n",
11-
"This notebook can be downloaded from the source code [here](https://github.com/andersretznerSGU/gwrefpy/blob/main/docs/tutorial/exercises/1_exerciese1.ipynb).\n",
11+
"This notebook can be downloaded from the source code [here](https://github.com/andersretznerSGU/gwrefpy/blob/main/docs/tutorials/exercises/3_exercise3.ipynb).\n",
1212
"\n",
1313
"```{warning}\n",
1414
"This exercise is not completed yet.\n",

docs/tutorials/livedata.ipynb

Lines changed: 98 additions & 87 deletions
Large diffs are not rendered by default.

docs/user_guide/2_fitting_wells.ipynb

Lines changed: 393 additions & 173 deletions
Large diffs are not rendered by default.

docs/user_guide/4_plotting.ipynb

Lines changed: 97 additions & 120 deletions
Large diffs are not rendered by default.

docs/user_guide/5_io.ipynb

Lines changed: 74 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,51 @@
11
{
22
"cells": [
33
{
4-
"metadata": {},
54
"cell_type": "markdown",
5+
"id": "f8ebfe5589158bd0",
6+
"metadata": {},
67
"source": [
78
"# Saving and loading models\n",
89
"\n",
910
"This notebook introduces the concept of saving and loading `.gwref` files.\n",
1011
"\n",
1112
"This notebook can be downloaded from the source code [here](https://github.com/andersretznerSGU/gwrefpy/blob/main/docs/user_guide/5_io.ipynb).\n",
1213
"\n",
13-
"# Saving a model 💾\n",
14+
"## Saving a model 💾\n",
1415
"\n",
1516
"You can save a `gwrefpy` model to a `.gwref` file using the `save_project` function of the `Model` class. This function saves the model, including all wells and fits, to a specified file."
16-
],
17-
"id": "f8ebfe5589158bd0"
17+
]
1818
},
1919
{
20-
"metadata": {},
2120
"cell_type": "markdown",
22-
"source": "We will first create a simple model with one observed well and one reference well.",
23-
"id": "a7d320daa081a770"
21+
"id": "a7d320daa081a770",
22+
"metadata": {},
23+
"source": [
24+
"We will first create a simple model with one observed well and one reference well."
25+
]
2426
},
2527
{
26-
"metadata": {
27-
"ExecuteTime": {
28-
"end_time": "2025-09-19T06:19:23.202275Z",
29-
"start_time": "2025-09-19T06:19:21.423475Z"
30-
}
31-
},
3228
"cell_type": "code",
29+
"execution_count": 1,
30+
"id": "ae7b6686cad2a72f",
31+
"metadata": {},
32+
"outputs": [],
3333
"source": [
3434
"import gwrefpy as gr\n",
3535
"import numpy as np\n",
3636
"import pandas as pd"
37-
],
38-
"id": "ae7b6686cad2a72f",
39-
"outputs": [],
40-
"execution_count": 3
37+
]
4138
},
4239
{
40+
"cell_type": "code",
41+
"execution_count": 2,
42+
"id": "e9337241bbe35e1a",
4343
"metadata": {
4444
"tags": [
4545
"hide-input"
46-
],
47-
"ExecuteTime": {
48-
"end_time": "2025-09-19T06:19:23.878Z",
49-
"start_time": "2025-09-19T06:19:23.865523Z"
50-
}
46+
]
5147
},
52-
"cell_type": "code",
48+
"outputs": [],
5349
"source": [
5450
"# Create some example data\n",
5551
"n_days = 100\n",
@@ -68,19 +64,14 @@
6864
" + np.random.normal(0, 0.05, n_days)\n",
6965
")\n",
7066
"values_ref1 = pd.Series(values_ref1, index=dates)"
71-
],
72-
"id": "e9337241bbe35e1a",
73-
"outputs": [],
74-
"execution_count": 4
67+
]
7568
},
7669
{
77-
"metadata": {
78-
"ExecuteTime": {
79-
"end_time": "2025-09-19T06:19:25.524811Z",
80-
"start_time": "2025-09-19T06:19:25.522288Z"
81-
}
82-
},
8370
"cell_type": "code",
71+
"execution_count": 3,
72+
"id": "dd1b89e7b780e90d",
73+
"metadata": {},
74+
"outputs": [],
8475
"source": [
8576
"# Creat the observed and reference wells\n",
8677
"obs1 = gr.Well(name=\"Obs. well\", is_reference=False)\n",
@@ -92,171 +83,150 @@
9283
"model1 = gr.Model(name=\"IO Model\")\n",
9384
"model1.add_well(obs1)\n",
9485
"model1.add_well(ref1)"
95-
],
96-
"id": "dd1b89e7b780e90d",
97-
"outputs": [],
98-
"execution_count": 5
86+
]
9987
},
10088
{
101-
"metadata": {},
10289
"cell_type": "markdown",
90+
"id": "3f437ef415865dca",
91+
"metadata": {},
10392
"source": [
10493
"We can now save the model to a `.gwref` file using the `save_project` function.\n",
10594
"```{note}\n",
10695
"The funciton will create the file in the current working directory if no path is specified.\n",
10796
"```"
108-
],
109-
"id": "3f437ef415865dca"
97+
]
11098
},
11199
{
112-
"metadata": {
113-
"ExecuteTime": {
114-
"end_time": "2025-09-19T06:21:35.698499Z",
115-
"start_time": "2025-09-19T06:21:35.680754Z"
116-
}
117-
},
118100
"cell_type": "code",
119-
"source": [
120-
"# Save the model to a .gwref file\n",
121-
"model1.save_project(\"my_model.gwref\")"
122-
],
101+
"execution_count": 4,
123102
"id": "cff5a365dc580981",
103+
"metadata": {},
124104
"outputs": [
125105
{
126106
"name": "stdout",
127107
"output_type": "stream",
128108
"text": [
129-
"Model 'Logging Example Model' saved to 'example_model.gwref'.\n"
109+
"Model 'IO Model' saved to 'my_model.gwref'.\n"
130110
]
131111
}
132112
],
133-
"execution_count": 9
113+
"source": [
114+
"# Save the model to a .gwref file\n",
115+
"model1.save_project(\"my_model.gwref\")"
116+
]
134117
},
135118
{
136-
"metadata": {},
137119
"cell_type": "markdown",
120+
"id": "d2a3d40fe6011460",
121+
"metadata": {},
138122
"source": [
139123
"You can now find the `my_model.gwref` files in your working directory. You can also give a path with the filename and the fild will be saved to that path, e.g. `\"path//to//folder//my_model.gwref\"`. \n",
140124
"```{warning}\n",
141125
"If the file already exists, a warning will be logged and the file will not be overwritten. You can set the ``overwrite`` variable to `True` to overwrite the existing file.\n",
142126
"\n",
143127
"The funciton will not create any folders in the specified path if they do not exist.\n",
144128
"```"
145-
],
146-
"id": "d2a3d40fe6011460"
129+
]
147130
},
148131
{
149-
"metadata": {
150-
"ExecuteTime": {
151-
"end_time": "2025-09-19T06:21:50.470844Z",
152-
"start_time": "2025-09-19T06:21:50.464055Z"
153-
}
154-
},
155132
"cell_type": "code",
156-
"source": [
157-
"# Save the model to a .gwref file, allowing overwriting\n",
158-
"model1.save_project(\"my_model.gwref\") # This will not overwrite the existing file and a warning will be logged\n",
159-
"model1.save_project(\"my_model.gwref\", overwrite=True) # This will overwrite the existing file"
160-
],
133+
"execution_count": 5,
161134
"id": "8927630e5d539af5",
135+
"metadata": {},
162136
"outputs": [
163137
{
164138
"name": "stdout",
165139
"output_type": "stream",
166140
"text": [
167-
"The file 'example_model.gwref' already exists. To overwrite the existing file set the argument 'overwrite' to True.\n",
168-
"Model 'Logging Example Model' saved to 'example_model.gwref'.\n"
141+
"The file 'my_model.gwref' already exists. To overwrite the existing file set the argument 'overwrite' to True.\n",
142+
"Model 'IO Model' saved to 'my_model.gwref'.\n"
169143
]
170144
}
171145
],
172-
"execution_count": 10
146+
"source": [
147+
"# Save the model to a .gwref file, allowing overwriting\n",
148+
"model1.save_project(\"my_model.gwref\") # This will not overwrite the existing file and a warning will be logged\n",
149+
"model1.save_project(\"my_model.gwref\", overwrite=True) # This will overwrite the existing file"
150+
]
173151
},
174152
{
175-
"metadata": {},
176153
"cell_type": "markdown",
154+
"id": "ab0429e99fb8f13e",
155+
"metadata": {},
177156
"source": [
178157
"## Loading Models 📦\n",
179158
"You can load a model from a `.gwref` file using the `open_project` function from the `Model` class. This function reads the model from the specified file and saves it to the `Model` object. The model will include all wells and fits that were saved in the file.\n",
180159
"\n",
181160
"There are two ways to load a model:\n",
182161
"1. Create a new `Model` object and use the `open_project` method.\n",
183162
"2. Specify the `.gwref` file directly when creating a new `Model` object."
184-
],
185-
"id": "ab0429e99fb8f13e"
163+
]
186164
},
187165
{
188-
"metadata": {
189-
"ExecuteTime": {
190-
"end_time": "2025-09-18T11:56:24.801814Z",
191-
"start_time": "2025-09-18T11:56:24.769652Z"
192-
}
193-
},
194166
"cell_type": "code",
195-
"source": [
196-
"# Method 1: Create a new Model object and load the project\n",
197-
"loaded_model1 = gr.Model(name=\"Name will be overwritten\")\n",
198-
"loaded_model1.open_project(\"my_model.gwref\")"
199-
],
167+
"execution_count": 6,
200168
"id": "30f2208061681fe",
169+
"metadata": {},
201170
"outputs": [
202171
{
203172
"name": "stdout",
204173
"output_type": "stream",
205174
"text": [
206-
"Model 'Logging Example Model' loaded from 'example_model.gwref'.\n"
175+
"Model 'IO Model' loaded from 'my_model.gwref'.\n"
207176
]
208177
}
209178
],
210-
"execution_count": 3
179+
"source": [
180+
"# Method 1: Create a new Model object and load the project\n",
181+
"loaded_model1 = gr.Model(name=\"Name will be overwritten\")\n",
182+
"loaded_model1.open_project(\"my_model.gwref\")"
183+
]
211184
},
212185
{
213-
"metadata": {
214-
"ExecuteTime": {
215-
"end_time": "2025-09-18T11:56:24.887100Z",
216-
"start_time": "2025-09-18T11:56:24.877035Z"
217-
}
218-
},
219186
"cell_type": "code",
220-
"source": [
221-
"# Method 2: Directly load the project into a new Model object\n",
222-
"loaded_model2 = gr.Model(\"my_model.gwref\")"
223-
],
187+
"execution_count": 7,
224188
"id": "5b2b524c40b0d03",
189+
"metadata": {},
225190
"outputs": [
226191
{
227192
"name": "stdout",
228193
"output_type": "stream",
229194
"text": [
230-
"Model 'Logging Example Model' loaded from 'example_model.gwref'.\n"
195+
"Model 'IO Model' loaded from 'my_model.gwref'.\n"
231196
]
232197
}
233198
],
234-
"execution_count": 4
199+
"source": [
200+
"# Method 2: Directly load the project into a new Model object\n",
201+
"loaded_model2 = gr.Model(\"my_model.gwref\")"
202+
]
235203
},
236204
{
237-
"metadata": {},
238205
"cell_type": "markdown",
239-
"source": "This concludes this notebook on saving and loading models in `gwrefpy`.",
240-
"id": "e30b422c68de2ecf"
206+
"id": "e30b422c68de2ecf",
207+
"metadata": {},
208+
"source": [
209+
"This concludes this notebook on saving and loading models in `gwrefpy`."
210+
]
241211
}
242212
],
243213
"metadata": {
244214
"kernelspec": {
245-
"display_name": "Python 3",
215+
"display_name": "Python 3 (ipykernel)",
246216
"language": "python",
247217
"name": "python3"
248218
},
249219
"language_info": {
250220
"codemirror_mode": {
251221
"name": "ipython",
252-
"version": 2
222+
"version": 3
253223
},
254224
"file_extension": ".py",
255225
"mimetype": "text/x-python",
256226
"name": "python",
257227
"nbconvert_exporter": "python",
258-
"pygments_lexer": "ipython2",
259-
"version": "2.7.6"
228+
"pygments_lexer": "ipython3",
229+
"version": "3.11.2"
260230
}
261231
},
262232
"nbformat": 4,

0 commit comments

Comments
 (0)