Skip to content

Commit

Permalink
Indicators as a module (#226)
Browse files Browse the repository at this point in the history
<!-- Please ensure the PR fulfills the following requirements! -->
<!-- If this is your first PR, make sure to add your details to the
AUTHORS.rst! -->
### Pull Request Checklist:
- [x] This PR addresses an already opened issue (for bug fixes /
features)
  - This PR fixes #216 
- [x] (If applicable) Documentation has been added / updated (for bug
fixes / features).
- [x] (If applicable) Tests have been added.
- [x] CHANGELOG.rst has been updated (with summary of main changes).
- [x] Link to issue (:issue:`number`) and pull request (:pull:`number`)
has been added.

### What kind of change does this PR introduce?

* Makes `indicators` into a module. Moves `pmp.py` into it.

### Does this PR introduce a breaking change?

* The PMP functions are now accessed through `xh.indicators.pmp` rather
than `xh.pmp`.

### Other information:
  • Loading branch information
RondeauG authored Nov 6, 2024
2 parents 5900536 + b44041f commit 23eb0f1
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Breaking changes
* The `xhydro` testing utilities now require `pytest-xdist` as a development dependency. (:pull:`212`).
* Many core dependencies have been updated to more modern versions. (:pull:`218`).
* The `delta_type` argument in ``xhydro.cc.sampled_indicators`` has been renamed to `delta_kind` and is no longer positional. (:pull:`220`).
* The ``xhydro.pmp`` module has been moved to ``xhydro.indicators.pmp``. (:pull:`226`).

Internal changes
^^^^^^^^^^^^^^^^
Expand All @@ -31,6 +32,7 @@ Internal changes
* Several tests reliant on online servers and services have been marked as `online` to prevent them from running in contexts where internet access is limited. (:pull:`212`).
* Many function docstrings and type hints have been updated for accuracy and precision. (:pull:`212`).
* The `xHydro` project now has a set of logos for use in documentation, the readme, and other materials. (:pull:`217`).
* ``xhydro.indicators`` is now a package with submodules for different types of indicators. Previous functions have been moved to a `generic` submodule and are imported at the top level for backwards compatibility. (:pull:`226`).

v0.4.0 (2024-10-04)
-------------------
Expand Down
6 changes: 3 additions & 3 deletions docs/notebooks/pmp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"import numpy as np\n",
"import xarray as xr\n",
"\n",
"from xhydro import pmp\n",
"from xhydro.indicators import pmp\n",
"from xhydro.testing.helpers import deveraux"
]
},
Expand Down Expand Up @@ -433,9 +433,9 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.4"
"version": "3.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
"nbformat_minor": 4
}
7 changes: 7 additions & 0 deletions src/xhydro/indicators/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Indicators submodule."""

# Import the submodules
from . import generic, pmp

# Specific top-level functions
from .generic import *
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/test_PMP.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import xarray as xr
from pint.errors import DimensionalityError

from xhydro import pmp
from xhydro.indicators import pmp


class TestPMP:
Expand Down

0 comments on commit 23eb0f1

Please sign in to comment.