seasonal_scenario
get_seasonal_scenario(dates)
Computing starting date and time granularity between two dates in a given dates series.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dates | npt.NDArray[np.datetime64 | input dates | required |
Returns:
| Type | Description |
|---|---|
dict[str, Optional[int]] | dictionary of start_date and granularity |
Source code in eki_mmo_equations/time_related_transformations/seasonal_scenario.py
def get_seasonal_scenario(dates: npt.NDArray[np.datetime64]) -> dict[str, Any]:
"""Computing starting date and time granularity between
two dates in a given dates series.
Args:
dates (npt.NDArray[np.datetime64): input dates
Returns:
(dict[str, Optional[int]]): dictionary of start_date and granularity
"""
scenario = {}
scenario["start_date"] = dates[0]
scenario["granularity"] = np.mean([(dates[n] - dates[n - 1]) for n in range(1, len(dates))])
return scenario