Skip to content

Bring monet-stats in for more statistics and lazy capabilities#413

Open
bbakernoaa wants to merge 10 commits into
NCAR:developfrom
bbakernoaa:feature/monet-stats
Open

Bring monet-stats in for more statistics and lazy capabilities#413
bbakernoaa wants to merge 10 commits into
NCAR:developfrom
bbakernoaa:feature/monet-stats

Conversation

@bbakernoaa

@bbakernoaa bbakernoaa commented Jan 22, 2026

Copy link
Copy Markdown
Contributor

This change replaces the internal statistics module in melodies_monet with the external monet-stats library. It exposes all statistics available in monet-stats through dynamic discovery in melodies_monet/stats/proc_stats.py. The build system (setup.cfg and conda environment) and CI configurations were updated to include monet-stats as a dependency. A new test suite was added to ensure identical results for NumPy and Dask-backed arrays, following the Aero Protocol. Additionally, the entire codebase was reformatted to a maximum line length of 132 characters using Ruff.

This pull request introduces several improvements and updates across the documentation, CI workflow, and example scripts. The main changes include adding support for the monet-stats package, as mentioned previously, in both the CI workflow and documentation environment, expanding the API documentation structure, and standardizing code formatting in example scripts for consistency and readability.

CI and Environment Updates

  • Updated .github/workflows/ci.yml to install development versions of monet-stats alongside monet and monetio when running CI with the dev matrix, ensuring the latest features are tested.
  • Added monet-stats as a dependency in docs/environment-docs.yml to support documentation builds and examples that rely on this package.

Documentation Improvements

  • Expanded the API documentation in docs/api.rst to include driver.analysis, driver.model, driver.observation, and driver.pair, providing more granular and organized API references.
  • Updated docs/conf.py to mock the ESMF import for autodoc, preventing documentation build failures when ESMF is not available. Also expanded the linkcheck_ignore list to account for moved or broken links. [1] [2]

Code Formatting and Consistency in Examples

  • Standardized string quoting (using double quotes), improved dictionary formatting, and enhanced readability in all example scripts, including Monet-analysis-example-plots-wrf-rapchemtest.py, Monet-analysis-example-plots-wrf-rapchemtest_aeronet.py, folium_site_map_aeronet.py, folium_site_map_airnow.py, reformat_aeronet_rapchemtest.py, reformat_airnow_rapchemtest.py, and site_analysis_aeronet.py. This change reduces potential errors and improves code maintainability. [1] [2] [3] [4] [5] [6] [7]

Documentation Configuration Tweaks

  • Commented out the "special-members": "__init__" option in docs/conf.py to potentially reduce clutter in API docs and focus on relevant members.

These changes collectively improve the project's documentation, testing reliability, and code quality, making it easier for users and contributors to work with the package.

google-labs-jules Bot and others added 10 commits January 22, 2026 01:35
- Added monet-stats to setup.cfg and docs/environment-docs.yml
- Updated CI build to include monet-stats in dev builds
- Refactored melodies_monet/stats/proc_stats.py to use monet-stats with dynamic discovery
- Updated melodies_monet/plots/surfplots.py to import scores from monet-stats
- Added unit tests in melodies_monet/tests/test_stats.py for NumPy and Dask arrays
- Reformatted codebase with ruff using 132 character line length
…ebase

- Added monet-stats to setup.cfg and docs/environment-docs.yml
- Updated CI build to include monet-stats in dev builds
- Refactored melodies_monet/stats/proc_stats.py to use monet-stats with dynamic discovery
- Updated melodies_monet/plots/surfplots.py to import scores from monet-stats
- Added unit tests in melodies_monet/tests/test_stats.py for NumPy and Dask arrays
- Reformatted codebase with ruff using 132 character line length (excluding notebooks)
…ebase

- Added monet-stats to setup.cfg and docs/environment-docs.yml (pip section)
- Updated CI build to include monet-stats in dev builds
- Refactored melodies_monet/stats/proc_stats.py to use monet-stats with dynamic discovery
- Updated melodies_monet/plots/surfplots.py to import scores from monet-stats
- Added unit tests in melodies_monet/tests/test_stats.py for NumPy and Dask arrays
- Added license headers to previously missing files
- Reformatted codebase with ruff using 132 character line length (excluding notebooks)
…ebase

- Added monet-stats to setup.cfg
- Updated docs/environment-docs.yml to install monet-stats from GitHub
- Updated CI build to include monet-stats in dev builds
- Refactored melodies_monet/stats/proc_stats.py to use monet-stats with dynamic discovery
- Updated melodies_monet/plots/surfplots.py to import scores from monet-stats
- Added unit tests in melodies_monet/tests/test_stats.py for NumPy and Dask arrays
- Added license headers to previously missing files
- Reformatted codebase with ruff using 132 character line length (excluding notebooks)
…ebase

- Added monet-stats to setup.cfg
- Pinned pandas<2.0 in setup.cfg and environment-docs.yml to ensure compatibility
- Updated docs/environment-docs.yml to install monet-stats from GitHub via pip
- Updated CI build to include monet-stats in dev builds with --no-deps
- Refactored melodies_monet/stats/proc_stats.py to use monet-stats with dynamic discovery
- Updated melodies_monet/plots/surfplots.py to import scores from monet-stats
- Added unit tests in melodies_monet/tests/test_stats.py for NumPy and Dask arrays
- Added missing license headers to driver files and new test file
- Reformatted codebase with ruff using 132 character line length (excluding notebooks)
…ebase

- Added monet-stats to setup.cfg
- Pinned pandas<2.0 in setup.cfg and environment-docs.yml to ensure compatibility with monetio readers
- Updated docs/environment-docs.yml to install monet-stats from GitHub via pip
- Updated docs/conf.py to ignore pre-existing broken links in linkcheck
- Updated CI build to include monet-stats in dev builds
- Refactored melodies_monet/stats/proc_stats.py to use monet-stats with dynamic discovery
- Updated melodies_monet/plots/surfplots.py to import scores from monet-stats
- Added unit tests in melodies_monet/tests/test_stats.py for NumPy and Dask arrays
- Added missing license headers to driver files and new test file
- Reformatted codebase with ruff using 132 character line length (excluding notebooks)
- Integrated monet-stats library with dynamic discovery of metrics
- Refactored stats calculations to support NumPy, Pandas, and Dask arrays
- Pinned Pandas < 2.0 to ensure compatibility with existing readers
- Fixed Sphinx documentation build by resolving duplicate object descriptions in the driver package
- Added missing license headers to driver and test files
- Reformatted codebase with Ruff (132-char line length)
- Added comprehensive unit tests for the new statistics integration
- Updated CI and documentation environments to include monet-stats dependency from GitHub
This commit refactors the statistics calculation engine to use the
external `monet-stats` library.

Key changes:
- Refactored `melodies_monet/stats/proc_stats.py` to dynamically discover
  available statistics from the `monet-stats` library submodules.
- Updated `setup.cfg` and `docs/environment-docs.yml` to include
  `monet-stats` as a dependency via Git.
- Updated `.github/workflows/ci.yml` to install `monet-stats` in CI.
- Updated `docs/conf.py` and API documentation `.rst` files to resolve
  duplicate object description errors and mock missing `ESMF` dependency.
- Formatted the codebase to a 132-character line length (excluding notebooks).
- Added SPDX Apache-2.0 license headers to several files.
- Added `melodies_monet/tests/test_stats.py` to verify backend-agnostic
  (NumPy, Pandas, Dask) statistics calculations.
- Pinned `pandas < 2.0` to maintain compatibility with `monetio` readers.
- Fixed a minor bug in `write_util.py` where 'Z' and '0' were merged in
  the allowed characters list.
- Explicitly list driver submodules in api.rst to avoid recursive duplicate descriptions.
- Disable global special-members: __init__ in conf.py (redundant and causing duplicates).
- Ensure mock imports for ESMF are correctly set in conf.py.
- Verified successful clean build with sphinx-build -W.
…961284476

Integrate monet-stats library and reformat codebase
@bbakernoaa bbakernoaa changed the base branch from main to develop January 22, 2026 12:18
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.

1 participant