Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#426)
Browse files Browse the repository at this point in the history
* [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>
  • Loading branch information
pre-commit-ci[bot] authored Feb 4, 2025
1 parent 94508a2 commit 8e2ca97
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
# Run ruff to lint and format
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.6
rev: v0.9.4
hooks:
# Run the linter.
- id: ruff
Expand All @@ -25,7 +25,7 @@ repos:

# Find common spelling mistakes in comments and docstrings
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
args: ['--ignore-regex="(\b[A-Z]+\b)"'] # Ignore capital case words, e.g. country codes
Expand Down
2 changes: 1 addition & 1 deletion atlite/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def convert_and_aggregate(
if matrix is not None:
if shapes is not None:
raise ValueError(
"Passing matrix and shapes is ambiguous. Pass " "only one of them."
"Passing matrix and shapes is ambiguous. Pass only one of them."
)

if isinstance(matrix, xr.DataArray):
Expand Down
2 changes: 1 addition & 1 deletion atlite/cutout.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def __init__(self, path, **cutoutparams):
data.attrs.update(storable_chunks)
if cutoutparams:
warn(
f'Arguments {", ".join(cutoutparams)} are ignored, since '
f"Arguments {', '.join(cutoutparams)} are ignored, since "
"cutout is already built."
)
elif "data" in cutoutparams:
Expand Down
6 changes: 3 additions & 3 deletions atlite/datasets/era5.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,9 @@ def retrieve_data(product, chunks=None, tmpdir=None, lock=None, **updates):
request = {"product_type": "reanalysis", "format": "netcdf"}
request.update(updates)

assert {"year", "month", "variable"}.issubset(
request
), "Need to specify at least 'variable', 'year' and 'month'"
assert {"year", "month", "variable"}.issubset(request), (
"Need to specify at least 'variable', 'year' and 'month'"
)

client = cdsapi.Client(
info_callback=logger.debug, debug=logging.DEBUG >= logging.root.level
Expand Down
10 changes: 4 additions & 6 deletions atlite/gis.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,9 +481,7 @@ def open_files(self):
if d["crs"]:
raster._crs = CRS(d["crs"])
else:
raise ValueError(
f"CRS of {raster} is invalid, please " "provide it."
)
raise ValueError(f"CRS of {raster} is invalid, please provide it.")
d["raster"] = raster

for d in self.geometries:
Expand Down Expand Up @@ -733,9 +731,9 @@ def compute_availabilitymatrix(
_ = shape_availability_reprojected(shapes.loc[[i]], *args)[0]
availability.append(_)
else:
assert (
excluder.all_closed
), "For parallelization all raster files in excluder must be closed"
assert excluder.all_closed, (
"For parallelization all raster files in excluder must be closed"
)
kwargs = {
"initializer": _init_process,
"initargs": (shapes, *args),
Expand Down
8 changes: 4 additions & 4 deletions atlite/hydro.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ def determine_basins(plants, hydrobasins, show_progress=False):
missing_columns = pd.Index(
["HYBAS_ID", "DIST_MAIN", "NEXT_DOWN", "geometry"]
).difference(hydrobasins.columns)
assert (
missing_columns.empty
), "Couldn't find the column(s) {} in the hydrobasins dataset.".format(
", ".join(missing_columns)
assert missing_columns.empty, (
"Couldn't find the column(s) {} in the hydrobasins dataset.".format(
", ".join(missing_columns)
)
)

hydrobasins = hydrobasins.set_index("HYBAS_ID")
Expand Down
4 changes: 1 addition & 3 deletions atlite/pv/irradiation.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ def DiffuseHorizontalIrrad(ds, solar_position, clearsky_model, influx):
* fmax(0.1, 0.426 * k - 0.256 * sinaltitude + 0.00349 * T + 0.0734 * rh)
)
else:
raise KeyError(
"`clearsky model` must be chosen from 'simple' and " "'enhanced'"
)
raise KeyError("`clearsky model` must be chosen from 'simple' and 'enhanced'")

# Set diffuse fraction to one when the sun isn't up
# fraction = fraction.where(sinaltitude >= sin(radians(threshold))).fillna(1.0)
Expand Down
3 changes: 1 addition & 2 deletions atlite/wind.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,7 @@ def extrapolate_wind_speed(
method_desc = "power method with wind shear exponent"
else:
raise ValueError(
f"Interpolation method must be 'logarithmic' or 'power', "
f" but is: {method}"
f"Interpolation method must be 'logarithmic' or 'power', but is: {method}"
)

wnd_spd.attrs.update(
Expand Down
2 changes: 1 addition & 1 deletion doc/chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
f"Solar PV power generation {linebreak}for a given panel type",
"Solar thermal collector heat output",
"Hydroelectric inflow (simplified)",
f"Heating demand {linebreak}" "(based on the degree-day approximation)",
f"Heating demand {linebreak}(based on the degree-day approximation)",
]

climatestr = "\n" + "\n\n".join([" ◦ " + s for s in climatedata]) + "\n"
Expand Down
2 changes: 1 addition & 1 deletion examples/working-with-csp.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
" vmin=0,\n",
" vmax=1.0,\n",
" )\n",
" axes[i].set_title(f'{name} (technology: {config[\"technology\"]})')\n",
" axes[i].set_title(f\"{name} (technology: {config['technology']})\")\n",
" axes[i].set_xlim(0, 360)\n",
" axes[i].set_ylim(0, 90)"
]
Expand Down
4 changes: 2 additions & 2 deletions test/test_preparation_and_conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def test_all_non_na_era5_coarse(cutout_era5_coarse):
@staticmethod
@pytest.mark.skipif(
os.name == "nt",
reason="This test breaks on windows machine on CI" " due to unknown reasons.",
reason="This test breaks on windows machine on CI due to unknown reasons.",
)
def test_all_non_na_era5_weird_resolution(cutout_era5_weird_resolution):
"""
Expand Down Expand Up @@ -439,7 +439,7 @@ def test_dx_dy_preservation_era5_coarse(cutout_era5_coarse):
@staticmethod
@pytest.mark.skipif(
os.name == "nt",
reason="This test breaks on windows machine on CI" " due to unknown reasons.",
reason="This test breaks on windows machine on CI due to unknown reasons.",
)
def test_dx_dy_preservation_era5_weird_resolution(cutout_era5_weird_resolution):
"""
Expand Down

0 comments on commit 8e2ca97

Please sign in to comment.