Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions climada/engine/test/test_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import unittest
from pathlib import Path

import fiona
import geopandas as gpd
import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -147,12 +146,7 @@ def test_Forecast_plot(self):
adm1_shape_file = shapereader.natural_earth(
resolution="10m", category="cultural", name="admin_1_states_provinces"
)
if not cantons_file.exists():
with fiona.open(adm1_shape_file, "r") as source:
with fiona.open(cantons_file, "w", **source.meta) as sink:
for f in source:
if f["properties"]["adm0_a3"] == "CHE":
sink.write(f)

## test plotting functions
# should save plot without failing
forecast.plot_imp_map(
Expand Down
72 changes: 56 additions & 16 deletions climada/engine/test/test_impact_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,40 +244,80 @@ def test_calc_impact_RF_pass(self):
0.00000000e00,
]
)
# fmt: off
imp_mat_array = np.array(
[
[
0.00000000e00, 0.00000000e00, 0.00000000e00, 0.00000000e00,
0.00000000e00, 0.00000000e00, 0.00000000e00, 0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
],
[
0.00000000e00, 0.00000000e00, 0.00000000e00, 0.00000000e00,
0.00000000e00, 0.00000000e00, 0.00000000e00, 0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
],
[
0.00000000e00, 6.41965663e04, 0.00000000e00, 2.02249434e02,
3.41245461e04, 0.00000000e00, 0.00000000e00, 0.00000000e00,
0.00000000e00,
6.41965663e04,
0.00000000e00,
2.02249434e02,
3.41245461e04,
0.00000000e00,
0.00000000e00,
0.00000000e00,
],
[
0.00000000e00, 0.00000000e00, 0.00000000e00, 0.00000000e00,
3.41245461e04, 0.00000000e00, 0.00000000e00, 0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
3.41245461e04,
0.00000000e00,
0.00000000e00,
0.00000000e00,
],
[
7.73566566e07, 0.00000000e00, 0.00000000e00, 0.00000000e00,
0.00000000e00, 0.00000000e00, 0.00000000e00, 0.00000000e00,
7.73566566e07,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
],
[
0.00000000e00, 0.00000000e00, 0.00000000e00, 0.00000000e00,
0.00000000e00, 0.00000000e00, 0.00000000e00, 0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
],
[
0.00000000e00, 0.00000000e00, 0.00000000e00, 0.00000000e00,
0.00000000e00, 0.00000000e00, 0.00000000e00, 0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
0.00000000e00,
],
]
)
# fmt: on
check_impact(self, impact, haz, exp, aai_agg, eai_exp, at_event, imp_mat_array)

def test_empty_impact(self):
Expand Down
Loading