Skip to content

InterpEquirectangular

GlobalNADANVIDIAPyTorch

Import path: earth2studio.models.da.InterpEquirectangular

View source on GitHub View install commands

Documentation

Bases: Module

Interpolation assimilation model that interpolates sparse observations to a lat-lon grid.

This is a sample implementation of an AssimilationModel that: - Accepts DataFrames with observations (time, lat, lon, observation, variable) - Interpolates observations to a regular lat-lon grid using specified method - Validates input observations against schema constraints - Supports interpolation methods: 'nearest' or 'smolyak' (Smolyak sparse grid algorithm)

Parameters:

  • lat (ndarray | None, default: None ) –

    Latitude coordinates for output grid, by default None (uses default grid over CONUS)

  • lon (ndarray | None, default: None ) –

    Longitude coordinates for output grid, by default None (uses default grid over CONUS)

  • interp_method (str, default: 'smolyak' ) –

    Interpolation method to use: 'nearest' or 'smolyak', by default "smolyak"

  • time_tolerance (TimeTolerance, default: timedelta64(10, 'm') ) –

    Time tolerance for filtering observations. Observations within the tolerance window around each requested time will be used for interpolation, by default np.timedelta64(10, "m")

Raises:

  • ValueError –

    If interp_method is not one of the supported methods

__call__

__call__(obs: DataFrame) -> DataArray

Interpolate one independent observation batch onto the output grid.

Parameters:

  • obs (DataFrame) –

    Observations matching input_coords(), with analysis times in attrs["request_time"] and optional output attrs["variable"].

Returns:

  • DataArray –

    Analysis with dimensions (time, variable, lat, lon). Grid fields without observations in the time window contain NaNs.

Raises:

  • ValueError –

    If request times or required observation columns are missing.

set_rng

set_rng(seed: int, reset: bool = True) -> None

No-op: interpolation is deterministic.

Parameters:

  • seed (int) –

    Unused seed.

  • reset (bool, default: True ) –

    Unused reset flag, by default True.

input_coords

input_coords() -> FrameSchema

Observation input schema of the assimilation model.

Returns:

  • FrameSchema –

    Required observation DataFrame fields. The variable field lists acceptable values; time, lat, lon, and observation fields have dynamic values.

output_coords

output_coords(
    obs: FrameSchema | None = None,
    *,
    request_time: ndarray | None = None,
    variable: ndarray | None = None
) -> CoordinateSystem

Output coordinate system of the assimilation model.

Parameters:

  • obs (FrameSchema | None, default: None ) –

    Observation schema; output geometry is configured at construction.

  • request_time (ndarray | None, default: None ) –

    Analysis valid times, by default None (an unspecified time).

  • variable (ndarray | None, default: None ) –

    Output variables, by default None (all supported variables)

Returns:

  • CoordinateSystem –

    Allocation-free analysis signature, using time, variable, lat, and lon dimensions.

default_sources

default_sources() -> None

Return no recommended data sources.

This is a sample model that accepts observations from any provider that reports the supported variables, so the choice is left to the caller.

Returns:

  • None –

    Observation data sources are chosen by the caller.