weather_utils
Utility functions for the weather module.
hash_series(series)
invert_dict(in_dict, sort=False, single_value=False)
Invert a dictionary by grouping keys by value.
Example (single_value=False)::
{1: 'a', 2: 'a', 3: 'b'} -> {'a': [1, 2], 'b': [3]}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
in_dict
|
dict
|
Dictionary to invert. |
required |
sort
|
bool
|
Sort resulting dict by key and value lists. |
False
|
single_value
|
bool
|
Return only one representative key per unique value. |
False
|
Source code in emodpy_malaria/weather/weather_utils.py
make_path(dir_path)
parse_date(date_arg, default_month, default_day)
Parse a date from year (2018), day-of-year (2018001), or YYYYMMDD (20180101) format.
Source code in emodpy_malaria/weather/weather_utils.py
save_json(content, file_path)
Write a dictionary to a JSON file.