Skip to content

Commit 8e2ca97

Browse files
[pre-commit.ci] pre-commit autoupdate (#426)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.6 → v0.9.4](astral-sh/ruff-pre-commit@v0.8.6...v0.9.4) - [github.com/codespell-project/codespell: v2.3.0 → v2.4.1](codespell-project/codespell@v2.3.0...v2.4.1) * [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>
1 parent 94508a2 commit 8e2ca97

File tree

11 files changed

+21
-26
lines changed

11 files changed

+21
-26
lines changed

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ repos:
1515
# Run ruff to lint and format
1616
- repo: https://github.com/astral-sh/ruff-pre-commit
1717
# Ruff version.
18-
rev: v0.8.6
18+
rev: v0.9.4
1919
hooks:
2020
# Run the linter.
2121
- id: ruff
@@ -25,7 +25,7 @@ repos:
2525

2626
# Find common spelling mistakes in comments and docstrings
2727
- repo: https://github.com/codespell-project/codespell
28-
rev: v2.3.0
28+
rev: v2.4.1
2929
hooks:
3030
- id: codespell
3131
args: ['--ignore-regex="(\b[A-Z]+\b)"'] # Ignore capital case words, e.g. country codes

atlite/convert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def convert_and_aggregate(
148148
if matrix is not None:
149149
if shapes is not None:
150150
raise ValueError(
151-
"Passing matrix and shapes is ambiguous. Pass " "only one of them."
151+
"Passing matrix and shapes is ambiguous. Pass only one of them."
152152
)
153153

154154
if isinstance(matrix, xr.DataArray):

atlite/cutout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def __init__(self, path, **cutoutparams):
154154
data.attrs.update(storable_chunks)
155155
if cutoutparams:
156156
warn(
157-
f'Arguments {", ".join(cutoutparams)} are ignored, since '
157+
f"Arguments {', '.join(cutoutparams)} are ignored, since "
158158
"cutout is already built."
159159
)
160160
elif "data" in cutoutparams:

atlite/datasets/era5.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,9 @@ def retrieve_data(product, chunks=None, tmpdir=None, lock=None, **updates):
341341
request = {"product_type": "reanalysis", "format": "netcdf"}
342342
request.update(updates)
343343

344-
assert {"year", "month", "variable"}.issubset(
345-
request
346-
), "Need to specify at least 'variable', 'year' and 'month'"
344+
assert {"year", "month", "variable"}.issubset(request), (
345+
"Need to specify at least 'variable', 'year' and 'month'"
346+
)
347347

348348
client = cdsapi.Client(
349349
info_callback=logger.debug, debug=logging.DEBUG >= logging.root.level

atlite/gis.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,7 @@ def open_files(self):
481481
if d["crs"]:
482482
raster._crs = CRS(d["crs"])
483483
else:
484-
raise ValueError(
485-
f"CRS of {raster} is invalid, please " "provide it."
486-
)
484+
raise ValueError(f"CRS of {raster} is invalid, please provide it.")
487485
d["raster"] = raster
488486

489487
for d in self.geometries:
@@ -733,9 +731,9 @@ def compute_availabilitymatrix(
733731
_ = shape_availability_reprojected(shapes.loc[[i]], *args)[0]
734732
availability.append(_)
735733
else:
736-
assert (
737-
excluder.all_closed
738-
), "For parallelization all raster files in excluder must be closed"
734+
assert excluder.all_closed, (
735+
"For parallelization all raster files in excluder must be closed"
736+
)
739737
kwargs = {
740738
"initializer": _init_process,
741739
"initargs": (shapes, *args),

atlite/hydro.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ def determine_basins(plants, hydrobasins, show_progress=False):
5151
missing_columns = pd.Index(
5252
["HYBAS_ID", "DIST_MAIN", "NEXT_DOWN", "geometry"]
5353
).difference(hydrobasins.columns)
54-
assert (
55-
missing_columns.empty
56-
), "Couldn't find the column(s) {} in the hydrobasins dataset.".format(
57-
", ".join(missing_columns)
54+
assert missing_columns.empty, (
55+
"Couldn't find the column(s) {} in the hydrobasins dataset.".format(
56+
", ".join(missing_columns)
57+
)
5858
)
5959

6060
hydrobasins = hydrobasins.set_index("HYBAS_ID")

atlite/pv/irradiation.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,7 @@ def DiffuseHorizontalIrrad(ds, solar_position, clearsky_model, influx):
6464
* fmax(0.1, 0.426 * k - 0.256 * sinaltitude + 0.00349 * T + 0.0734 * rh)
6565
)
6666
else:
67-
raise KeyError(
68-
"`clearsky model` must be chosen from 'simple' and " "'enhanced'"
69-
)
67+
raise KeyError("`clearsky model` must be chosen from 'simple' and 'enhanced'")
7068

7169
# Set diffuse fraction to one when the sun isn't up
7270
# fraction = fraction.where(sinaltitude >= sin(radians(threshold))).fillna(1.0)

atlite/wind.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,7 @@ def extrapolate_wind_speed(
112112
method_desc = "power method with wind shear exponent"
113113
else:
114114
raise ValueError(
115-
f"Interpolation method must be 'logarithmic' or 'power', "
116-
f" but is: {method}"
115+
f"Interpolation method must be 'logarithmic' or 'power', but is: {method}"
117116
)
118117

119118
wnd_spd.attrs.update(

doc/chart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
f"Solar PV power generation {linebreak}for a given panel type",
3030
"Solar thermal collector heat output",
3131
"Hydroelectric inflow (simplified)",
32-
f"Heating demand {linebreak}" "(based on the degree-day approximation)",
32+
f"Heating demand {linebreak}(based on the degree-day approximation)",
3333
]
3434

3535
climatestr = "\n" + "\n\n".join([" ◦ " + s for s in climatedata]) + "\n"

examples/working-with-csp.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
" vmin=0,\n",
157157
" vmax=1.0,\n",
158158
" )\n",
159-
" axes[i].set_title(f'{name} (technology: {config[\"technology\"]})')\n",
159+
" axes[i].set_title(f\"{name} (technology: {config['technology']})\")\n",
160160
" axes[i].set_xlim(0, 360)\n",
161161
" axes[i].set_ylim(0, 90)"
162162
]

0 commit comments

Comments
 (0)