Skip to content

Commit

Permalink
Update master branch to Pastas 1.5 (#741)
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulcollenteur committed Apr 18, 2024
2 parents b9ef48b + 35a76fe commit 0a5b1d7
Show file tree
Hide file tree
Showing 81 changed files with 1,885 additions and 614 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ jobs:
fail-fast: false
matrix:
include:
- name: Test suite with py38-ubuntu
python: "3.8"
toxenv: py38
experimental: false
- name: Test suite with py39-ubuntu
python: "3.9"
toxenv: py39
Expand Down
129 changes: 129 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Pastas: Analysis of Groundwater Time Series

> [!IMPORTANT]
> As of Pastas 1.5, noisemodels are not added to the Pastas models by default anymore. [Read more about this change here](https://github.com/pastas/pastas/issues/735).
![image](/doc/_static/logo_small.png)
[![image](https://github.com/pastas/pastas/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/pastas/pastas/actions/workflows/ci.yml)
[![image](https://img.shields.io/pypi/v/pastas.svg)](https://pypi.python.org/pypi/pastas)
[![image](https://img.shields.io/pypi/l/pastas.svg)](https://mit-license.org/)
[![image](https://img.shields.io/pypi/pyversions/pastas)](https://pypi.python.org/pypi/pastas)
[![image](https://img.shields.io/pypi/dm/pastas)](https://pypi.org/project/pastas/)
[![image](https://zenodo.org/badge/DOI/10.5281/zenodo.1465866.svg)](https://doi.org/10.5281/zenodo.1465866)
[![image](https://app.codacy.com/project/badge/Grade/952f41c453854064ba0ee1fa0a0b4434)](https://app.codacy.com/gh/pastas/pastas/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
[![image](https://api.codacy.com/project/badge/Coverage/952f41c453854064ba0ee1fa0a0b4434)](https://app.codacy.com/gh/pastas/pastas/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage9)
[![image](https://readthedocs.org/projects/pastas/badge/?version=latest)](https://pastas.readthedocs.io/en/latest/?badge=latest)
[![image](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/pastas/pastas/master?filepath=examples%2Fnotebooks%2F1_basic_model.ipynb)

## Pastas: what is it?

Pastas is an open source python package for processing, simulating and
analyzing groundwater time series. The object oriented structure allows
for the quick implementation of new model components. Time series models
can be created, calibrated, and analysed with just a few lines of python
code with the built-in optimization, visualisation, and statistical
analysis tools.

## Documentation & Examples

- Documentation is provided on the dedicated website
[pastas.dev](http://www.pastas.dev/)
- Examples can be found on the [examples directory on the
documentation
website](https://pastas.readthedocs.io/en/dev/examples/index.html)
- View and edit a working example notebook of a Pastas model in
[MyBinder](https://mybinder.org/v2/gh/pastas/pastas/master?filepath=examples%2Fnotebooks%2F1_basic_model.ipynb)
- A list of publications that use Pastas is available in a [dedicated
Zotero
group](https://www.zotero.org/groups/4846685/pastas/items/32FS5PTW/item-list)

## Get in Touch

- Questions on Pastas can be asked and answered on [Github
Discussions](https://github.com/pastas/pastas/discussions).
- Bugs, feature requests and other improvements can be posted as
[Github Issues](https://github.com/pastas/pastas/issues).
- Pull requests will only be accepted on the development branch (dev)
of this repository. Please take a look at the [developers
section](http://pastas.readthedocs.io/) on the documentation website
for more information on how to contribute to Pastas.

## Quick installation guide

To install Pastas, a working version of Python 3.9, 3.10, 3.11, or 3.12
has to be installed on your computer. We recommend using the [Anaconda
Distribution](https://www.continuum.io/downloads) as it includes most of
the python package dependencies and the Jupyter Notebook software to run
the notebooks. However, you are free to install any Python distribution
you want.

### Stable version

To get the latest stable version, use:

pip install pastas

### Update

To update pastas, use:

pip install pastas --upgrade

### Developers

To get the latest development version, use:

pip install git+https://github.com/pastas/pastas.git@dev#egg=pastas

## Related packages

- [Pastastore](https://github.com/pastas/pastastore) is a Python
package for managing multiple timeseries and pastas models
- [Metran](https://github.com/pastas/metran) is a Python package to
perform multivariate timeseries analysis using a technique called
dynamic factor modelling.
- [Hydropandas](https://github.com/ArtesiaWater/hydropandas/blob/master/examples/03_hydropandas_and_pastas.ipynb)
can be used to obtain Dutch timeseries (KNMI, Dinoloket, ..)
- [PyEt](https://github.com/phydrus/pyet) can be used to compute
potential evaporation from meteorological variables.

## Dependencies

Pastas depends on a number of Python packages, of which all of the
necessary are automatically installed when using the pip install
manager. To summarize, the dependencies necessary for a minimal function
installation of Pastas

- numpy\>=1.7
- matplotlib\>=3.1
- pandas\>=1.1
- scipy\>=1.8
- numba\>=0.51

To install the most important optional dependencies (solver LmFit and
function visualisation Latexify) at the same time with Pastas use:

pip install pastas[full]

or for the development version use:

pip install git+https://github.com/pastas/pastas.git@dev#egg=pastas[full]

## How to Cite Pastas?

If you use Pastas in one of your studies, please cite the Pastas article
in Groundwater:

- Collenteur, R.A., Bakker, M., Caljé, R., Klop, S.A., Schaars, F.
(2019) [Pastas: open source software for the analysis of groundwater
time
series](https://ngwa.onlinelibrary.wiley.com/doi/abs/10.1111/gwat.12925).
Groundwater. doi: 10.1111/gwat.12925.

To cite a specific version of Pastas, you can use the DOI provided for
each official release (\>0.9.7) through Zenodo. Click on the link to get
a specific version and DOI, depending on the Pastas version.

- Collenteur, R., Bakker, M., Caljé, R. & Schaars, F. (XXXX). Pastas:
open-source software for time series analysis in hydrology (Version
X.X.X). Zenodo. <http://doi.org/10.5281/zenodo.1465866>
116 changes: 0 additions & 116 deletions README.rst

This file was deleted.

2 changes: 1 addition & 1 deletion doc/about/courses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ Every now and then (on-site) Pastas courses and workshops are held. Please check
private courses on request. To organize such a workshop please contact one of the following:

- For courses in the Netherlands, please contact Artesia (info[AT]artesia-water.nl)
- For international courses, please contact Raoul Collenteur (Raoul.Collenteur[AT]eawag.ch)
- For international courses, please contact Raoul Collenteur (Raoul.Collenteur[AT]hydroconsult.ch)
1 change: 1 addition & 0 deletions doc/api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ left-hand menu you will find the different categories of the API documentation.
utils
timer.SolveTimer
stats
dataset

.. toctree::
:hidden:
Expand Down
78 changes: 40 additions & 38 deletions doc/benchmarks/armamodel.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion doc/benchmarks/autocorrelation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.10.12"
},
"vscode": {
"interpreter": {
Expand Down
2 changes: 1 addition & 1 deletion doc/benchmarks/check_response_functions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
"version": "3.10.12"
},
"vscode": {
"interpreter": {
Expand Down
12 changes: 6 additions & 6 deletions doc/benchmarks/noisemodel.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"\n",
"$$\\upsilon(t_i) = r(t_i) - r(t_{i-1}) \\text{e}^{-\\Delta t_i / \\alpha}$$\n",
"\n",
"where $\\upsilon$ is the noise, $\\Delta t_i$ the time step between the residuals ($r$), and $\\alpha$ [days] the AR parameter of the model. The model is named `NoiseModel` and can be found in `noisemodel.py`. This is the default noise model that is added to a Pastas model, but it can also be added manually as follows: `ml.add_noisemodel(ps.NoiseModel())`\n",
"where $\\upsilon$ is the noise, $\\Delta t_i$ the time step between the residuals ($r$), and $\\alpha$ [days] the AR parameter of the model. The model is named `NoiseModel` and can be found in `noisemodel.py`. It can be added to a Pastas model as follows: `ml.add_noisemodel(ps.ArNoiseModel())`\n",
"\n",
"## 2. Generate synthetic head time series"
]
Expand Down Expand Up @@ -169,9 +169,9 @@
"ml = ps.Model(head_noise)\n",
"sm = ps.StressModel(rain, ps.Gamma(), name=\"recharge\", settings=\"prec\")\n",
"ml.add_stressmodel(sm)\n",
"ml.add_noisemodel(ps.NoiseModel())\n",
"ml.add_noisemodel(ps.ArNoiseModel())\n",
"\n",
"ml.solve(tmin=\"1991\", tmax=\"2015-06-29\", noise=True, report=False)\n",
"ml.solve(tmin=\"1991\", tmax=\"2015-06-29\", report=False)\n",
"\n",
"# Plot the results\n",
"axes = ml.plots.results(figsize=(10, 5))\n",
Expand Down Expand Up @@ -295,14 +295,14 @@
"ml = ps.Model(head_irregular)\n",
"sm = ps.StressModel(rain, ps.Gamma(cutoff=0.99), name=\"recharge\", settings=\"prec\")\n",
"ml.add_stressmodel(sm)\n",
"ml.add_noisemodel(ps.NoiseModel())\n",
"ml.add_noisemodel(ps.ArNoiseModel())\n",
"\n",
"# ml.set_parameter(\"noise_alpha\", 9.5, vary=False)\n",
"# ml.set_parameter(\"recharge_A\", 800, vary=False)\n",
"# ml.set_parameter(\"recharge_n\", 1.2, vary=False)\n",
"# ml.set_parameter(\"recharge_a\", 200, vary=False)\n",
"\n",
"ml.solve(tmin=\"1991\", tmax=\"2015-06-29\", noise=True, report=False)\n",
"ml.solve(tmin=\"1991\", tmax=\"2015-06-29\", report=False)\n",
"axes = ml.plots.results(figsize=(10, 5))\n",
"axes[-2].plot(ps.Gamma().step([Atrue, ntrue, atrue]))\n",
"\n",
Expand Down Expand Up @@ -376,7 +376,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.10.12"
},
"vscode": {
"interpreter": {
Expand Down
10 changes: 6 additions & 4 deletions doc/benchmarks/pastas_synthetic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@
"ml = ps.Model(head)\n",
"sm = ps.StressModel(rain, ps.Gamma(), name=\"recharge\", settings=\"prec\")\n",
"ml.add_stressmodel(sm)\n",
"ml.solve(noise=False, ftol=1e-8)\n",
"ml.solve(ftol=1e-8)\n",
"ml.plots.results();"
]
},
Expand Down Expand Up @@ -345,9 +345,10 @@
],
"source": [
"ml2 = ps.Model(head_noise)\n",
"ml2.add_noisemodel(ps.ArNoiseModel())\n",
"sm2 = ps.StressModel(rain, ps.Gamma(), name=\"recharge\", settings=\"prec\")\n",
"ml2.add_stressmodel(sm2)\n",
"ml2.solve(noise=True)\n",
"ml2.solve()\n",
"ml2.plots.results();"
]
},
Expand Down Expand Up @@ -465,9 +466,10 @@
],
"source": [
"ml3 = ps.Model(head_noise_corr)\n",
"ml3.add_noisemodel(ps.ArNoiseModel())\n",
"sm3 = ps.StressModel(rain, ps.Gamma(), name=\"recharge\", settings=\"prec\")\n",
"ml3.add_stressmodel(sm3)\n",
"ml3.solve(noise=True)\n",
"ml3.solve()\n",
"ml3.plots.results();"
]
},
Expand Down Expand Up @@ -524,7 +526,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.5"
"version": "3.10.12"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 0a5b1d7

Please sign in to comment.