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 hydrotools.metrics to newer Python versions #261

Merged
merged 9 commits into from
Nov 19, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/run_metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
python-version: ["3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand Down
29 changes: 7 additions & 22 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
Licensed under the Apache License, Version 2.0 (the “License”);
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
express or implied.

See the License for the specific language governing permission and
limitations under the License.

- - - - - - - - - - - - - -

“Software code created by U.S. Government employees is not subject to copyright in the
United States (17 U.S.C. §105). The United States/Department of Commerce reserves all
rights to seek and obtain copyright protection in countries other than the United States
for Software authored in its entirety by the Department of Commerce. To this end, the
Department of Commerce hereby grants to Recipient a royalty-free, nonexclusive license
to use, copy, and create derivative works of the Software outside of the United States.”
“Software code created by U.S. Government employees is not subject to copyright
in the United States (17 U.S.C. §105). The United States/Department of Commerce
reserve all rights to seek and obtain copyright protection in countries other
than the United States for Software authored in its entirety by the Department
of Commerce. To this end, the Department of Commerce hereby grants to Recipient
a royalty-free, nonexclusive license to use, copy, and create derivative works
of the Software outside of the United States.”
44 changes: 39 additions & 5 deletions python/metrics/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
[build-system]
requires = [
"setuptools>=42",
"wheel",
"pip"
]
requires = ["setuptools>=70"]
build-backend = "setuptools.build_meta"

[project]
name = "hydrotools.metrics"
authors = [
{name = "Jason A. Regina", email = "[email protected]"},
]
description = "Variety of standard model evaluation metrics."
readme = "README.md"
requires-python = ">=3.9"
license = {file = "LICENSE"}
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Education",
"Intended Audience :: Science/Research",
"License :: Free To Use But Restricted",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Hydrology",
"Operating System :: OS Independent"
]
dependencies = [
"numpy>=1.20.0",
"pandas",
]
dynamic = ["version"]

[tool.setuptools.dynamic]
version = {attr = "hydrotools.metrics._version.__version__"}

[project.optional-dependencies]
develop = ["pytest"]

[project.urls]
Homepage = "https://github.com/NOAA-OWP/hydrotools"
Documentation = "https://noaa-owp.github.io/hydrotools/hydrotools.metrics.html"
Repository = "https://github.com/NOAA-OWP/hydrotools/tree/main/python/metrics"
"Bug Tracker" = "https://github.com/NOAA-OWP/hydrotools/issues"
44 changes: 0 additions & 44 deletions python/metrics/setup.cfg

This file was deleted.

2 changes: 1 addition & 1 deletion python/metrics/src/hydrotools/metrics/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.3"
__version__ = "1.3.5"
4 changes: 2 additions & 2 deletions python/metrics/src/hydrotools/metrics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def mean_error(
power: float = 1.0,
root: bool = False
) -> float:
"""Compute the mean error or deviation. Default is Mean Absolute Error. The mean error
r"""Compute the mean error or deviation. Default is Mean Absolute Error. The mean error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the first time i've seen a docstring defined as a raw string literal. I assume this avoids character escaping headaches in the latex expressions?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the expressions were raising DeprecationWarnings and this was the easiest solution.

is given by:

$$ME = \frac{1}{n}\sum_{i=1}^{n}\left| y_{s,i} - y_{o,i} \right|^{p}$$
Expand Down Expand Up @@ -102,7 +102,7 @@ def mean_error_skill_score(
power: float = 1.0,
normalized: bool = False
) -> float:
"""Compute a generic mean error based model skill score. The mean error skill score
r"""Compute a generic mean error based model skill score. The mean error skill score
is given by:

$$MESS = 1 - \frac{\sum_{i=1}^{n}\left| y_{p,i} - y_{o,i} \right|^{p}}{\sum_{i=1}^{n}\left| y_{b,i} - y_{o,i} \right|^{p}}$$
Expand Down
Loading