Skip to content

Persistence

GlobalNVIDIAPyTorch

Import path: earth2studio.models.px.Persistence

View source on GitHub

Documentation

Bases: Module, PrognosticMixin

Persistence model that generates a forecast by applying the identity operator on the initial condition and indexing the lead time by 6 hours. Primarily used in testing.

Parameters:

  • variable (Union[str, List[str]]) –

    The variable or list of variables predicted by the model.

  • domain_coords (CoordSystem | GridDefinition | str) –

    Domain coordinates, grid definition, or registered grid name.

  • history (int, default: 1 ) –

    Specifies the number of previous time steps to include as input, by default set to 1.

  • dt (timedelta64, default: timedelta64(6, 'h') ) –

    Time-step size of model between inputs and output, by default np.timedelta64(6, "h")

__call__

__call__(x: DataArray) -> DataArray

Persist the final history field for one time step without hooks.

Parameters:

  • x (DataArray) –

    Initial history matching input_coords().

Returns:

  • DataArray –

    Owned copy of the final history field on the same device, with lead time advanced by the configured time step.

create_iterator

create_iterator(
    x: DataArray,
) -> Generator[DataArray, None, None]

Yield forecasts starting with the first prediction after the input.

With a level 2 checkpoint, the latest forecast is saved after each yield and a resumed run continues from it instead of re-initializing from x.

Parameters:

  • x (DataArray) –

    Initial history matching input_coords().

Yields:

  • DataArray –

    Persisted forecasts after the rear hook. The front hook runs before subsequent steps; both hooks feed recurrence directly.