From 842999b04159942fac95a7206eb670445430097d Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 22 Apr 2024 10:46:12 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- xclim/indices/_conversion.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/xclim/indices/_conversion.py b/xclim/indices/_conversion.py index 7eda990ba..6e055a13f 100644 --- a/xclim/indices/_conversion.py +++ b/xclim/indices/_conversion.py @@ -1422,9 +1422,9 @@ def potential_evapotranspiration( tas = (tasmin + tasmax) / 2 else: tas = convert_units_to(tas, "degC") - + # Monthly accumulated radiation - if xr.infer_freq(tasmin['time']) == 'D': + if xr.infer_freq(tasmin["time"]) == "D": ra = extraterrestrial_solar_radiation( tasmin.time, lat, chunks=tasmin.chunksizes ) @@ -1433,26 +1433,26 @@ def potential_evapotranspiration( tas = tas.resample(time="MS").mean(dim="time") pr = pr.resample(time="MS").mean(dim="time") - elif xr.infer_freq(tasmin['time']) == 'MS': - tasmin_day = tasmin.resample(time='D').ffill() + elif xr.infer_freq(tasmin["time"]) == "MS": + tasmin_day = tasmin.resample(time="D").ffill() ra = extraterrestrial_solar_radiation( tasmin_day.time, lat, chunks=tasmin_day.chunksizes ) ra = convert_units_to(ra, "MJ m-2 d-1") ra = ra.resample(time="MS").sum(dim="time") - ra = ra * 0.408 # Is used to convert the radiation to evaporation equivalents in mm (kg/MJ) + ra = ( + ra * 0.408 + ) # Is used to convert the radiation to evaporation equivalents in mm (kg/MJ) tr = tasmax - tasmin - tr = tr.where(tr>0, 0) + tr = tr.where(tr > 0, 0) # Droogers and Allen (2002) formula ab = tr - 0.0123 * pr - out = ( - 0.0013 * ra * (tas + 17.0) * ab ** 0.76 - ) + out = 0.0013 * ra * (tas + 17.0) * ab**0.76 out = xr.where(np.isnan(ab**0.76), 0, out) - out = out.clip(0) # mm/month + out = out.clip(0) # mm/month elif method in ["mcguinnessbordne05", "MB05"]: if tas is None: