Skip to content

Add ACCESS-MOPPy Plugin for Live CMORisation#552

Open
rbeucher wants to merge 7 commits intomainfrom
feature/moppy-plugin
Open

Add ACCESS-MOPPy Plugin for Live CMORisation#552
rbeucher wants to merge 7 commits intomainfrom
feature/moppy-plugin

Conversation

@rbeucher
Copy link
Copy Markdown
Member

Add ACCESS-MOPPy Plugin for Live CMORization

This PR adds a skeleton implementation for integrating ACCESS-MOPPy with the ACCESS-NRI intake catalog, enabling live CMORization of data during retrieval.

What it does

Adds a .to_cmip() method to intake datastore objects that will apply CMOR processing using ACCESS-MOPPy:

# Instead of multi-step CMORization
ds = cat["ACCESS-ESM1-5"].search(variable="tas").to_dask()
# ... manual CMOR steps ...

# One-line CMORization (when ACCESS-MOPPy is available)
ds = cat["ACCESS-ESM1-5"].search(variable="tas").to_cmip()

Implementation

  • Plugin system: Monkey patches esm_datastore to add the .to_cmip() method
  • Auto-enabled: Works automatically when importing access_nri_intake
  • Graceful fallback: Handles missing ACCESS-MOPPy dependency cleanly
  • No breaking changes: Fully backward compatible

Current Status

This is a skeleton implementation - the plugin framework is complete but the actual CMORization is placeholder code waiting for ACCESS-MOPPy integration.

What works now:

  • Plugin architecture and method injection
  • Error handling and safety checks
  • Integration with existing catalog infrastructure

What needs ACCESS-MOPPy:

  • Actual CMOR processing logic
  • Real variable mapping and metadata handling

Usage (once ACCESS-MOPPy is integrated)

import access_nri_intake
cat = access_nri_intake.data

# Basic usage
ds = cat["WOA-13"].search(...).to_cmip()

# With options
ds = cat["ACCESS-OM2"].search(variable="temp").to_cmip(
    cmor_table="Omon",
    variable_id="thetao"
)

Files Changed

  • src/access_nri_intake/plugins/moppy.py - Main plugin implementation
  • src/access_nri_intake/__init__.py - Auto-enable plugin
  • src/access_nri_intake/ipython_magic/ast.py - Monitor .to_cmip() calls
  • pyproject.toml - Add optional moppy dependency group
  • tests/test_moppy_plugin.py - Comprehensive test suite

Ready for ACCESS-MOPPy integration when the package becomes available.

- Introduced the ACCESS-MOPPy plugin for CMORization capabilities in ESM datastores.
- Enabled automatic plugin activation if available.
- Updated `pyproject.toml` to include optional dependencies for the plugin.
- Added tests for plugin functionality, including enabling/disabling and method availability checks.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

2 participants