weatherTypes.ts
Shared weather data types used across prediction logic and cache persistence
Purpose
This module defines the canonical type for a single normalized weather observation or forecast point used throughout the application.
It serves as the single source of truth for the weather data shape shared between:
- NDFD forecast fetching and normalization
- WBGT and core temperature prediction pipelines
- Cache persistence and retrieval
Invariants
Field Units
All fields in WeatherPoint use internal application units as normalized by the NDFD fetch layer:
| Field | Unit | Description |
|---|---|---|
time | ISO 8601 string | Forecast valid time |
temp | Celsius (°C) | Air temperature |
rh | Percent (0–100) | Relative humidity |
wspd | Meters/second | Wind speed |
sky | Percent (0–100) | Cloud cover / sky obscuration |
Upstream unit conversion (Fahrenheit → Celsius, knots → m/s) is performed by the fetch layer before any WeatherPoint is constructed.
Exports
WeatherPoint
type WeatherPoint = {
time: string;
temp: number;
rh: number;
wspd: number;
sky: number;
};
Represents a single weather observation or forecast entry in internal application units. Every field is always present; partial points are never constructed (enforced upstream by the NDFD fetch layer).