Skip to content

Commit 399715a

Browse files
updated changelog and docstrings
1 parent 5f41cd3 commit 399715a

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ Removed:
2828
- World Bank indicator data is now downloaded directly from their API via the function `download_world_bank_indicator`, instead of relying on the `pandas-datareader` package [#1033](https://github.com/CLIMADA-project/climada_python/pull/1033)
2929
- `Exposures.write_hdf5` pickles geometry data in WKB format, which is faster and more sustainable. [#1051](https://github.com/CLIMADA-project/climada_python/pull/1051)
3030
- The online documentation has been completely overhauled, now uses PyData theme: [#977](https://github.com/CLIMADA-project/climada_python/pull/977)
31+
- The default parameters of `impact_yearset`, `sample_events`, and `impact_yearset_from_sampling_vect` functions of the `climada.util.yearsets` module have been changed to sampling with replacement and not applying the correction factor to the impact yearsets. The application of the correction factor and the frequency of the resulting yearly impact object are corrected. [#1075](https://github.com/CLIMADA-project/climada_python/pull/1075)
3132

3233
### Fixed
3334

climada/util/yearsets.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ def impact_yearset(
4040
impact object containing impacts per event
4141
sampled_years : list
4242
A list of years that shall be covered by the resulting yimp.
43+
lam: float, optional
44+
The parameter (i.e., the mean) of the Poisson distribution to sample the number of
45+
events per year. If no lambda value is given, the default lam = sum(imp.frequency)
46+
is used. Default is None.
47+
correction_fac : boolean, optional
48+
If True a correction factor is applied to the resulting yimp. It is
49+
scaled in such a way that the expected annual impact (eai) of the yimp
50+
equals the eai of the input impact. Defaults to False.
4351
with_replacement : bool, optional
4452
If True, impact events are sampled with replacement. If False, events are sampled
4553
without replacement. Sampling without replacement can yield distorted samples if
@@ -48,15 +56,6 @@ def impact_yearset(
4856
seed for the default bit generator
4957
default: None
5058
51-
Optional parameters
52-
lam: int
53-
The applied Poisson distribution is centered around lam events per year.
54-
If no lambda value is given, the default lam = sum(imp.frequency) is used.
55-
correction_fac : boolean
56-
If True a correction factor is applied to the resulting yimp. It is
57-
scaled in such a way that the expected annual impact (eai) of the yimp
58-
equals the eai of the input impact
59-
6059
Returns
6160
-------
6261
yimp : climada.engine.Impact()
@@ -110,12 +109,10 @@ def impact_yearset_from_sampling_vect(
110109
i.e. [yimp, sampling_vect] = climada_yearsets.impact_yearset(...)
111110
and can then be provided in this function to obtain the exact same sampling
112111
(also for a different imp object)
113-
114-
Optional parameter
115-
correction_fac : boolean
112+
correction_fac : boolean, optional
116113
If True a correction factor is applied to the resulting yimp. It is
117114
scaled in such a way that the expected annual impact (eai) of the yimp
118-
equals the eai of the input impact
115+
equals the eai of the input impact. Defaults to False.
119116
120117
Returns
121118
-------
@@ -156,7 +153,8 @@ def sample_from_poisson(n_sampled_years, lam, seed=None):
156153
n_sampled_years : int
157154
The target number of years the impact yearset shall contain.
158155
lam: float
159-
the applied Poisson distribution is centered around lambda events per year
156+
The parameter (i.e., the mean) of the Poisson distribution to sample the number of
157+
events per year.
160158
seed : int, optional
161159
seed for numpy.random, will be set if not None
162160
default: None

0 commit comments

Comments
 (0)