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
15 changes: 5 additions & 10 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
defaults:
run:
shell: bash -l {0}

steps:
- name: checkout
Expand All @@ -33,15 +30,13 @@ jobs:
with:
python-version: "3.x"


- name: Install pandoc for notebook conversion
run: >
sudo apt-get update
&& sudo apt-get install pandoc

- name: Install windrose
run: |
python -m pip install -e .[extras,tests,docs]
python -m pip install --group dev
python -m pip install -e .[extras]

- name: Install pandoc
uses: pandoc/actions/setup@86321b6dd4675f5014c611e05088e10d4939e09e # v1.1.1

- name: Build documentation
run: |
Expand Down
22 changes: 13 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ "3.11", "3.12", "3.13", "3.14" ]
python-version: [ "3.11", "3.15" ]
os: [ ubuntu-latest ]
include:
- os: windows-latest
python-version: "3.14"
python-version: "3.15"
- os: macos-latest
python-version: "3.14"
python-version: "3.15"
fail-fast: false
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand All @@ -38,15 +35,22 @@ jobs:

- name: Install windrose
run: |
python -m pip install -e .[extras,tests]
python -m pip install --group dev
python -m pip install -e .[extras]

- name: Tests
- name: Code Tests
run: |
pytest -s -rxs -vv -Werror tests/

- name: MPL Tests
if: ${{ matrix.os == 'ubuntu' }}
run: |
pytest -s -rxs -vv -Werror tests/ --mpl --mpl-generate-summary=html \
--mpl-results-path="windrose_test_output-${{ matrix.os }}-${{ matrix.python-version }}"

- name: Store mpl-results
if: ${{ matrix.os == 'ubuntu' && failure() }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: failure()
with:
name: "windrose_test_output-${{ matrix.os }}-${{ matrix.python-version }}"
path: "windrose_test_output-${{ matrix.os }}-${{ matrix.python-version }}"
Expand Down
13 changes: 3 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,6 @@ repos:
- id: check-added-large-files
exclude_types: [yaml]
- id: requirements-txt-fixer
- id: file-contents-sorter
files: requirements-dev.txt

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.10.1
hooks:
- id: black
language_version: python3

- repo: https://github.com/keewis/blackdoc
rev: v0.4.6
Expand Down Expand Up @@ -51,9 +43,11 @@ repos:
- id: add-trailing-comma

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.17.2
rev: v0.17.3
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.30.3
Expand All @@ -67,7 +61,6 @@ repos:
# Use `nbqa mdformat jupyterbook --nbqa-md` to run it locally.
# - id: mdformat
- id: nbqa-check-ast
- id: nbqa-black
- id: nbqa-ruff
# We are skipping:
# E402 -> Module level import not at top of file
Expand Down
8 changes: 6 additions & 2 deletions notebooks/usage.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,9 @@
" \"\"\"wrapper function to create subplots per axis\"\"\"\n",
" ax = plt.gca()\n",
" ax = WindroseAxes.from_ax(ax=ax)\n",
" plot_windrose(direction_or_df=data[direction], var=data[var], ax=ax, **kwargs)\n",
" plot_windrose(\n",
" direction_or_df=data[direction], var=data[var], ax=ax, **kwargs\n",
" )\n",
"\n",
"\n",
"# this creates the raw subplot structure with a subplot per value in month.\n",
Expand Down Expand Up @@ -431,7 +433,9 @@
"y_ticks = range(0, 17, 4)\n",
"for ax in g.axes:\n",
" ax.set_legend(\n",
" title=r\"$m \\cdot s^{-1}$\", bbox_to_anchor=(1.15, -0.1), loc=\"lower right\"\n",
" title=r\"$m \\cdot s^{-1}$\",\n",
" bbox_to_anchor=(1.15, -0.1),\n",
" loc=\"lower right\",\n",
" )\n",
" ax.set_rgrids(y_ticks, y_ticks)\n",
"\n",
Expand Down
22 changes: 17 additions & 5 deletions notebooks/windrose_sample_poitiers_csv.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@
"\n",
"ax = WindroseAxes.from_ax()\n",
"ax.bar(\n",
" df.direction.values, df.speed.values, bins=np.arange(0.01, 8, 1), cmap=cm.hot, lw=3\n",
" df.direction.values,\n",
" df.speed.values,\n",
" bins=np.arange(0.01, 8, 1),\n",
" cmap=cm.hot,\n",
" lw=3,\n",
")\n",
"ax.set_legend();"
]
Expand All @@ -69,7 +73,9 @@
"source": [
"from windrose import plot_windrose\n",
"\n",
"plot_windrose(df, kind=\"contour\", bins=np.arange(0.01, 8, 1), cmap=cm.hot, lw=3);"
"plot_windrose(\n",
" df, kind=\"contour\", bins=np.arange(0.01, 8, 1), cmap=cm.hot, lw=3\n",
");"
]
},
{
Expand Down Expand Up @@ -123,7 +129,9 @@
" return ax\n",
"\n",
"\n",
"plot_month(df, (2014, 7), kind=\"contour\", bins=np.arange(0, 10, 1), cmap=cm.hot);"
"plot_month(\n",
" df, (2014, 7), kind=\"contour\", bins=np.arange(0, 10, 1), cmap=cm.hot\n",
");"
]
},
{
Expand All @@ -132,7 +140,9 @@
"metadata": {},
"outputs": [],
"source": [
"plot_month(df, (2014, 8), kind=\"contour\", bins=np.arange(0, 10, 1), cmap=cm.hot);"
"plot_month(\n",
" df, (2014, 8), kind=\"contour\", bins=np.arange(0, 10, 1), cmap=cm.hot\n",
");"
]
},
{
Expand All @@ -141,7 +151,9 @@
"metadata": {},
"outputs": [],
"source": [
"plot_month(df, (2014, 9), kind=\"contour\", bins=np.arange(0, 10, 1), cmap=cm.hot);"
"plot_month(\n",
" df, (2014, 9), kind=\"contour\", bins=np.arange(0, 10, 1), cmap=cm.hot\n",
");"
]
}
],
Expand Down
14 changes: 8 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ maintainers = [
authors = [
{ name = "Lionel Roubeyrie", email = "s.celles@gmail.co" },
]
requires-python = ">=3.10"
requires-python = ">=3.11"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
Expand All @@ -31,20 +30,23 @@ dependencies = [
"matplotlib>=3",
"numpy>=1.21",
]
optional-dependencies.docs = [ "jupyter", "nbsphinx", "seaborn", "sphinx", "sphinx-copybutton", "sphinx-rtd-theme" ]
optional-dependencies.extras = [
"pandas",
"scipy",
]
optional-dependencies.tests = [

[dependency-groups]
dev = [
"cartopy",
"check-manifest",
"coverage",
"pytest",
"pytest-cov",
"pytest-mpl",
"pytest-sugar"
"pytest-sugar",
{ include-group = "docs" },
]
docs = [ "jupyter", "nbsphinx", "seaborn", "sphinx", "sphinx-copybutton", "sphinx-rtd-theme" ]
urls.documentation = "https://python-windrose.github.io/windrose"
urls.homepage = "https://github.com/python-windrose/windrose"
urls.repository = "https://github.com/python-windrose/windrose"
Expand All @@ -65,7 +67,7 @@ write_to = "windrose/_version.py"
write_to_template = "__version__ = '{version}'"

[tool.ruff]
target-version = "py38"
target-version = "py311"
line-length = 79
lint.select = [
"A", # flake8-builtins
Expand Down
4 changes: 3 additions & 1 deletion tests/test_windrose.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@

def test_windrose_pd_not_default_names():
kind = "scatter"
df_not_default_names = pd.DataFrame({"wind_speed": ws, "wind_direction": wd})
df_not_default_names = pd.DataFrame(
{"wind_speed": ws, "wind_direction": wd},
)
plot_windrose(
df_not_default_names,
kind=kind,
Expand Down
8 changes: 7 additions & 1 deletion tests/test_windrose_np_mpl_oo.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,13 @@ def test_filled_with_colormap_calm_limit():
# A windrose in filled representation, with a controlled colormap and a calm limit
ax = WindroseAxes.from_ax()
# the bins most not be below the calm_limit
ax.contourf(wd, ws, bins=[0.2, 1, 2, 3, 4, 5, 6, 7], cmap=cm.hot, calm_limit=0.2)
ax.contourf(
wd,
ws,
bins=[0.2, 1, 2, 3, 4, 5, 6, 7],
cmap=cm.hot,
calm_limit=0.2,
)
ax.set_legend()
return ax.figure

Expand Down
21 changes: 18 additions & 3 deletions tests/test_windrose_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,13 @@ def test_scatter():
@pytest.mark.mpl_image_compare(baseline_dir="output/df", tolerance=20)
def test_bar():
kind = "bar"
ax = plot_windrose(df, kind=kind, normed=True, opening=0.8, edgecolor="white")
ax = plot_windrose(
df,
kind=kind,
normed=True,
opening=0.8,
edgecolor="white",
)
return ax.figure


Expand All @@ -52,7 +58,13 @@ def test_contourf():
@pytest.mark.mpl_image_compare(baseline_dir="output/df", tolerance=20)
def test_contour():
kind = "contour"
ax = plot_windrose(df, kind=kind, bins=np.arange(0.01, 8, 1), cmap=cm.hot, lw=3)
ax = plot_windrose(
df,
kind=kind,
bins=np.arange(0.01, 8, 1),
cmap=cm.hot,
lw=3,
)
return ax.figure


Expand All @@ -73,7 +85,10 @@ def test_windrose_np_plot_and_pd_plot():

@pytest.mark.mpl_image_compare(baseline_dir="output/df")
def test_subplots():
fig, (ax1, ax2) = plt.subplots(ncols=2, subplot_kw={"projection": "windrose"})
fig, (ax1, ax2) = plt.subplots(
ncols=2,
subplot_kw={"projection": "windrose"},
)
plot_windrose(df, ax=ax1)
plot_windrose(df, ax=ax2)
return fig
Loading
Loading