Skip to content

Commit 86c9d93

Browse files
committed
Add docstrings to hazardForecast base class
1 parent 09fd55b commit 86c9d93

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

climada/hazard/forecast.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,37 @@ def __init__(
3737
member: np.ndarray | None = None,
3838
**hazard_kwargs,
3939
):
40+
"""
41+
Initialize a HazardForecast object.
42+
43+
Parameters
44+
----------
45+
lead_time : np.ndarray of np.datetime64 or None, optional
46+
Forecast lead times. Default is empty array.
47+
member : np.ndarray or None, optional
48+
Ensemble member identifiers as integers. Default is empty array.
49+
**hazard_kwargs
50+
keyword arguments to pass to Hazard.__init__. See Hazard.__init__
51+
docstring for details.
52+
"""
4053
super().__init__(lead_time=lead_time, member=member, **hazard_kwargs)
4154

4255
@classmethod
4356
def from_hazard(self, hazard: Hazard):
57+
"""
58+
Create a HazardForecast object from a Hazard object.
59+
60+
Parameters
61+
----------
62+
hazard : Hazard
63+
Hazard object to convert into a HazardForecast.
64+
65+
Returns
66+
-------
67+
HazardForecast
68+
A HazardForecast object with the same attributes as the input hazard,
69+
but with lead_time and member attributes set from instance of HazardForecast.
70+
"""
4471
return cls(
4572
lead_time=self.lead_time,
4673
member=self.member,

0 commit comments

Comments
 (0)