Skip to content

Commit 79878e8

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 42b9204 commit 79878e8

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

atlite/convert.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,6 +1080,7 @@ def runoff(
10801080

10811081
return result
10821082

1083+
10831084
def _hydro_from_runoff(
10841085
cutout,
10851086
plants,
@@ -1144,6 +1145,7 @@ def _hydro_from_runoff(
11441145
basins, runoff, flowspeed, show_progress
11451146
)
11461147

1148+
11471149
def _hydro_from_discharge(
11481150
cutout,
11491151
plants,
@@ -1157,9 +1159,9 @@ def _hydro_from_discharge(
11571159
plants : pd.DataFrame
11581160
Run-of-river plants or dams with lon, lat columns.
11591161
"""
1160-
print("<"*100)
1162+
print("<" * 100)
11611163
print("Extracting discharge time series for nearest grid points to plants...")
1162-
print("<"*100)
1164+
print("<" * 100)
11631165
discharge = cutout.data.discharge
11641166
inflow = xr.DataArray(
11651167
np.zeros((len(plants), discharge.indexes["time"].size)),
@@ -1171,7 +1173,7 @@ def _hydro_from_discharge(
11711173
x=plant.lon, y=plant.lat, method="nearest"
11721174
)
11731175
return inflow
1174-
1176+
11751177

11761178
def hydro(
11771179
cutout,
@@ -1216,7 +1218,9 @@ def hydro(
12161218
plants,
12171219
)
12181220
if hydrobasins is None or "runoff" not in cutout.available_features.values:
1219-
raise ValueError("For runoff-based hydro time series, hydrobasins and runoff data must be provided.")
1221+
raise ValueError(
1222+
"For runoff-based hydro time series, hydrobasins and runoff data must be provided."
1223+
)
12201224
return _hydro_from_runoff(
12211225
cutout,
12221226
plants,
@@ -1229,15 +1233,19 @@ def hydro(
12291233
elif module.lower() == "glofas":
12301234
# Check if discharge data is available in cutout, otherwise raise error
12311235
if "discharge" not in cutout.data_vars:
1232-
raise ValueError("For GloFAS-based hydro time series, the cutout must include discharge data.")
1236+
raise ValueError(
1237+
"For GloFAS-based hydro time series, the cutout must include discharge data."
1238+
)
12331239
return _hydro_from_discharge(
12341240
cutout,
12351241
plants,
12361242
)
12371243
elif module.lower() == "era5":
12381244
# Check if hydrobasins is provided, otherwise raise error
12391245
if hydrobasins is None:
1240-
raise ValueError("For ERA5-based hydro time series, the hydrobasins dataset must be provided.")
1246+
raise ValueError(
1247+
"For ERA5-based hydro time series, the hydrobasins dataset must be provided."
1248+
)
12411249
return _hydro_from_runoff(
12421250
cutout,
12431251
plants,

0 commit comments

Comments
 (0)