Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

- name: Install build tools
run: |
python -m pip install --upgrade pip wheel setuptools setuptools_scm build twine
python -m pip install --upgrade pip build twine

shell: bash

Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ repos:
- id: blackdoc

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.254
rev: v0.0.269
hooks:
- id: ruff

- repo: https://github.com/psf/black
rev: 23.1.0
rev: 23.3.0
hooks:
- id: black
language_version: python3
Expand All @@ -51,6 +51,6 @@ repos:
- id: add-trailing-comma

- repo: https://github.com/tox-dev/pyproject-fmt
rev: "0.9.2"
rev: "0.11.2"
hooks:
- id: pyproject-fmt
1 change: 1 addition & 0 deletions oceans/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def _woa_url(variable, time_period, resolution):
warnings.warn(
f'The variable "{variable}" is only available at 1 degree resolution, '
f'annual time period, and "{pref}".',
stacklevel=2,
)
return f"{base}/" f"{pref}/" f"{variable}_annual_1deg.nc"
else:
Expand Down
7 changes: 5 additions & 2 deletions oceans/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,10 @@ def medfilt1(x, L=3):
>>> L = 103
>>> xout = medfilt1(x=x, L=L)
>>> ax = plt.subplot(212)
>>> (l1, l2,) = ax.plot(
>>> (
... l1,
... l2,
... ) = ax.plot(
... x
... ), ax.plot(xout)
>>> ax.grid(True)
Expand Down Expand Up @@ -461,7 +464,7 @@ def medfilt1(x, L=3):
Lwing = (L - 1) // 2

# NOTE: Use np.ndenumerate in case I expand to +1D case
for i, xi in enumerate(xin):
for i, _xi in enumerate(xin):
if i < Lwing: # Left boundary.
xout[i] = np.median(xin[0 : i + Lwing + 1]) # (0 to i + Lwing)
elif i >= N - Lwing: # Right boundary.
Expand Down
2 changes: 1 addition & 1 deletion oceans/ocfis.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,7 @@ def get_profile(x, y, f, xi, yi, mode="nearest", order=3):
)

if conditions.any():
warnings.warn("Warning! Extrapolation!!")
warnings.warn("Warning! Extrapolation!!", stacklevel=2)

dx = x[0, 1] - x[0, 0]
dy = y[1, 0] - y[0, 0]
Expand Down
2 changes: 1 addition & 1 deletion oceans/plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def key_press_callback(self, event):
print("Insert point") # noqa
xs = self.points.get_xdata()
ex, ey = event.xdata, event.ydata
for i in range(len(xs) - 1):
for _i in range(len(xs) - 1):
self.points.set_xdata(np.r_[self.points.get_xdata(), ex])
self.points.set_ydata(np.r_[self.points.get_ydata(), ey])
self.line.set_data(self.points.get_data())
Expand Down
27 changes: 22 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,19 @@ name = "oceans"
description = "Misc functions for oceanographic data analysis"
readme = "README.md"
license = {file = "LICENSE.txt"}
authors = [
{name = "André Palóczy, Arnaldo Russo, Filipe Fernandes"},
maintainers = [
{name = "André Palóczy"},
{name = "Arnaldo Russo"},
{name = "Filipe Fernandes"},
]
requires-python = ">=3.8"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
]
dynamic = [
"version",
]
Expand Down Expand Up @@ -58,15 +67,23 @@ markers = [

[tool.ruff]
select = [
"A", # flake8-builtins
"B", # flake8-bugbear
"C4", # flake8-comprehensions
"F", # flakes
"I", # import sorting
"U", # upgrade
"T20", # flake8-print
"UP", # upgrade
]
target-version = "py311"
line-length = 79
ignore = [
"B905", # zip ztrict arg, enable only for py310
]

[tool.ruff.per-file-ignores]
"docs/conf.py" = ["E402"]
"docs/source/conf.py" = ["E402", "A001"]
"oceans/plotting.py" = ["T201"] # `print` found

[tool.interrogate]
ignore-init-method = true
Expand All @@ -76,7 +93,7 @@ ignore-semiprivate = false
ignore-private = false
ignore-module = false
fail-under = 95
exclude = ["setup.py", "docs", "tests"]
exclude = ["docs", "tests"]
verbose = 1
quiet = false
color = true
Expand Down