Skip to content

Add batch API, Python 3.10+, Fortran vectorization, matplotlib fix#14

Open
Mxade wants to merge 2 commits intorilma:mainfrom
Mxade:pr-to-upstream
Open

Add batch API, Python 3.10+, Fortran vectorization, matplotlib fix#14
Mxade wants to merge 2 commits intorilma:mainfrom
Mxade:pr-to-upstream

Conversation

@Mxade
Copy link
Copy Markdown

@Mxade Mxade commented Mar 12, 2026

Description

This PR adds a vectorized/batch API, broadens Python support, and fixes matplotlib compatibility:

  • hwm14_vectorized() – New function for vectorized/batch evaluation: accepts arrays of altitude, latitude, longitude, and UTC hours and returns zonal/meridional wind arrays in one call. When the Fortran extension is built, a new hwm14_batch subroutine is used for a single Fortran call over N points; otherwise a Python loop over the existing single-point hwm14 is used.
  • requires-python >=3.10 – Relaxed from >=3.13 so the package can be used on Python 3.10–3.13 (and 3.14).
  • PlottingNormalize(vmin, vmax) is now used when both limits are set, instead of passing norm=Normalize() together with vmin/vmax to pcolor, for compatibility with current matplotlib.
  • FORK_README.md – Documents build requirements (Fortran compiler), install from tree, batch API usage, and PR/fork notes.
  • Tests – New TestHWM14Vectorized in test_core.py for the batch API (single point, batch vs HWM14, default ap, broadcast).

Closes

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • My code follows the project style guidelines (black, ruff, mypy)
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix/feature works
  • New and existing tests pass with my changes
  • Test coverage remains > 80%
  • I have updated the documentation (docstrings, README, guides)
  • I have added an entry to CHANGELOG.md
  • I have updated type hints for modified functions

Testing

  • Ran full test suite: pytest tests -v (67 passed, including new TestHWM14Vectorized and existing core/plotting).
  • Verified batch results match HWM14 class for the same inputs.
  • Built and tested with Python 3.14 and gfortran (macOS).
pip install -e .
pytest tests -v

Additional Context

  • Build requires a Fortran compiler (e.g. gfortran); see FORK_README.md.
  • If this PR is not merged, the fork can be maintained and optionally published under a different PyPI name.

Made with: Cursor

- hwm14_vectorized() for vectorized/batch evaluation; Fortran hwm14_batch
- requires-python >=3.10; plotting Normalize(vmin,vmax) for matplotlib
- FORK_README.md: build, usage, PR notes; tests: TestHWM14Vectorized

Made-with: Cursor
@rilma
Copy link
Copy Markdown
Owner

rilma commented Mar 17, 2026

@Mxade, let's start with this. Python version < 3.13 do not provide bug fixes, so let's stick to >= 3.13

FORK_README.md Outdated

## Changes in this fork

- **Python:** `requires-python = ">=3.10"` (was 3.13+).
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Python versions < 3.13 are not longer with big fixes, see here, so let's stick with the support for >= 3.13 as originally implemented in the repo.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rilma Done — reverted to requires-python >= 3.13 and updated FORK_README.md per your comment. Batch API / Fortran / plotting / tests unchanged. Thanks again.

Revert Python 3.10–3.12 trove classifiers. Update FORK_README to match.

Made-with: Cursor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants