Skip to content

CAMulator

GlobalCM202524 GBNCARPyTorch

Import path: earth2studio.models.px.CAMulator

View source on GitHub View install commands

Documentation

Bases: Module, AutoModelMixin, PrognosticMixin

CAMulator: NSF NCAR's autoregressive emulator of the CAM6 atmosphere, trained in the CREDIT framework. A CrossFormer encoder-decoder advances a 1 degree (192x288), 32 hybrid-sigma-level atmospheric state by 6 hours given prescribed sea-surface temperature, sea-ice fraction, TOA insolation and CO2 forcing, for climate-length rollouts. The inference-time post-processing of the CREDIT toolbox is reproduced: tracer clipping, the jet wind-artifact filter and the global dry-air mass, water and total-energy conservation fixers.

The 130 prognostic variables are the model input; the output additionally holds 17 output-only diagnostics (precipitation, surface temperature, cloud fractions, surface stresses, 10 m wind speed, evaporation and radiative/heat fluxes). The iterator yields forecasts only, and only the prognostic slice is fed back at each step. Vertical levels use the {var}{k}k naming with k the CAMulator hybrid level index (0 = top of model, 31 = lowest layer). Fluxes CAMulator accumulates over the 6 h step (J m-2) are returned as mean rates (W m-2); precipitation and evaporation are 6 h accumulations (m).

Note

Callers supply forcing at the input valid time on the CAMulator grid. default_sources recommends CAMulatorForcing, which serves the shipped climatological (cyclic) year; the forcing files use a 365-day calendar, so leap days reuse the 28 February forcing.

Note

For more information see:

Parameters:

  • core_model (Module) –

    CAMulator CrossFormer network mapping (batch, 136, 1, lat, lon) to (batch, 147, 1, lat, lon) in normalized units.

  • center (Tensor) –

    Normalization mean of the 147 output channels, shape (147, lat, lon).

  • scale (Tensor) –

    Normalization std of the 147 output channels, shape (147, lat, lon).

  • forcing_center (Tensor) –

    Normalization mean of the 4 forcing channels, shape (4,).

  • forcing_scale (Tensor) –

    Normalization std of the 4 forcing channels, shape (4,).

  • tracer_center (Tensor) –

    Normalization mean used by the tracer clipping, one per tracer channel.

  • tracer_scale (Tensor) –

    Normalization std used by the tracer clipping, one per tracer channel.

  • statics (Tensor) –

    Static input fields z_norm and LANDM_COSLAT, shape (2, lat, lon).

  • hyai (Tensor) –

    Hybrid a interface coefficients (Pa), shape (33,).

  • hybi (Tensor) –

    Hybrid b interface coefficients, shape (33,).

  • area (Tensor) –

    Grid-cell area (m^2), shape (lat, lon).

  • phis (Tensor) –

    Surface geopotential (m^2 s-2), shape (lat, lon).

  • forcing_data_source (DataSource, default: None ) –

    Data source providing mtdwswrf, sst, sic and global_mean_co2 on the CAMulator grid, by default CAMulatorForcing().

  • conservation_fixers (bool, default: True ) –

    Apply the global mass, water and energy fixers, by default True.

  • wind_filter (bool, default: True ) –

    Apply the wind-artifact filter, by default True.

__call__

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

Predict six hours ahead without iterator hooks.

Parameters:

  • x (DataArray) –

    Initial fields matching input_coords().

  • forcing (DataArray) –

    Forcing at the input valid time matching forcing_coords().

Returns:

  • DataArray –

    First forecast matching output_coords(x).

create_iterator

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

Yield forecasts, accepting each new forcing frame through send.

Parameters:

  • x (DataArray) –

    Initial fields matching input_coords().

  • forcing (DataArray) –

    Initial forcing at the input valid time.

Yields:

  • DataArray –

    Forecasts beginning with initialize. The rear hook runs before every yield and the front hook before each subsequent step.

load_default_package classmethod

load_default_package() -> Package

Load the default CAMulator package from HuggingFace

Returns:

load_model classmethod

load_model(
    package: Package,
    checkpoint: str = "checkpoint.pt00069.pt",
    forcing_data_source: DataSource | None = None,
    conservation_fixers: bool = True,
    wind_filter: bool = True,
) -> PrognosticModel

Load prognostic model from package

Parameters:

  • package (Package) –

    Package to load model from

  • checkpoint (str, default: 'checkpoint.pt00069.pt' ) –

    Checkpoint file in the package. The HuggingFace repository hosts several training epochs (checkpoint.pt000NN.pt); epoch 69 is the model card default, by default "checkpoint.pt00069.pt"

  • forcing_data_source (DataSource, default: None ) –

    Forcing data source, by default CAMulatorForcing()

  • conservation_fixers (bool, default: True ) –

    Apply the global mass, water and energy fixers, by default True

  • wind_filter (bool, default: True ) –

    Apply the wind-artifact filter, by default True

Returns:

  • PrognosticModel –

    Prognostic model