Skip to content

Commit

Permalink
use np.maximum() instead of boolean indexing. (#350)
Browse files Browse the repository at this point in the history
* use np.maximum() instead of boolean indexing.

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
tlogan2000 and pre-commit-ci[bot] authored Mar 11, 2024
1 parent c150f1a commit 8f94601
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions docs/notebooks/03_Extracting_forcing_data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"\n",
"import fsspec # noqa\n",
"import intake\n",
"import numpy as np\n",
"import s3fs # noqa\n",
"import xarray as xr\n",
"from clisops.core import subset\n",
Expand Down Expand Up @@ -207,7 +208,7 @@
" ERA5_pr = ERA5_pr.mean({\"latitude\", \"longitude\"})\n",
"\n",
" # Ensure that the precipitation is non-negative, which can happen with some reanalysis models.\n",
" ERA5_pr[ERA5_pr < 0] = 0\n",
" ERA5_pr = np.maximum(ERA5_pr, 0)\n",
"\n",
" # Transform them to a dataset such that they can be written with attributes to netcdf\n",
" ERA5_tmin = ERA5_tmin.to_dataset(name=\"tmin\", promote_attrs=True)\n",
Expand Down Expand Up @@ -282,7 +283,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.16"
"version": "3.10.13"
},
"nbdime-conflicts": {
"local_diff": [
Expand Down

0 comments on commit 8f94601

Please sign in to comment.