Skip to content

SamudrACE

GlobalCM202540 GB

Import path: earth2studio.models.px.SamudrACE

View source on GitHub View install commands

Documentation

Bases: Module, AutoModelMixin, PrognosticMixin

SamudrACE coupled climate emulator.

Couples the ACE2 atmosphere emulator with the Samudra ocean emulator, driven by FME's CoupledStepper. The atmosphere advances in 6 hour steps and the ocean advances once per coupled (5 day) cycle; all coupling logic (SST prescription, flux exchange and averaging, ocean-fraction prediction, masking) is owned by FME via CoupledStepper.predict, which this wrapper calls exactly once per coupled cycle.

A direct call and each create_iterator yield return one complete coupled-cycle forecast chunk. Atmosphere fields update at each frame; ocean fields update at the final frame and remain constant between cycle boundaries. Ocean diagnostic fields are NaN before the first boundary. The initial condition is not yielded.

The caller supplies the initial forcing window and sends new forcing frames for each subsequent cycle. The rear hook transforms every forecast chunk before publication; the front hook runs before subsequent cycles.

Times are CM4 model years (e.g. year 151), which are outside the range of nanosecond-precision timestamps; provide time coordinates as second-precision np.datetime64 values. Trajectories that cross a February 29 of the proleptic Gregorian time coordinate raise an error when forcing is prepared, since that date has no counterpart on the no-leap forcing calendar.

cuDNN autotuning (torch.backends.cudnn.benchmark) is left at its default (disabled). Toggling it on and off around each coupled cycle was found to make inference non-reproducible run-to-run: with a run-specific, GPU-timing-based algorithm search re-triggered every cycle, cuDNN can select a different (numerically non-identical) algorithm on different runs, which the coupled system's chaotic dynamics then amplify over the forecast.

Note

For more information see the following references:

Parameters:

  • stepper (CoupledStepper) –

    FME coupled stepper holding the atmosphere and ocean component steppers and the coupling configuration. Both components must be on the same latitude-longitude grid.

  • forcing_data_source (DataSource) –

    Data source providing all exogenous forcing variables required by the coupled stepper (both atmosphere and ocean), on the model grid and with the model's Earth2Studio variable names (see SamudrACELexicon).

__call__

__call__(x: DataArray, forcing: DataArray) -> DataArray

Return the complete forecast chunk for one coupled cycle, without hooks.

Parameters:

  • x (DataArray) –

    Coupled prognostic state with arbitrary leading dimensions.

  • forcing (DataArray) –

    Complete initial forcing window including the cycle-start boundary.

Returns:

  • DataArray –

    All atmosphere forecasts in the cycle, with ocean fields held until the final frame updates them at the coupled boundary.

create_iterator

create_iterator(
    x: DataArray, forcing: DataArray
) -> Generator[
    DataArray,
    DataArray | tuple[DataArray, ...] | None,
    None,
]

Yield complete coupled forecast cycles, beginning with the first forecast.

Ocean output fields update at the final frame of each cycle and are held constant between boundaries. Send new forcing frames for the next cycle.

Parameters:

  • x (DataArray) –

    Coupled initial state.

  • forcing (DataArray) –

    Initial forcing window, including the cycle start.

Yields:

  • DataArray –

    Complete forecast chunk for one coupled cycle.

load_default_package classmethod

load_default_package() -> Package

Load the default SamudrACE model package from HuggingFace.

Returns:

  • Package –

    Package holding the allenai/SamudrACE-CM4-piControl checkpoint, pinned to a specific repository revision

load_model classmethod

load_model(
    package: Package,
    forcing_data_source: DataSource | None = None,
    scenario: str = "0311",
) -> PrognosticMixin

Load SamudrACE prognostic from package.

Parameters:

  • package (Package) –

    Package holding the coupled model checkpoint

  • forcing_data_source (DataSource | None, default: None ) –

    External data source providing all exogenous forcing variables required by the coupled stepper, on the model grid and with the model's Earth2Studio variable names. If None, a SamudrACEForcingData source for the selected scenario is used, by default None

  • scenario (str, default: '0311' ) –

    Forcing scenario for the default forcing data source, either "0151" or "0311"; ignored when forcing_data_source is provided, by default "0311"

Returns:

  • PrognosticMixin –

    Prognostic model