Skip to content

Commit 46660b9

Browse files
Update master to pyet 1.3.1 (#72)
2 parents 990ae50 + a79066b commit 46660b9

11 files changed

Lines changed: 399 additions & 94 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ jobs:
3939
with:
4040
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
4141
coverage-reports: coverage.xml
42+

.github/workflows/python-publish.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,17 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717
- name: Set up Python
18-
uses: actions/setup-python@v2
18+
uses: actions/setup-python@v5
1919
with:
2020
python-version: '3.x'
2121
- name: Install dependencies
2222
run: |
2323
python -m pip install --upgrade pip
2424
pip install setuptools wheel twine
25-
- name: Build and publish
26-
env:
27-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29-
run: |
30-
python setup.py sdist bdist_wheel
31-
twine upload dist/*
25+
- name: Upload Python Package
26+
uses: pypa/gh-action-pypi-publish@release/v1
27+
with:
28+
user: __token__
29+
password: ${{ secrets.PYPI_TOKEN }}

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,29 +42,29 @@ $^a$ $T_{max}$ and $T_{min}$ can also be provided. $^b$ $RH_{max}$ and $RH_{min}
4242

4343
Examples of using *pyet* can be found in the example folder:
4444

45-
* [Example 1](examples/01_example_zamg.ipynb): Estimating PET using pandas.Series
45+
* [Example 1](<https://pyet.readthedocs.io/en/dev/examples/01_example_zamg.html#>): Estimating PET using pandas.Series
4646

47-
* [Example 2](examples/02_example_zamg_netcdf.ipynb): Estimating PET using xarray.DataArray
47+
* [Example 2](<https://pyet.readthedocs.io/en/dev/examples/02_example_zamg_netcdf.html>): Estimating PET using xarray.DataArray
4848

49-
* [Example 3](examples/03_example_knmi.ipynb): Benchmarking Makkink
49+
* [Example 3](<https://pyet.readthedocs.io/en/dev/examples/03_example_knmi.html>): Benchmarking Makkink
5050
against [KNMI data](https://www.knmi.nl/over-het-knmi/about)
5151

52-
* [Example 4](examples/04_example_coagmet.ipynb): Benchmarking FAO56
52+
* [Example 4](<https://pyet.readthedocs.io/en/dev/examples/04_example_coagmet.html>): Benchmarking FAO56
5353
against [CoAgMET data](https://coagmet.colostate.edu/)
5454

55-
* [Example 5](examples/05_example_calibration.ipynb): Calibrating the Romanenko and Abtew method against the PM-FAO56
55+
* [Example 5](<https://pyet.readthedocs.io/en/dev/examples/05_example_calibration.html>): Calibrating the Romanenko and Abtew method against the PM-FAO56
5656

57-
* [Example 6](examples/06_worked_examples_McMahon_etal_2013.ipynb): Worked examples for estimating meteorological
57+
* [Example 6](<https://pyet.readthedocs.io/en/dev/examples/06_worked_examples_McMahon_etal_2013.html>): Worked examples for estimating meteorological
5858
variables and potential evapotranspiration after McMahon et al., 2013
5959

60-
* [Example 7](examples/07_example_climate_change.ipynb): Example for estimating potential evapotranspiration under
60+
* [Example 7](<https://pyet.readthedocs.io/en/dev/examples/07_example_climate_change.html>): Example for estimating potential evapotranspiration under
6161
warming and elevated $CO_2$ concentrations following Yang et al., (2019)
6262

63-
* [Example 8](examples/08_crop_coefficient.ipynb): Determining the crop coefficient function with Python
63+
* [Example 8](<https://pyet.readthedocs.io/en/dev/examples/08_crop_coefficient.html>): Determining the crop coefficient function with Python
6464

65-
* [Example 9](examples/09_CMIP6_data.ipynb): Estimating PET using CMIP data
65+
* [Example 9](<https://pyet.readthedocs.io/en/dev/examples/09_CMIP6_data.html>): Estimating PET using CMIP data
6666

67-
* [Example 10](examples/10_example_paper.ipynb): Notebook supporting PyEt manuscript
67+
* [Example 10](<https://pyet.readthedocs.io/en/dev/examples/10_example_paper.html>): Notebook supporting PyEt manuscript
6868

6969
Documentation is hosted on [ReadTheDocs](https://pyet.readthedocs.io).
7070

docs/conf.py

Lines changed: 59 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -18,56 +18,54 @@
1818

1919
year = date.today().strftime("%Y")
2020

21-
sys.path.insert(0, os.path.abspath('.'))
21+
sys.path.insert(0, os.path.abspath("."))
2222

2323
# Get a Bibtex reference file from the Zotero group for referencing
2424
url = "https://api.zotero.org/groups/4846265/collections/M9ZRDX2U/items/"
25-
params = {"format": "bibtex",
26-
"style": "apa",
27-
"limit": 100}
25+
params = {"format": "bibtex", "style": "apa", "limit": 100}
2826

2927
r = requests.get(url=url, params=params)
3028
with open("references.bib", mode="w") as file:
3129
file.write(r.text)
3230

3331
# Get a Bibtex reference file from the Zotero group for publications list
3432
url = "https://api.zotero.org/groups/4846265/collections/UR7PHVDK/items/"
35-
params = {"format": "bibtex",
36-
"style": "apa",
37-
"limit": 100}
33+
params = {"format": "bibtex", "style": "apa", "limit": 100}
3834

3935
r = requests.get(url=url, params=params)
4036
with open("publications.bib", mode="w") as file:
4137
file.write(r.text)
4238

4339
# -- Project information -----------------------------------------------------
4440

45-
project = 'pyet'
46-
copyright = '{}, M. Vremec, R.A. Collenteur'.format(year)
47-
author = 'M. Vremec, R.A. Collenteur'
41+
project = "pyet"
42+
copyright = "{}, M. Vremec, R.A. Collenteur".format(year)
43+
author = "M. Vremec, R.A. Collenteur"
4844

4945
# The full version, including alpha/beta/rc tags
50-
release = '2020'
46+
release = "2020"
5147

5248
# -- General configuration ---------------------------------------------------
5349

5450
# Add any Sphinx extension module names here, as strings. They can be
5551
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
5652
# ones.
5753
extensions = [
58-
'sphinx.ext.autodoc',
59-
'sphinx.ext.autosummary',
60-
'sphinx.ext.napoleon',
61-
'sphinx.ext.doctest',
62-
'sphinx.ext.intersphinx',
63-
'sphinx.ext.todo',
64-
'sphinx.ext.mathjax',
65-
'sphinx.ext.ifconfig',
66-
'sphinx.ext.viewcode',
67-
'IPython.sphinxext.ipython_console_highlighting', # lowercase didn't work
68-
'sphinx.ext.autosectionlabel',
69-
'sphinxcontrib.bibtex',
70-
'myst_nb',
54+
"sphinx.ext.autodoc",
55+
"sphinx.ext.autosummary",
56+
"sphinx.ext.napoleon",
57+
"sphinx.ext.doctest",
58+
"sphinx.ext.intersphinx",
59+
"sphinx.ext.todo",
60+
"sphinx.ext.mathjax",
61+
"sphinx.ext.ifconfig",
62+
"sphinx.ext.viewcode",
63+
"IPython.sphinxext.ipython_console_highlighting", # lowercase didn't work
64+
"sphinx.ext.autosectionlabel",
65+
"sphinxcontrib.bibtex",
66+
"myst_nb",
67+
"numpydoc",
68+
"sphinx_design",
7169
]
7270

7371
# Create custom bracket style with round brackets
@@ -77,14 +75,13 @@
7775
import sphinxcontrib.bibtex.plugin
7876

7977
from sphinxcontrib.bibtex.style.referencing import BracketStyle
80-
from sphinxcontrib.bibtex.style.referencing.author_year \
81-
import AuthorYearReferenceStyle
78+
from sphinxcontrib.bibtex.style.referencing.author_year import AuthorYearReferenceStyle
8279

8380

8481
def bracket_style() -> BracketStyle:
8582
return BracketStyle(
86-
left='(',
87-
right=')',
83+
left="(",
84+
right=")",
8885
)
8986

9087

@@ -98,40 +95,52 @@ class MyReferenceStyle(AuthorYearReferenceStyle):
9895

9996

10097
sphinxcontrib.bibtex.plugin.register_plugin(
101-
'sphinxcontrib.bibtex.style.referencing',
102-
'author_year_round', MyReferenceStyle)
98+
"sphinxcontrib.bibtex.style.referencing", "author_year_round", MyReferenceStyle
99+
)
103100

104-
bibtex_bibfiles = ['references.bib', 'publications.bib']
101+
bibtex_bibfiles = ["references.bib", "publications.bib"]
105102
bibtex_reference_style = "author_year_round"
106103

107104
# Add any paths that contain templates here, relative to this directory.
108-
templates_path = ['_templates']
105+
templates_path = ["_templates"]
109106

110-
source_suffix = '.rst'
107+
source_suffix = ".rst"
111108

112109
# The master toctree document.
113-
master_doc = 'index'
110+
master_doc = "index"
114111

115112
# List of patterns, relative to source directory, that match files and
116113
# directories to ignore when looking for source files.
117114
# This pattern also affects html_static_path and html_extra_path.
118-
exclude_patterns = ['_build', '**.ipynb_checkpoints']
115+
exclude_patterns = ["_build", "**.ipynb_checkpoints"]
119116

120117
# -- Options for HTML output -------------------------------------------------
121118

122119
# The theme to use for HTML and HTML Help pages. See the documentation for
123120
# a list of builtin themes.
124121

125122
html_theme = "pydata_sphinx_theme"
126-
html_theme_options = {
127-
"github_url": "https://github.com/phydrus/pyet",
128-
"use_edit_page_button": False
129-
}
130123
# Add any paths that contain custom static files (such as style sheets) here,
131124
# relative to this directory. They are copied after the builtin static files,
132125
# so a file named "default.css" will overwrite the builtin "default.css".
133-
html_static_path = ['_static']
126+
html_static_path = ["_static"]
134127
html_logo = "_static/logo.png"
128+
html_use_smartypants = True
129+
html_show_sourcelink = True
130+
131+
html_theme_options = {
132+
"github_url": "https://github.com/pyet-org/pyet",
133+
"use_edit_page_button": True,
134+
"header_links_before_dropdown": 6,
135+
"icon_links": [
136+
{
137+
"name": "GitHub", # Label for this link
138+
"url": "https://github.com/pyet-org/pyet", # required
139+
"icon": "fab fa-github-square",
140+
"type": "fontawesome", # Default is fontawesome
141+
}
142+
],
143+
}
135144

136145
autosummary_generate = True
137146
numpydoc_show_class_members = False
@@ -148,3 +157,13 @@ class MyReferenceStyle(AuthorYearReferenceStyle):
148157

149158
nb_execution_allow_errors = True # Allow errors in notebooks, to see the error online
150159
nb_execution_mode = "auto"
160+
161+
# Enable specific MyST extensions, such as "dollarmath" for math rendering
162+
myst_enable_extensions = [
163+
"dollarmath",
164+
]
165+
166+
# -- Numpydoc settings ----------------------------------------------------------------
167+
168+
numpydoc_class_members_toctree = True
169+
numpydoc_show_class_members = False

docs/examples/10_example_paper.ipynb

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@
8989
"import pylab\n",
9090
"import matplotlib.dates as mdates\n",
9191
"from mpl_toolkits.axes_grid1.inset_locator import inset_axes\n",
92+
"import gc # Import the garbage collection module\n",
9293
"\n",
9394
"import pyet\n",
9495
"import spotpy\n",
@@ -120,7 +121,6 @@
120121
"source": [
121122
"#edit default values for plots\n",
122123
"params = {\n",
123-
" \"font.family\": \"Arial\",\n",
124124
" \"legend.fontsize\": \"15\",\n",
125125
" \"axes.labelsize\": \"16\",\n",
126126
" \"xtick.labelsize\": \"15\",\n",
@@ -773,7 +773,7 @@
773773
"fig.supxlabel(\"PET$_{benchmark}$ [mm/day]\", x=0.475, fontsize=16)\n",
774774
"fig.supylabel(\"PET$_{pyet}$ [mm/day]\", fontsize=16)\n",
775775
"fig.subplots_adjust(wspace=0.05, hspace=0.05, left=0.05)\n",
776-
"plt.tight_layout()\n",
776+
"plt.tight_layout();\n",
777777
"#fig.savefig(\"figure1.png\", dpi=600, bbox_inches=\"tight\")"
778778
]
779779
},
@@ -872,7 +872,7 @@
872872
"\n",
873873
"plt.tight_layout()\n",
874874
"\n",
875-
"axs[2].legend(loc=(1.05,0.1), ncol=2, bbox_transform=axs[0].transAxes, fontsize=8)\n",
875+
"axs[2].legend(loc=(1.05,0.1), ncol=2, bbox_transform=axs[0].transAxes, fontsize=8);\n",
876876
"#fig.savefig(\"figure2.png\", dpi=600, bbox_inches=\"tight\")"
877877
]
878878
},
@@ -1007,7 +1007,7 @@
10071007
" cbar.set_label(\"PET [mm/day]\", labelpad=10)\n",
10081008
" plt.subplots_adjust(hspace=0.02, wspace=0.1)\n",
10091009
"\n",
1010-
"plt.subplots_adjust(hspace=0.02, wspace=0.01)\n",
1010+
"plt.subplots_adjust(hspace=0.02, wspace=0.01);\n",
10111011
"\n",
10121012
"#fig.savefig(\"figure3.png\", dpi=300, bbox_inches=\"tight\")"
10131013
]
@@ -1287,7 +1287,7 @@
12871287
"axs[1,5].set_yticklabels([\"\",800,1000,\"\"])\n",
12881288
"axs[0,5].legend(loc=(-3.65,1.05), ncol=7, bbox_transform=axs[1,5].transAxes)\n",
12891289
"clb = fig.colorbar(density, orientation=\"horizontal\", ax=axs[0, 0], cax = axs[0, 0].inset_axes([0.04, 1.2, 1, 0.05]))\n",
1290-
"clb.ax.set_title(\"Number of points per pixel\")\n",
1290+
"clb.ax.set_title(\"Number of points per pixel\");\n",
12911291
"#fig.savefig(\"figure4.png\", dpi=600, bbox_inches=\"tight\")"
12921292
]
12931293
},
@@ -1336,13 +1336,13 @@
13361336
"source": [
13371337
"# Load CO2 data for each RCP scenario\n",
13381338
"rcp_co2 = pd.DataFrame()\n",
1339-
"rcp_co2[\"rcp_26\"] = pd.read_csv(\"data/example_10/co2_conc/RCP3PD_MIDYR_CONC.dat\", skiprows=38, \n",
1339+
"rcp_co2[\"rcp_26\"] = pd.read_csv(\"data/example_10/co2_conc/RCP3PD_MIDYR_CONC.DAT\", skiprows=38, \n",
13401340
" delim_whitespace=True, index_col=\"YEARS\").loc[\"2020\":\"2100\", \"CO2\"]\n",
1341-
"rcp_co2[\"rcp_45\"] = pd.read_csv(\"data/example_10/co2_conc/RCP45_MIDYR_CONC.dat\", skiprows=38, \n",
1341+
"rcp_co2[\"rcp_45\"] = pd.read_csv(\"data/example_10/co2_conc/RCP45_MIDYR_CONC.DAT\", skiprows=38, \n",
13421342
" delim_whitespace=True, index_col=\"YEARS\").loc[\"2020\":\"2100\", \"CO2\"]\n",
1343-
"rcp_co2[\"rcp_60\"] = pd.read_csv(\"data/example_10/co2_conc/RCP6_MIDYR_CONC.dat\", skiprows=38, \n",
1343+
"rcp_co2[\"rcp_60\"] = pd.read_csv(\"data/example_10/co2_conc/RCP6_MIDYR_CONC.DAT\", skiprows=38, \n",
13441344
" delim_whitespace=True, index_col=\"YEARS\").loc[\"2020\":\"2100\", \"CO2\"]\n",
1345-
"rcp_co2[\"rcp_85\"] = pd.read_csv(\"data/example_10/co2_conc/RCP85_MIDYR_CONC.dat\", skiprows=38, \n",
1345+
"rcp_co2[\"rcp_85\"] = pd.read_csv(\"data/example_10/co2_conc/RCP85_MIDYR_CONC.DAT\", skiprows=38, \n",
13461346
" delim_whitespace=True, index_col=\"YEARS\").loc[\"2020\":\"2100\", \"CO2\"]"
13471347
]
13481348
},
@@ -1416,11 +1416,11 @@
14161416
"dpet_rcp_etco2 = pd.DataFrame(index=rcp_temp.index, columns=[\"rcp_26\", \"rcp_45\", \"rcp_60\", \"rcp_85\"])\n",
14171417
"dpet_rcp_etco2_5th = pd.DataFrame(index=rcp_temp.index, columns=[\"rcp_26\", \"rcp_45\", \"rcp_60\", \"rcp_85\"])\n",
14181418
"dpet_rcp_etco2_95th = pd.DataFrame(index=rcp_temp.index, columns=[\"rcp_26\", \"rcp_45\", \"rcp_60\", \"rcp_85\"])\n",
1419-
"for year in rcp_temp.index:\n",
1419+
"for year in rcp_temp.index: \n",
14201420
" for rcp in [\"rcp_26\", \"rcp_45\", \"rcp_60\", \"rcp_85\"]:\n",
14211421
" df_rcp_et = pd.DataFrame()\n",
14221422
" df_rcp_etco2 = pd.DataFrame()\n",
1423-
" for i in np.arange(0, len(methods)):\n",
1423+
" for i in np.arange(0, len(methods[:2])): # only for two methods to reduce processing for RTD to handle!!!!!!!!!!!!\n",
14241424
" input1 = input_rcp(rcp_temp.loc[year, rcp])\n",
14251425
" df_rcp_et[methods[i]] = simulate(sollutions2[i], methods[i], input1[i])\n",
14261426
" df_rcp_etco2[methods[i]] = simulate(sollutions2[i], methods[i], \n",
@@ -1430,7 +1430,9 @@
14301430
" dpet_rcp_et_95th.loc[year, rcp] = df_rcp_et.resample(\"y\").mean().mean().quantile(0.95)\n",
14311431
" dpet_rcp_etco2.loc[year, rcp] = df_rcp_etco2.resample(\"y\").mean().mean().mean()\n",
14321432
" dpet_rcp_etco2_5th.loc[year, rcp] = df_rcp_etco2.resample(\"y\").mean().mean().quantile(0.05)\n",
1433-
" dpet_rcp_etco2_95th.loc[year, rcp] = df_rcp_etco2.resample(\"y\").mean().mean().quantile(0.95)"
1433+
" dpet_rcp_etco2_95th.loc[year, rcp] = df_rcp_etco2.resample(\"y\").mean().mean().quantile(0.95)\n",
1434+
" # Call gc.collect() after processing each RCP scenario for a year\n",
1435+
" gc.collect()"
14341436
]
14351437
},
14361438
{
@@ -1487,7 +1489,7 @@
14871489
"\n",
14881490
"for i, letter in enumerate([\"a\", \"b\", \"c\", \"d\"]):\n",
14891491
" axs[i].text(0.85, 0.9, \"({})\".format(letter), transform=axs[i].transAxes, fontsize=12)\n",
1490-
" axs[i].tick_params(axis='both', which='major', labelsize=13)\n",
1492+
" axs[i].tick_params(axis='both', which='major', labelsize=13);\n",
14911493
"\n",
14921494
"#fig.savefig(\"figure5.png\", dpi=600, bbox_inches=\"tight\")"
14931495
]
@@ -1529,7 +1531,7 @@
15291531
"pet_df.plot() # daily PET [mm/day]\n",
15301532
"pet_df.boxplot() # boxplot PET[mm/day]\n",
15311533
"pet_df.cumsum().plot() # cummulative PET [mm]\n",
1532-
"plt.scatter(pyet_makkink, pet_knmi) # plot Makkink pyet vs KNMI"
1534+
"plt.scatter(pyet_makkink, pet_knmi) # plot Makkink pyet vs KNMI;"
15331535
]
15341536
},
15351537
{

0 commit comments

Comments
 (0)