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)¶ Bases:
object
Represents information for a single node: ID and timeseries data.
-
property
id
¶ Node ID
-
property
data
¶ Time series data for this node.
-
property
-
class
emod_api.weather.weather.
Metadata
(node_ids: List[int], datavalue_count: int, author: str = None, created: datetime.datetime = None, frequency: str = None, provenance: str = None, reference: str = None)¶ Bases:
object
Metadata:
[DateCreated]
[Author]
[OriginalDataYears]
[StartDayOfYear]
[DataProvenance]
IdReference
NodeCount
DatavalueCount
UpdateResolution
NodeOffsets
Author of this file.
-
property
creation_date
¶ Creation date of this file.
-
property
datavalue_count
¶ Number of data values in each timeseries, should be > 0.
-
property
id_reference
¶ ‘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
-
property
node_count
¶
-
property
node_ids
¶
-
property
provenance
¶
-
property
update_resolution
¶
-
property
nodes
¶ WeatherNodes offsets keyed by node id.
-
class
emod_api.weather.weather.
Weather
(filename: str = None, node_ids: List[int] = None, datavalue_count: int = None, author: str = None, created: datetime.datetime = None, frequency: str = None, provenance: str = None, reference: str = None, data: numpy.array = None)¶ Bases:
object
-
property
data
¶ Raw data as numpy array[node index, time step].
-
property
metadata
¶
-
property
creation_date
¶
-
property
datavalue_count
¶ >= 1
-
property
id_reference
¶
-
property
node_count
¶ >= 1
-
property
node_ids
¶
-
property
provenance
¶
-
property
update_resolution
¶
-
property
nodes
¶ 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, provenance: str = None)¶ 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.
-
property