Skip to content

Compat

compat

FastMeteo-compatible façade (pip install 'barograph-met[pandas]').

Same class names, constructor arguments and interpolate(df) contract as FastMeteo 1.2 (input columns timestamp, latitude, longitude, altitude in ft; output = input + one column per feature), backed by this library's engine. Deliberate differences, all documented:

  • points that cannot be interpolated get NaN instead of an extrapolated value; the reason is available in last_result.flags (or flags_column);
  • local_store is a cache of the byte ranges read (immutable data only), not a global zarr copy; mode="global" reads whole fields (FastMeteo-like cost, reusable cache);
  • model levels use all 137 levels with the actual surface pressure;
  • ARPEGE lead-time files are resolved automatically (time_range is ignored).

With default options, pressure-level results equal FastMeteo's to float round-off wherever FastMeteo does not extrapolate.

ArcoEra5

Bases: _FrameEnricher

ERA5 from ARCO: model_levels=37 (pressure levels) or 137 (model levels).

Source code in packages/barograph-met/src/baro/met/compat.py
class ArcoEra5(_FrameEnricher):
    """ERA5 from ARCO: ``model_levels=37`` (pressure levels) or ``137`` (model levels)."""

    def __init__(  # noqa: PLR0913 - same signature as fastmeteo.source.ArcoEra5
        self,
        local_store: str | None = None,
        model_levels: Literal[37, 137] = 37,
        features: list[str] | None = None,
        *,
        levels: Sequence[int] | None = None,
        mode: Mode = "flight",
        vertical: VerticalMethod | None = None,
        flags_column: str | None = None,
        base_url: str = ARCO_BASE_URL,
        **options: Any,
    ) -> None:
        self.features = list(features or ERA5_FEATURES)
        self.flags_column = flags_column
        fields = {f: f for f in self.features}
        if model_levels == _PRESSURE_LEVEL_STORE:
            source: Source = arco_pressure_levels(
                levels=FASTMETEO_LEVELS_22 if levels is None else levels,
                fields=fields,
                base_url=base_url,
            )
            default_vertical: VerticalMethod = "linear"  # FastMeteo interpolates linearly in p
        elif model_levels == _MODEL_LEVEL_STORE:
            source = arco_model_levels(levels=levels, fields=fields, base_url=base_url)
            default_vertical = "log"
        else:
            raise ValueError("model_levels must be 37 or 137")
        self._setup(
            source, local_store, mode=mode, vertical=vertical or default_vertical, **options
        )

Arpege

Bases: _FrameEnricher

Météo-France ARPEGE forecasts (0.25 deg global or 0.1 deg Europe; hourly to 48 h).

Source code in packages/barograph-met/src/baro/met/compat.py
class Arpege(_FrameEnricher):
    """Météo-France ARPEGE forecasts (0.25 deg global or 0.1 deg Europe; hourly to 48 h)."""

    def __init__(  # noqa: PLR0913, PLR0917 - same signature as fastmeteo.source.Arpege
        self,
        local_store: str | None = None,
        levels: Sequence[int] | None = None,
        features: list[str] | None = None,
        resolution: Literal["025", "01"] = "025",
        package: str = "IP1",
        time_range: str | None = None,
        *,
        run: RunPolicy = "daily",
        mode: Mode = "flight",
        vertical: VerticalMethod = "linear",
        index_dir: str | None = None,
        flags_column: str | None = None,
        base_url: str = ARPEGE_BASE_URL,
        **options: Any,
    ) -> None:
        if time_range is not None:
            warnings.warn(
                "time_range is resolved automatically from each point's lead time and is ignored",
                stacklevel=2,
            )
        self.features = list(features or ARPEGE_FEATURES)
        self.flags_column = flags_column
        if index_dir is None and local_store is not None:
            index_dir = str(Path(local_store) / "grib-index")
        source = ArpegeSource(
            resolution=resolution,
            package=package,
            fields={f: f for f in self.features},
            levels=FASTMETEO_LEVELS_22 if levels is None else levels,
            run=run,
            index_dir=index_dir,
            base_url=base_url,
        )
        self._setup(source, local_store, mode=mode, vertical=vertical, **options)

    def local_interpolate(self, df: pd.DataFrame) -> pd.DataFrame:
        """Alias kept for FastMeteo compatibility (there is no global zarr to build)."""
        return self.interpolate(df)
local_interpolate(df)

Alias kept for FastMeteo compatibility (there is no global zarr to build).

Source code in packages/barograph-met/src/baro/met/compat.py
def local_interpolate(self, df: pd.DataFrame) -> pd.DataFrame:
    """Alias kept for FastMeteo compatibility (there is no global zarr to build)."""
    return self.interpolate(df)