Skip to content

Commit 1a0eadb

Browse files
implement Chahan's review
1 parent 399715a commit 1a0eadb

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +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)
31+
- The output of the `impact_yearset` was changed to only contain attributes corresponding to the yearly impact set. 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)
3232

3333
### Fixed
3434

climada/util/yearsets.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ def impact_yearset_from_sampling_vect(
123123

124124
# compute impact per sampled_year
125125
imp_per_year = compute_imp_per_year(imp, sampling_vect)
126+
frequency = np.ones(len(sampled_years)) / len(sampled_years)
126127

127128
if correction_fac: # adjust for sampling error
128129
correction_factor = calculate_correction_fac(imp_per_year, imp)
@@ -137,11 +138,11 @@ def impact_yearset_from_sampling_vect(
137138
event_id=np.arange(1, len(sampled_years) + 1),
138139
unit=imp.unit,
139140
haz_type=imp.haz_type,
140-
frequency=np.ones(len(sampled_years)) / len(sampled_years),
141+
frequency=frequency,
142+
frequency_unit="1/year",
143+
aai_agg=np.sum(frequency * imp_per_year),
141144
)
142145

143-
yimp.aai_agg = np.sum(yimp.frequency * yimp.at_event)
144-
145146
return yimp
146147

147148

0 commit comments

Comments
 (0)