Skip to content
Open
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
12 changes: 4 additions & 8 deletions climada/engine/unsequa/test/test_unsequa.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,18 @@
from climada.entity import Exposures, ImpactFunc, ImpactFuncSet
from climada.entity.entity_def import Entity
from climada.hazard import Hazard
from climada.util.api_client import Client
from climada.test import get_test_file
from climada.util.constants import (
ENT_DEMO_FUTURE,
ENT_DEMO_TODAY,
EXP_DEMO_H5,
HAZ_DEMO_H5,
TEST_UNC_OUTPUT_COSTBEN,
TEST_UNC_OUTPUT_IMPACT,
)

test_unc_output_impact = Client().get_dataset_file(
name=TEST_UNC_OUTPUT_IMPACT, status="test_dataset"
)
test_unc_output_costben = Client().get_dataset_file(
name=TEST_UNC_OUTPUT_COSTBEN, status="test_dataset"
)
EXP_DEMO_H5 = get_test_file("exp_demo_today", file_format="hdf5")
test_unc_output_impact = get_test_file(TEST_UNC_OUTPUT_IMPACT)
test_unc_output_costben = get_test_file(TEST_UNC_OUTPUT_COSTBEN)


def impf_dem(x_paa=1, x_mdd=1):
Expand Down
4 changes: 3 additions & 1 deletion climada/entity/measures/test/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,12 @@
from climada.entity.measures.measure_set import MeasureSet
from climada.hazard.base import Hazard
from climada.test import get_test_file
from climada.util.constants import EXP_DEMO_H5, HAZ_DEMO_H5
from climada.util.constants import HAZ_DEMO_H5

DATA_DIR = CONFIG.measures.test_data.dir()

EXP_DEMO_H5 = get_test_file("exp_demo_today", file_format="hdf5")

HAZ_TEST_TC: Path = get_test_file("test_tc_florida", file_format="hdf5")
"""
Hazard test file from Data API: Hurricanes from 1851 to 2011 over Florida with 100 centroids.
Expand Down
8 changes: 4 additions & 4 deletions climada/test/test_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,14 +177,14 @@ def test_get_exposures(self):
"fin_mode": "pop",
"exponents": "(0,1)",
},
version="v1",
version="v3",
dump_dir=DATA_DIR,
)
self.assertEqual(len(exposures.gdf), 5782)
self.assertEqual(np.unique(exposures.region_id), 40)
self.assertEqual(
exposures.description,
"LitPop Exposure for ['AUT'] at 150 as, year: 2018, financial mode: pop, exp: [0, 1], admin1_calc: False",
"LitPop Exposure for ['AUT'] at 150 as, year: 2018, financial mode: pop, exp: (0, 1), admin1_calc: False",
)

def test_get_exposures_fails(self):
Expand Down Expand Up @@ -264,12 +264,12 @@ def test_get_hazard_fails(self):

def test_get_litpop(self):
client = Client()
litpop = client.get_litpop(country="LUX", version="v1", dump_dir=DATA_DIR)
litpop = client.get_litpop(country="LUX", version="v3", dump_dir=DATA_DIR)
self.assertEqual(len(litpop.gdf), 188)
self.assertEqual(np.unique(litpop.region_id), 442)
self.assertEqual(
litpop.description,
"LitPop Exposure for ['LUX'] at 150 as, year: 2018, financial mode: pc, exp: [1, 1], admin1_calc: False",
"LitPop Exposure for ['LUX'] at 150 as, year: 2018, financial mode: pc, exp: (1, 1), admin1_calc: False",
)

def test_get_litpop_fail(self):
Expand Down
3 changes: 2 additions & 1 deletion climada/test/test_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,15 @@
from climada.entity import Exposures, ImpactFunc, ImpactFuncSet
from climada.entity.entity_def import Entity
from climada.hazard import Hazard
from climada.test import get_test_file
from climada.util.constants import (
ENT_DEMO_FUTURE,
ENT_DEMO_TODAY,
EXP_DEMO_H5,
HAZ_DEMO_H5,
)

DATA_DIR = CONFIG.engine.test_data.dir()
EXP_DEMO_H5 = get_test_file("exp_demo_today", file_format="hdf5")
EMDAT_TEST_CSV = DATA_DIR.joinpath("emdat_testdata_BGD_USA_1970-2017.csv")


Expand Down
Loading