Source code for pyiem.models.igra

"""Data Model for IGRA."""

from datetime import datetime
from typing import Annotated

from pydantic import BaseModel, ConfigDict, Field
from shapely.geometry import Point


[docs] class SoundingHeader(BaseModel): """A Center Weather Advisory.""" model_config = ConfigDict(arbitrary_types_allowed=True) station: str valid: datetime release_valid: datetime p_src: Annotated[str, Field(description="Pressure Source")] np_src: Annotated[ str, Field(description="Number of Pressure Levels Source") ] geom: Point
[docs] class SoundingRecord(BaseModel): """Represents a sounding record.""" # 0 should not be possible, but alas lvltyp1: int = Field(..., description="Level Type 1", ge=0, le=3) lvltyp2: int = Field(..., description="Level Type 2", ge=0, le=2) valid: Annotated[datetime | None, Field(description="Valid Time")] = None press: Annotated[float | None, Field(description="Pressure", ge=0)] = None pflag: str gph: Annotated[ int | None, Field(description="Geopotential Height", ge=0) ] = None zflag: str temp: Annotated[ float | None, Field(description="Temperature", ge=-100) ] = None tflag: str rh: Annotated[ float | None, Field(description="Relative Humidity", gt=0, lt=105) ] = None dewp: Annotated[ float | None, Field(description="Dewpoint Temperature", ge=-100) ] = None wdir: Annotated[ int | None, Field(description="Wind Direction", ge=0, le=360) ] = None wspd: Annotated[float | None, Field(description="Wind Speed", ge=0)] = None
[docs] class SoundingModel(BaseModel): """Represents a sounding.""" header: SoundingHeader records: list[SoundingRecord]