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
4 changes: 3 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Short Description
Add a short description describing the pull request (PR) here.

# Checklist before PR can be merged:
## Checklist before PR can be merged:
- [ ] closes issue #xxxx
- [ ] is documented
- [ ] Format code with [Black formatting](https://black.readthedocs.io)
- [ ] type hints for functions and methods
- [ ] tests added / passed
- [ ] Example Notebook (for new features)
- [ ] Remove output for all notebooks with changes

## Make sure to choose the "dev-branch" to merge your PR into.
24 changes: 14 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@
copyright = "{}, M. Vremec, R.A. Collenteur".format(year)
author = "M. Vremec, R.A. Collenteur"

# The full version, including alpha/beta/rc tags
release = "2020"

# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
Expand Down Expand Up @@ -106,8 +103,8 @@ class MyReferenceStyle(AuthorYearReferenceStyle):

source_suffix = ".rst"

# The master toctree document.
master_doc = "index"
# The root toctree document.
root_doc = "index"

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand All @@ -125,18 +122,24 @@ class MyReferenceStyle(AuthorYearReferenceStyle):
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ["_static"]
html_logo = "_static/logo.png"
html_use_smartypants = True
html_show_sourcelink = True

html_context = {
"github_user": "pyet-org",
"github_repo": "pyet",
"github_version": "master",
"doc_path": "docs",
}

html_theme_options = {
"use_edit_page_button": True,
"header_links_before_dropdown": 6,
"icon_links": [
{
"name": "GitHub", # Label for this link
"url": "https://github.com/pyet-org/pyet", # required
"icon": "fab fa-github-square",
"type": "fontawesome", # Default is fontawesome
"name": "GitHub",
"url": "https://github.com/pyet-org/pyet",
"icon": "fa-brands fa-square-github",
"type": "fontawesome",
}
],
}
Expand All @@ -156,6 +159,7 @@ class MyReferenceStyle(AuthorYearReferenceStyle):

nb_execution_allow_errors = True # Allow errors in notebooks, to see the error online
nb_execution_mode = "auto"
nb_execution_timeout = 300 # seconds

# Enable specific MyST extensions, such as "dollarmath" for math rendering
myst_enable_extensions = [
Expand Down
16 changes: 12 additions & 4 deletions pyet/meteo_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
"""The meteo_utils module contains utility functions for meteorological data.

"""
"""The meteo_utils module contains utility functions for meteorological data."""

from numpy import arccos, clip, cos, exp, isnan, log, nanmax, pi, sin, tan, where
from pandas import Series, to_numeric
Expand Down Expand Up @@ -263,7 +261,17 @@ def calc_ea(tmean=None, tmax=None, tmin=None, rhmax=None, rhmin=None, rh=None, e
es = calc_es(tmax=tmax, tmin=tmin)
else:
es = calc_e0(tmean)
return rh / 100 * es
if rh is None:
if tmin is not None:
ea = calc_e0(tmin) # assuming Tdew close to Tmin, Allen 1998
else:
raise ValueError(
"calc_ea requires either `rh` or `tmin` when `ea` is not "
"provided and `rhmax` is not used."
)
else:
ea = rh / 100 * es
return ea


def day_of_year(tindex):
Expand Down
8 changes: 4 additions & 4 deletions pyet/radiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def jensen_haise(tmean, rs=None, cr=0.025, tx=-3, lat=None, method=0, clip_zero=
if lat is None:
raise Exception("If you choose method == 1, provide lat!")
index = get_index(tmean)
ra = extraterrestrial_r(index, lat, tmean)
ra = extraterrestrial_r(index, lat)
pet = ra * (tmean + 5) / 68 / lambd
else:
raise Exception("Method can be either 0 or 1.")
Expand Down Expand Up @@ -168,7 +168,7 @@ def hargreaves(tmean, tmax, tmin, lat, k=0.0135, method=0, clip_zero=True):
lat: float/xarray.DataArray
the site latitude [rad].
k: float, optional
calirbation coefficient [-].
calibration coefficient [-].
method: float, optional
0 => after :cite:t:`jensen_evaporation_2016`
1 => after :cite:t:`mcmahon_estimating_2013`.
Expand Down Expand Up @@ -208,10 +208,10 @@ def hargreaves(tmean, tmax, tmin, lat, k=0.0135, method=0, clip_zero=True):
ra = ra.values[:, None, None]
else:
ra = ra.values
chs = 0.00185 * (tmax - tmin) ** 2 - 0.0433 * (tmax - tmin) + 0.4023
if method == 0:
pet = k / 0.0135 * 0.0023 * (tmean + 17.8) * sqrt(tmax - tmin) * ra / lambd
elif method == 1:
chs = 0.00185 * (tmax - tmin) ** 2 - 0.0433 * (tmax - tmin) + 0.4023
pet = k * chs * sqrt(tmax - tmin) * ra / lambd * (tmean + 17.8)
else:
raise Exception("Method can be either 0 or 1.")
Expand Down Expand Up @@ -329,7 +329,7 @@ def makkink(tmean, rs, pressure=None, elevation=None, k=0.65, clip_zero=True):
elevation: float/xarray.DataArray, optional
the site elevation [m].
k: float, optional
calirbation coefficient [-].
calibration coefficient [-].
clip_zero: bool, optional
if True, replace all negative values with 0.

Expand Down
2 changes: 1 addition & 1 deletion pyet/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# This is the only location where the version will be written and changed.
# Based on https://packaging.python.org/single_source_version/
__version__ = "1.4.0"
__version__ = "1.5.0"
25 changes: 12 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ authors = [
license = { file = "LICENSE" }
requires-python = ">=3.10"
dependencies = [
"numpy >= 1.16",
"xarray >= 0.18.0",
"pandas >= 2.1",
"numpy >= 1.24",
"xarray >= 2024.06",
"pandas >= 2.1,<3.0",
]
classifiers = [
'Development Status :: 5 - Production/Stable',
Expand All @@ -31,12 +31,12 @@ classifiers = [
]

[project.urls]
Source = "https://github.com/phydrus/pyet"
Tracker = "https://github.com/phydrus/pyet/issues"
Help = "https://github.com/phydrus/pyet/discussions"
homepage = "https://github.com/phydrus/pyet"
repository = "https://github.com/phydrus/pyet"
documentation = "https://github.com/phydrus/pyet/discussions"
Source = "https://github.com/pyet-org/pyet"
Tracker = "https://github.com/pyet-org/pyet/issues"
Help = "https://github.com/pyet-org/pyet/discussions"
homepage = "https://github.com/pyet-org/pyet"
repository = "https://github.com/pyet-org/pyet"
documentation = "https://pyet.readthedocs.io"

[tool.setuptools.dynamic]
version = { attr = "pyet.version.__version__" }
Expand All @@ -53,11 +53,10 @@ testpaths = ["tests"]
[project.optional-dependencies]
rtd = [
"sphinx-autodoc-typehints",
"Ipython",
"ipython",
"ipykernel",
"pydata-sphinx-theme",
"sphinx-gallery",
"sphinx>=3.1",
"sphinx>=7.0",
"sphinxcontrib-bibtex",
"matplotlib",
"myst-nb",
Expand All @@ -69,4 +68,4 @@ rtd = [
"scipy",
"spotpy",
"openpyxl"
]
]
2 changes: 1 addition & 1 deletion tests/testfao56.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def test_extraterrestrial_r(self):

def test_daylight_hours(self):
# Based on Example 9, p. 47 FAO.
dayhours = et.daylight_hours(DatetimeIndex(["2015-09-03"]), -0.35)
dayhours = et.daylight_hours(DatetimeIndex(["2015-09-03"]), -0.35)[0]
self.assertAlmostEqual(float(dayhours), 11.7, 1)

def test_calc_rad_long(self):
Expand Down
Loading