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
20 changes: 10 additions & 10 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Setup Micromamba
uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 # v3.0.0
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
environment-name: TEST
init-shell: bash
create-args: >-
python=3 pip
--file requirements.txt
--file requirements-dev.txt
--channel conda-forge
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 . --no-deps --force-reinstall
python -m pip install -e .[extras,tests,docs]

- name: Build documentation
run: |
Expand Down
18 changes: 5 additions & 13 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [ "3.10", "3.11", "3.12", "3.13", "3.14" ]
python-version: [ "3.11", "3.12", "3.13", "3.14" ]
os: [ ubuntu-latest ]
include:
- os: windows-latest
Expand All @@ -31,22 +31,14 @@ jobs:
fetch-depth: 0
persist-credentials: false

- name: Setup Micromamba for Python ${{ matrix.python-version }}
uses: mamba-org/setup-micromamba@d7c9bd84e824b79d2af72a2d4196c7f4300d3476 # v3.0.0
- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
# Remove the line below when micromamba 2.6.2 is released.
micromamba-version: '2.6.0-0'
environment-name: TEST
init-shell: bash
create-args: >-
python=${{ matrix.python-version }} pip
--file requirements.txt
--file requirements-dev.txt
--channel conda-forge
python-version: ${{ matrix.python-version }}

- name: Install windrose
run: |
python -m pip install -e . --no-deps --force-reinstall
python -m pip install -e .[extras,tests]

- name: Tests
run: |
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ repos:
- id: add-trailing-comma

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.17
rev: v0.15.18
hooks:
- id: ruff

- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.24.1
rev: v2.25.0
hooks:
- id: pyproject-fmt

Expand All @@ -81,7 +81,7 @@ repos:
- id: nb-strip-paths

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.25.2
rev: v1.26.1
hooks:
- id: zizmor

Expand Down
11 changes: 10 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,27 @@ 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 = [
"cartopy",
"check-manifest",
"coverage",
"pytest",
"pytest-cov",
"pytest-mpl",
"pytest-sugar"
]
urls.documentation = "https://python-windrose.github.io/windrose"
urls.homepage = "https://github.com/python-windrose/windrose"
urls.repository = "https://github.com/python-windrose/windrose"

[tool.setuptools]
packages = [ "windrose" ]
include-package-data = true
dynamic.dependencies = { file = [ "requirements.txt" ] }
dynamic.readme = { file = "README.md", content-type = "text/markdown" }
license-files = [
"LICENSE.txt",
Expand Down
29 changes: 0 additions & 29 deletions requirements-dev.txt

This file was deleted.

4 changes: 0 additions & 4 deletions requirements.txt

This file was deleted.

Binary file modified tests/output/df/test_subplots.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/output/func/test_wrbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tests/test_windrose_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@
df = pd.DataFrame({"speed": ws, "direction": wd})


@pytest.mark.mpl_image_compare(baseline_dir="output/")
@pytest.mark.mpl_image_compare(baseline_dir="output/", tolerance=20)
def test_bar_from_factory():
ax = WindAxesFactory.create("WindroseAxes")
ax.bar(wd, ws, normed=True, opening=0.8, edgecolor="white")
ax.set_legend()
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/")
@pytest.mark.mpl_image_compare(baseline_dir="output/", tolerance=10)
def test_pdf_from_factory():
ax = WindAxesFactory.create("WindAxes")
bins = np.arange(0, 8, 1)
Expand Down
12 changes: 6 additions & 6 deletions tests/test_windrose_np_mpl_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,37 @@
bins = np.arange(0, 8, 1)


@pytest.mark.mpl_image_compare(baseline_dir="output/func")
@pytest.mark.mpl_image_compare(baseline_dir="output/func", tolerance=10)
def test_wrscatter():
ax = wrscatter(wd, ws, alpha=0.2)
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/func", tolerance=15.5)
@pytest.mark.mpl_image_compare(baseline_dir="output/func", tolerance=5)
def test_wrbar():
ax = wrbar(wd, ws, normed=True, opening=0.8, edgecolor="white")
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/func", tolerance=6.5)
@pytest.mark.mpl_image_compare(baseline_dir="output/func", tolerance=20)
def test_wrbox():
ax = wrbox(wd, ws, bins=bins)
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/func")
@pytest.mark.mpl_image_compare(baseline_dir="output/func", tolerance=20)
def test_wrcontourf():
ax = wrcontourf(wd, ws, bins=bins, cmap=cm.hot)
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/func")
@pytest.mark.mpl_image_compare(baseline_dir="output/func", tolerance=20)
def test_wrcontour():
ax = wrcontour(wd, ws, bins=bins, cmap=cm.hot, lw=3)
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/func")
@pytest.mark.mpl_image_compare(baseline_dir="output/func", tolerance=10)
def test_wrpdf():
ax, params = wrpdf(ws, bins=bins)
return ax.figure
22 changes: 11 additions & 11 deletions tests/test_windrose_np_mpl_oo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
df = pd.DataFrame({"speed": ws, "direction": wd})


@pytest.mark.mpl_image_compare(baseline_dir="output/oo")
@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=10)
def test_windrose_with_scatter_plot():
ax = WindroseAxes.from_ax()
ax.scatter(wd, ws, alpha=0.2)
Expand All @@ -36,7 +36,7 @@ def test_windrose_stacked_histogram_normed():
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=6.5)
@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=20)
def test_windrose_stacked_histogram_not_normed_binned():
# Another stacked histogram representation, not normed, with bins limits
ax = WindroseAxes.from_ax()
Expand All @@ -45,7 +45,7 @@ def test_windrose_stacked_histogram_not_normed_binned():
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=6.5)
@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=20)
def test_windrose_stacked_histogram_not_normed_binned_calm_limit():
# Another stacked histogram representation, not normed, with bins limits and a calm limit
ax = WindroseAxes.from_ax()
Expand All @@ -55,7 +55,7 @@ def test_windrose_stacked_histogram_not_normed_binned_calm_limit():
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=15.5)
@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=20)
def test_windrose_stacked_histogram_normed_calm_limit():
# windrose like a stacked histogram with normed (displayed in percent) results and a calm limit
ax = WindroseAxes.from_ax()
Expand All @@ -64,7 +64,7 @@ def test_windrose_stacked_histogram_normed_calm_limit():
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/oo")
@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=20)
def test_filled_with_colormap():
# A windrose in filled representation, with a controlled colormap
ax = WindroseAxes.from_ax()
Expand All @@ -73,7 +73,7 @@ def test_filled_with_colormap():
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/oo")
@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=20)
def test_filled_with_colormap_calm_limit():
# A windrose in filled representation, with a controlled colormap and a calm limit
ax = WindroseAxes.from_ax()
Expand All @@ -83,7 +83,7 @@ def test_filled_with_colormap_calm_limit():
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/oo")
@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=20)
def test_filled_with_colormap_contours():
# Same as above, but with contours over each filled region...
ax = WindroseAxes.from_ax()
Expand All @@ -93,7 +93,7 @@ def test_filled_with_colormap_contours():
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/oo")
@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=20)
def test_filled_with_colormap_contours_calm_limit():
# Same as above, but with contours over each filled region...
ax = WindroseAxes.from_ax()
Expand All @@ -105,15 +105,15 @@ def test_filled_with_colormap_contours_calm_limit():
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/oo")
@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=20)
def test_without_filled_with_colormap_contours():
ax = WindroseAxes.from_ax()
ax.contour(wd, ws, bins=bins, cmap=cm.hot, lw=3)
ax.set_legend()
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/oo")
@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=20)
def test_without_filled_with_colormap_contours_calm_limit():
ax = WindroseAxes.from_ax()
# the bins most not be below the calm_limit
Expand All @@ -129,7 +129,7 @@ def test_without_filled_with_colormap_contours_calm_limit():
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/oo")
@pytest.mark.mpl_image_compare(baseline_dir="output/oo", tolerance=10)
def test_pdf():
ax = WindAxes.from_ax()
bins = np.arange(0, 8, 1)
Expand Down
14 changes: 7 additions & 7 deletions tests/test_windrose_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,49 +21,49 @@
df = pd.DataFrame({"speed": ws, "direction": wd})


@pytest.mark.mpl_image_compare(baseline_dir="output/df")
@pytest.mark.mpl_image_compare(baseline_dir="output/df", tolerance=10)
def test_scatter():
kind = "scatter"
ax = plot_windrose(df, kind=kind, alpha=0.2)
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/df", tolerance=15.5)
@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")
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/df", tolerance=6.5)
@pytest.mark.mpl_image_compare(baseline_dir="output/df", tolerance=20)
def test_box():
kind = "box"
ax = plot_windrose(df, kind=kind, bins=bins)
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/df")
@pytest.mark.mpl_image_compare(baseline_dir="output/df", tolerance=20)
def test_contourf():
kind = "contourf"
ax = plot_windrose(df, kind=kind, bins=np.arange(0.01, 8, 1), cmap=cm.hot)
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/df")
@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)
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/df")
@pytest.mark.mpl_image_compare(baseline_dir="output/df", tolerance=10)
def test_pdf():
kind = "pdf"
ax, params = plot_windrose(df, kind=kind, bins=np.arange(0.01, 8, 1))
return ax.figure


@pytest.mark.mpl_image_compare(baseline_dir="output/df")
@pytest.mark.mpl_image_compare(baseline_dir="output/df", tolerance=10)
def test_windrose_np_plot_and_pd_plot():
# Not really pandas but this is an orphan test and fits the plot_windrose tests.
kind = "scatter"
Expand Down
Loading