Skip to content

Commit 271c4f8

Browse files
committed
Merge branch 'develop' into feature/relative_matching_distance
2 parents c3f7132 + 6cc6e08 commit 271c4f8

20 files changed

+1999
-1784
lines changed

.zenodo.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,9 @@
119119
},
120120
{
121121
"name": "Valentin Gebhart"
122+
},
123+
{
124+
"name": "Dahyann Araya"
122125
}
123126
]
124127
}

AUTHORS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,4 @@
3636
* Luca Severino
3737
* Samuel Juhel
3838
* Valentin Gebhart
39+
* Dahyann Araya

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ geographic coordinates as input (e.g. `util.coordinates.dist_to_coast`, `util.co
4343
- 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)
4444
- `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)
4545
- The online documentation has been completely overhauled, now uses PyData theme: [#977](https://github.com/CLIMADA-project/climada_python/pull/977)
46+
- Add `climada.hazard.xarray` module with helper structures for reading Hazard objects from `xarray` data [#1063](https://github.com/CLIMADA-project/climada_python/pull/1063)
4647

4748
### Fixed
4849

@@ -51,6 +52,8 @@ geographic coordinates as input (e.g. `util.coordinates.dist_to_coast`, `util.co
5152

5253
### Deprecated
5354

55+
- `Hazard.from_xarray_raster_file`. Use `Hazard.from_xarray_raster` and pass the file path as `data` argument [#1063](https://github.com/CLIMADA-project/climada_python/pull/1063)
56+
5457
### Removed
5558

5659
- `climada.util.interpolation.round_to_sig_digits` [#1012](https://github.com/CLIMADA-project/climada_python/pull/1012)
@@ -106,6 +109,7 @@ Removed:
106109

107110
### Added
108111

112+
- `climada.entity.impact_funcs.trop_cyclone.ImpfSetTropCyclone.get_impf_id_regions_per_countries` function [#1034](https://github.com/CLIMADA-project/climada_python/pull/1034)
109113
- `climada.hazard.tc_tracks.TCTracks.subset_years` function [#1023](https://github.com/CLIMADA-project/climada_python/pull/1023)
110114
- `climada.hazard.tc_tracks.TCTracks.from_FAST` function, add Australia basin (AU) [#993](https://github.com/CLIMADA-project/climada_python/pull/993)
111115
- Add `osm-flex` package to CLIMADA core [#981](https://github.com/CLIMADA-project/climada_python/pull/981)

climada/entity/impact_funcs/test/test_tc.py

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def test_default_values_pass(self):
115115
self.assertEqual(impfs.size(), 10)
116116
self.assertEqual(impfs.get_ids()["TC"], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
117117
self.assertEqual(impf_wp4.intensity_unit, "m/s")
118-
self.assertEqual(impf_wp4.name, "North West Pacific (WP4)")
118+
self.assertEqual(impf_wp4.name, "North West Pacific")
119119
self.assertAlmostEqual(v_halfs["WP2"], 188.4, places=7)
120120
self.assertAlmostEqual(v_halfs["ROW"], 110.1, places=7)
121121
self.assertListEqual(list(impf_wp4.intensity), list(np.arange(0, 121, 5)))
@@ -135,7 +135,7 @@ def test_RMSF_pass(self):
135135
self.assertEqual(impfs.size(), 10)
136136
self.assertEqual(impfs.get_ids()["TC"], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
137137
self.assertEqual(impf_na1.intensity_unit, "m/s")
138-
self.assertEqual(impf_na1.name, "Caribbean and Mexico (NA1)")
138+
self.assertEqual(impf_na1.name, "Caribbean and Mexico")
139139
self.assertAlmostEqual(v_halfs["NA1"], 59.6, places=7)
140140
self.assertAlmostEqual(v_halfs["ROW"], 73.4, places=7)
141141
self.assertListEqual(list(impf_na1.intensity), list(np.arange(0, 121, 5)))
@@ -153,7 +153,7 @@ def test_quantile_pass(self):
153153
self.assertEqual(impfs.size(), 10)
154154
self.assertEqual(impfs_p10.size(), 10)
155155
self.assertEqual(impf_si.intensity_unit, "m/s")
156-
self.assertEqual(impf_si_p10.name, "South Indian (SI)")
156+
self.assertEqual(impf_si_p10.name, "South Indian")
157157
self.assertAlmostEqual(impf_si_p10.mdd.max(), 0.99999999880, places=5)
158158
self.assertAlmostEqual(impf_si.calc_mdr(30), 0.01620503041, places=5)
159159
intensity = np.random.randint(26, impf_si.intensity.max())
@@ -168,6 +168,35 @@ def test_get_countries_per_region(self):
168168
self.assertListEqual(out[2], [124, 840])
169169
self.assertListEqual(out[3], ["CAN", "USA"])
170170

171+
def test_get_imf_id_regions_per_countries(self):
172+
"""Test get_impf_id_regions_per_countries()"""
173+
ifs = ImpfSetTropCyclone()
174+
impf_id_reg_id_reg_name = ifs.get_impf_id_regions_per_countries(
175+
countries=["CHE"]
176+
)
177+
178+
# the first element of impf_id_reg_id_reg_name [0] is the impact function id,
179+
# the second [1] is the region id, the third [2] is the region name.
180+
self.assertEqual(impf_id_reg_id_reg_name[0][0], 10)
181+
self.assertEqual(impf_id_reg_id_reg_name[1][0], "ROW")
182+
self.assertEqual(impf_id_reg_id_reg_name[2][0], "Rest of The World")
183+
impf_id_reg_id_reg_name = ifs.get_impf_id_regions_per_countries(countries=[756])
184+
self.assertEqual(impf_id_reg_id_reg_name[0][0], 10)
185+
self.assertEqual(impf_id_reg_id_reg_name[1][0], "ROW")
186+
self.assertEqual(impf_id_reg_id_reg_name[2][0], "Rest of The World")
187+
188+
impf_id_reg_id_reg_name = ifs.get_impf_id_regions_per_countries(
189+
countries=["CHE", 268]
190+
)
191+
# CHE
192+
self.assertEqual(impf_id_reg_id_reg_name[0][0], 10)
193+
self.assertEqual(impf_id_reg_id_reg_name[1][0], "ROW")
194+
self.assertEqual(impf_id_reg_id_reg_name[2][0], "Rest of The World")
195+
# GEO (georgia, 268)
196+
self.assertEqual(impf_id_reg_id_reg_name[0][1], 3)
197+
self.assertEqual(impf_id_reg_id_reg_name[1][1], "NI")
198+
self.assertEqual(impf_id_reg_id_reg_name[2][1], "North Indian")
199+
171200

172201
# Execute Tests
173202
if __name__ == "__main__":

0 commit comments

Comments
 (0)