emodpy_malaria.weather.weather_metadata module#
Weather metadata module, implementing functionality for working with weather metadata files (.bin.json).
- class emodpy_malaria.weather.weather_metadata.WeatherAttributes(attributes_dict: Dict[str, str | int | float] | None = None, reference: str | None = None, resolution: str | None = None, provenance: str | None = None, update_freq: str | None = None, start_year: int | None = None, end_year: int | None = None, start_doy: int | None = None, lat_min: float | None = None, lat_max: float | None = None, lon_min: float | None = None, lon_max: float | None = None, tool: str | None = None, author: str | None = None, schema_version: str | None = None)[source]#
Bases:
object
Weather attributes containing metadata used to construct the “metadata” element and stored in .bin.json file. Used to initiate weather metadata object. If no metadata is specified, defaults are used. If metadata dict is specified, that dictionary is used as is, without setting any defaults.
- property provenance: str#
Data provenance, describing the data source and how the data was obtained.
- classmethod metadata_defaults_dict() Dict[str, str | int | float] [source]#
Metadata defaults dictionary.
- class emodpy_malaria.weather.weather_metadata.WeatherMetadata(node_ids: List[int] | Dict[int, int], series_len: int | None = None, attributes: WeatherMetadata | WeatherAttributes | Dict[str, str | int | float] | None = None)[source]#
Bases:
WeatherAttributes
Weather metadata containing weather data attributes, counts and node offsets. Used to initiate WeatherData, expose metadata programmatically and create weather metadata files (.bin.json).
- validate()[source]#
Validate metadata object node-related counts. Relies on inherited validation of metadata attributes.
- property attributes: WeatherAttributes#
Cast back into WeatherAttributes.
- property series_count: int#
The number of weather time series (expected based on metadata), corresponding to the number of offsets.
- property series_unique_count#
The number of unique weather time series (expected based on metadata), based on offsets.
- property total_value_count: int#
The total count of all values, in all weather time series (expected based on metadata).
- property node_offset_str: str#
The node offset string, as it will appear in the weather metadata file (.bin.json).
- property node_offsets: Dict[int, int]#
Node-offset dictionary, mapping node ids (keys) to node offsets (values).
- property offset_nodes: Dict[int, List[int]]#
The offset-nodes dictionary, grouping nodes (values) by offset (key). Used to find unique series.
- to_file(file_path: str | Path) NoReturn [source]#
Save weather metadata object as weather metadata file (.bin.json).
- Parameters:
file_path – The path of the output weather metadata file.
- Returns:
None
- classmethod from_file(file_path: str | Path) WeatherMetadata [source]#
Read weather metadata file into a weather metadata object.