diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 66361c7..0cbe468 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -1,7 +1,7 @@ # 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) @@ -9,3 +9,5 @@ Add a short description describing the pull request (PR) here. - [ ] 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. \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index aba0714..2fbb989 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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 @@ -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. @@ -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", } ], } @@ -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 = [ diff --git a/pyet/meteo_utils.py b/pyet/meteo_utils.py index 3f65a00..2be6218 100644 --- a/pyet/meteo_utils.py +++ b/pyet/meteo_utils.py @@ -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 @@ -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): diff --git a/pyet/radiation.py b/pyet/radiation.py index 54cfde5..20dd712 100644 --- a/pyet/radiation.py +++ b/pyet/radiation.py @@ -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.") @@ -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`. @@ -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.") @@ -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. diff --git a/pyet/version.py b/pyet/version.py index bf4a910..866bccf 100644 --- a/pyet/version.py +++ b/pyet/version.py @@ -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" diff --git a/pyproject.toml b/pyproject.toml index 0fbfbad..4a0107e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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', @@ -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__" } @@ -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", @@ -69,4 +68,4 @@ rtd = [ "scipy", "spotpy", "openpyxl" -] \ No newline at end of file +] diff --git a/tests/testfao56.py b/tests/testfao56.py index f2234f7..f87a5f2 100644 --- a/tests/testfao56.py +++ b/tests/testfao56.py @@ -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):