Skip to content

Commit cf42de9

Browse files
fix litpop test failing due to changed get_resolution
1 parent 552e286 commit cf42de9

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Removed:
3232
- `ImpactFunc` and `ImpactFuncSet` now support equality comparisons via `==` [#1027](https://github.com/CLIMADA-project/climada_python/pull/1027)
3333

3434
### Changed
35+
3536
- Changed default distance threshold for nearest neighbor matching in `util.coordinates.match_coordinates` from a fixed value of 100km to twice the highest resolution of the coords_to_assign [#1080](https://github.com/CLIMADA-project/climada_python/pull/1080).
3637
- Changed the default mask_distance in `util.plot.geo_im_from_array` to 0.03 to avoid white gaps in gridded hazard data with comparably low resolution (>80 centroids per axis) [#1073](https://github.com/CLIMADA-project/climada_python/pull/1073)
3738
- Increased speed of `util.plot.add_shapes` by avoiding for loops, substantially speeding up `Hazard.plot_intensity` and other functions. [#1073](https://github.com/CLIMADA-project/climada_python/pull/1073)
@@ -45,6 +46,7 @@ geographic coordinates as input (e.g. `util.coordinates.dist_to_coast`, `util.co
4546
- The online documentation has been completely overhauled, now uses PyData theme: [#977](https://github.com/CLIMADA-project/climada_python/pull/977)
4647
- 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)
4748
- The output of the `impact_yearset` was changed to only contain attributes corresponding to the yearly impact set. 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)
49+
- `util.coordinates.get_resolution` always returns positive values, regardless of how the input coordinates' order [#1080](https://github.com/CLIMADA-project/climada_python/pull/1080).
4850

4951
### Fixed
5052

climada/test/test_litpop_integr.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,10 @@ def test_switzerland300_pass(self):
9898
self.assertTrue(u_coord.equal_crs(ent.meta["crs"], "epsg:4326"))
9999
self.assertAlmostEqual(ent.meta["transform"][0], 0.08333333333333333)
100100
self.assertAlmostEqual(ent.meta["transform"][1], 0)
101-
self.assertAlmostEqual(ent.meta["transform"][2], 5.9166666666666)
101+
self.assertAlmostEqual(ent.meta["transform"][2], 5.91666666666666666)
102102
self.assertAlmostEqual(ent.meta["transform"][3], 0)
103-
self.assertAlmostEqual(ent.meta["transform"][4], -0.08333333333333333)
104-
self.assertAlmostEqual(ent.meta["transform"][5], 47.75)
103+
self.assertAlmostEqual(ent.meta["transform"][4], 0.08333333333333333)
104+
self.assertAlmostEqual(ent.meta["transform"][5], 45.8333333333333333)
105105

106106
def test_switzerland30normPop_pass(self):
107107
"""Create LitPop entity for Switzerland on 30 arcsec:"""

climada/util/test/test_coordinates.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1913,6 +1913,9 @@ def test_get_resolution_pass(self):
19131913
res_lat, res_lon = u_coord.get_resolution(lat, lon)
19141914
self.assertAlmostEqual(res_lat, 0.0833333333333)
19151915
self.assertAlmostEqual(res_lon, 0.0833333333333)
1916+
res_lat, res_lon = u_coord.get_resolution(lat[::-1], lon[::-1])
1917+
self.assertAlmostEqual(res_lat, 0.0833333333333)
1918+
self.assertAlmostEqual(res_lon, 0.0833333333333)
19161919

19171920
def test_get_resolution_large_pass(self):
19181921
"""Test _get_resolution method"""

0 commit comments

Comments
 (0)