emod_api.weather.weather module#
emod-api Weather module - Weather, Metadata, and WeatherNode objects along with IDREF and CLIMATE_UPDATE constants.
- class emod_api.weather.weather.WeatherNode(node_id: int, data)[source]#
Bases:
object
Represents information for a single node: ID and timeseries data.
- property data#
Time series data for this node.
- class emod_api.weather.weather.Metadata(node_ids: List[int], datavalue_count: int, author: str | None = None, created: datetime | None = None, frequency: str | None = None, provenance: str | None = None, reference: str | None = None)[source]#
Bases:
object
Metadata:
[DateCreated]
[Author]
[OriginalDataYears]
[StartDayOfYear]
[DataProvenance]
IdReference
NodeCount
DatavalueCount
UpdateResolution
NodeOffsets
- property id_reference: str#
‘Schema’ for node IDs. Commonly Legacy, Gridded world grump2.5arcmin, and Gridded world grump30arcsec.
Legacy usually indicates a 0 or 1 based scheme with increasing ID numbers.
Gridded world grump2.5arcmin and Gridded world grump30arcsec encode latitude and longitude values in the node ID with the following formula:
latitude = (((nodeid - 1) & 0xFFFF) * resolution) - 90 longitude = ((nodeid >> 16) * resolution) - 180 # nodeid = 90967271 @ 2.5 arcmin resolution # longitude = -122.1667, latitude = 47.5833
- class emod_api.weather.weather.Weather(filename: str | None = None, node_ids: List[int] | None = None, datavalue_count: int | None = None, author: str | None = None, created: datetime | None = None, frequency: str | None = None, provenance: str | None = None, reference: str | None = None, data: array | None = None)[source]#
Bases:
object
- property data: array#
Raw data as numpy array[node index, time step].
- property nodes: Dict[int, WeatherNode]#
WeatherNodes indexed by node id.
- classmethod from_csv(filename: str, var_column: str = 'airtemp', id_column: str = 'node_id', step_column: str = 'step', author: str | None = None, provenance: str | None = None)[source]#
Create weather from CSV file with specified variable column, node id column, and time step column.
Note
Column order in the CSV file is not significant, but columns names must match what is passed to this function.
Because a CSV might hold air temperature (may be negative and well outside 0-1 values), relative humidity (must _not_ be negative, must be in the interval [0-1]), or rainfall (must _not_ be negative, likely > 1), this function does not validate incoming data.