earth2studio.models.px
.Persistence#
- class earth2studio.models.px.Persistence(variable, domain_coords, history=1, dt=numpy.timedelta64(6, 'h'))[source]#
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) – The coordinates representing the domain for this model to operate on.
history (int)
dt (timedelta64)
- __call__(x, coords)[source]#
Runs prognostic model 1 step.
- Parameters:
x (torch.Tensor) – Input tensor
coords (CoordSystem) – Coordinate system, should have dimensions
[time, variable, *domain_dims]
- Returns:
x (torch.Tensor)
coords (CoordSystem)
- Return type:
tuple[Tensor, OrderedDict[str, ndarray]]
- create_iterator(x, coords)[source]#
Creates a iterator which can be used to perform time-integration of the prognostic model. Will return the initial condition first (0th step).
- Parameters:
x (torch.Tensor) – Input tensor
coords (CoordSystem) – Input coordinate system
- Yields:
Iterator[tuple[torch.Tensor, CoordSystem]] – Iterator that generates time-steps of the prognostic model container the output data tensor and coordinate system dictionary.
- Return type:
Iterator[tuple[Tensor, OrderedDict[str, ndarray]]]