| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4e90697 commit eff303e
23 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -454,10 +454,8 @@ def specific_calib(x): | |||
| 454 | 454 | # | |
| 455 | 455 | # | |
| 456 | 456 | # ## tryout calib_all | |
| 457 | - # hazard = TropCyclone() | ||
| 458 | - # hazard.read_hdf5('C:/Users/ThomasRoosli/tc_NA_hazard.hdf5') | ||
| 459 | - # exposure = LitPop() | ||
| 460 | - # exposure.read_hdf5('C:/Users/ThomasRoosli/DOM_LitPop.hdf5') | ||
| 457 | + # hazard = TropCyclone.from_hdf5('C:/Users/ThomasRoosli/tc_NA_hazard.hdf5') | ||
| 458 | + # exposure = LitPop.from_hdf5('C:/Users/ThomasRoosli/DOM_LitPop.hdf5') | ||
| 461 | 459 | # impf_name_or_instance = 'emanuel' | |
| 462 | 460 | # param_full_dict = {'v_thresh': [25.7, 20], 'v_half': [70], 'scale': [1, 0.8]} | |
| 463 | 461 | # | |
@@ -471,10 +469,8 @@ def specific_calib(x): | |||
| 471 | 469 | # | |
| 472 | 470 | # | |
| 473 | 471 | # ## tryout calib_optimize | |
| 474 | - # hazard = TropCyclone() | ||
| 475 | - # hazard.read_hdf5('C:/Users/ThomasRoosli/tc_NA_hazard.hdf5') | ||
| 476 | - # exposure = LitPop() | ||
| 477 | - # exposure.read_hdf5('C:/Users/ThomasRoosli/DOM_LitPop.hdf5') | ||
| 472 | + # hazard = TropCyclone.from_hdf5('C:/Users/ThomasRoosli/tc_NA_hazard.hdf5') | ||
| 473 | + # exposure = LitPop.from_hdf5('C:/Users/ThomasRoosli/DOM_LitPop.hdf5') | ||
| 478 | 474 | # impf_name_or_instance = 'emanuel' | |
| 479 | 475 | # param_dict = {'v_thresh': 25.7, 'v_half': 70, 'scale': 0.6} | |
| 480 | 476 | # year_range = [2004, 2017] | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -150,8 +150,7 @@ def calc(self, exposures, impact_funcs, hazard, save_mat=False): | |||
| 150 | 150 | ||
| 151 | 151 | >>> haz = Hazard.from_mat(HAZ_DEMO_MAT) # Set hazard | |
| 152 | 152 | >>> haz.check() | |
| 153 | - >>> ent = Entity() # Load entity with default values | ||
| 154 | - >>> ent.read_excel(ENT_TEMPLATE_XLS) # Set exposures | ||
| 153 | + >>> ent = Entity.from_excel(ENT_TEMPLATE_XLS) # Set exposures | ||
| 155 | 154 | >>> ent.check() | |
| 156 | 155 | >>> imp = Impact() | |
| 157 | 156 | >>> imp.calc(ent.exposures, ent.impact_funcs, haz) | |
@@ -161,8 +160,7 @@ def calc(self, exposures, impact_funcs, hazard, save_mat=False): | |||
| 161 | 160 | ||
| 162 | 161 | >>> haz = Hazard.from_mat(HAZ_DEMO_MAT) # Set hazard | |
| 163 | 162 | >>> haz.check() | |
| 164 | - >>> funcs = ImpactFuncSet() | ||
| 165 | - >>> funcs.read_excel(ENT_TEMPLATE_XLS) # Set impact functions | ||
| 163 | + >>> funcs = ImpactFuncSet.from_excel(ENT_TEMPLATE_XLS) # Set impact functions | ||
| 166 | 164 | >>> funcs.check() | |
| 167 | 165 | >>> exp = Exposures(pd.read_excel(ENT_TEMPLATE_XLS)) # Set exposures | |
| 168 | 166 | >>> exp.check() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -44,8 +44,7 @@ def test_calc_impact_measures_pass(self): | |||
| 44 | 44 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 45 | 45 | ||
| 46 | 46 | self.assertTrue(ENT_TEST_MAT.is_file(), "{} is not a file".format(ENT_TEST_MAT)) | |
| 47 | - entity = Entity() | ||
| 48 | - entity.read_mat(ENT_TEST_MAT) | ||
| 47 | + entity = Entity.from_mat(ENT_TEST_MAT) | ||
| 49 | 48 | entity.check() | |
| 50 | 49 | entity.measures._data['TC'] = entity.measures._data.pop('XX') | |
| 51 | 50 | for meas in entity.measures.get_measure('TC'): | |
@@ -226,8 +225,7 @@ def test_cb_one_meas_fut_pass(self): | |||
| 226 | 225 | def test_calc_cb_no_change_pass(self): | |
| 227 | 226 | """Test _calc_cost_benefit without present value against reference value""" | |
| 228 | 227 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 229 | - entity = Entity() | ||
| 230 | - entity.read_mat(ENT_TEST_MAT) | ||
| 228 | + entity = Entity.from_mat(ENT_TEST_MAT) | ||
| 231 | 229 | entity.measures._data['TC'] = entity.measures._data.pop('XX') | |
| 232 | 230 | for meas in entity.measures.get_measure('TC'): | |
| 233 | 231 | meas.haz_type = 'TC' | |
@@ -263,8 +261,7 @@ def test_calc_cb_no_change_pass(self): | |||
| 263 | 261 | def test_calc_cb_change_pass(self): | |
| 264 | 262 | """Test _calc_cost_benefit with present value against reference value""" | |
| 265 | 263 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 266 | - entity = Entity() | ||
| 267 | - entity.read_mat(ENT_TEST_MAT) | ||
| 264 | + entity = Entity.from_mat(ENT_TEST_MAT) | ||
| 268 | 265 | entity.measures._data['TC'] = entity.measures._data.pop('XX') | |
| 269 | 266 | for meas in entity.measures.get_measure('TC'): | |
| 270 | 267 | meas.haz_type = 'TC' | |
@@ -275,8 +272,7 @@ def test_calc_cb_change_pass(self): | |||
| 275 | 272 | entity.impact_funcs, when='present', | |
| 276 | 273 | risk_func=risk_aai_agg, save_imp=False) | |
| 277 | 274 | ||
| 278 | - ent_future = Entity() | ||
| 279 | - ent_future.read_excel(ENT_DEMO_FUTURE) | ||
| 275 | + ent_future = Entity.from_excel(ENT_DEMO_FUTURE) | ||
| 280 | 276 | ent_future.check() | |
| 281 | 277 | ||
| 282 | 278 | haz_future = copy.deepcopy(hazard) | |
@@ -441,8 +437,7 @@ def test_norm_value(self): | |||
| 441 | 437 | def test_combine_fut_pass(self): | |
| 442 | 438 | """Test combine_measures with present and future""" | |
| 443 | 439 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 444 | - entity = Entity() | ||
| 445 | - entity.read_excel(ENT_DEMO_TODAY) | ||
| 440 | + entity = Entity.from_excel(ENT_DEMO_TODAY) | ||
| 446 | 441 | entity.check() | |
| 447 | 442 | entity.exposures.ref_year = 2018 | |
| 448 | 443 | ||
@@ -502,8 +497,7 @@ def test_combine_fut_pass(self): | |||
| 502 | 497 | def test_combine_current_pass(self): | |
| 503 | 498 | """Test combine_measures with only future""" | |
| 504 | 499 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 505 | - entity = Entity() | ||
| 506 | - entity.read_excel(ENT_DEMO_TODAY) | ||
| 500 | + entity = Entity.from_excel(ENT_DEMO_TODAY) | ||
| 507 | 501 | entity.check() | |
| 508 | 502 | entity.exposures.ref_year = 2018 | |
| 509 | 503 | cost_ben = CostBenefit() | |
@@ -543,8 +537,7 @@ def test_combine_current_pass(self): | |||
| 543 | 537 | def test_apply_transf_current_pass(self): | |
| 544 | 538 | """Test apply_risk_transfer with only future""" | |
| 545 | 539 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 546 | - entity = Entity() | ||
| 547 | - entity.read_excel(ENT_DEMO_TODAY) | ||
| 540 | + entity = Entity.from_excel(ENT_DEMO_TODAY) | ||
| 548 | 541 | entity.check() | |
| 549 | 542 | entity.exposures.ref_year = 2018 | |
| 550 | 543 | cost_ben = CostBenefit() | |
@@ -594,8 +587,7 @@ def test_apply_transf_current_pass(self): | |||
| 594 | 587 | def test_apply_transf_cost_fact_pass(self): | |
| 595 | 588 | """Test apply_risk_transfer with only future annd cost factor""" | |
| 596 | 589 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 597 | - entity = Entity() | ||
| 598 | - entity.read_excel(ENT_DEMO_TODAY) | ||
| 590 | + entity = Entity.from_excel(ENT_DEMO_TODAY) | ||
| 599 | 591 | entity.check() | |
| 600 | 592 | entity.exposures.ref_year = 2018 | |
| 601 | 593 | cost_ben = CostBenefit() | |
@@ -643,8 +635,7 @@ def test_apply_transf_cost_fact_pass(self): | |||
| 643 | 635 | def test_apply_transf_future_pass(self): | |
| 644 | 636 | """Test apply_risk_transfer with present and future""" | |
| 645 | 637 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 646 | - entity = Entity() | ||
| 647 | - entity.read_excel(ENT_DEMO_TODAY) | ||
| 638 | + entity = Entity.from_excel(ENT_DEMO_TODAY) | ||
| 648 | 639 | entity.check() | |
| 649 | 640 | entity.exposures.ref_year = 2018 | |
| 650 | 641 | ||
@@ -700,8 +691,7 @@ def test_apply_transf_future_pass(self): | |||
| 700 | 691 | def test_remove_measure(self): | |
| 701 | 692 | """Test remove_measure method""" | |
| 702 | 693 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 703 | - entity = Entity() | ||
| 704 | - entity.read_excel(ENT_DEMO_TODAY) | ||
| 694 | + entity = Entity.from_excel(ENT_DEMO_TODAY) | ||
| 705 | 695 | entity.check() | |
| 706 | 696 | entity.exposures.ref_year = 2018 | |
| 707 | 697 | cost_ben = CostBenefit() | |
@@ -729,15 +719,13 @@ def test_calc_change_pass(self): | |||
| 729 | 719 | """Test calc with future change""" | |
| 730 | 720 | # present | |
| 731 | 721 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 732 | - entity = Entity() | ||
| 733 | - entity.read_excel(ENT_DEMO_TODAY) | ||
| 722 | + entity = Entity.from_excel(ENT_DEMO_TODAY) | ||
| 734 | 723 | entity.exposures.gdf.rename(columns={'impf_': 'impf_TC'}, inplace=True) | |
| 735 | 724 | entity.check() | |
| 736 | 725 | entity.exposures.ref_year = 2018 | |
| 737 | 726 | ||
| 738 | 727 | # future | |
| 739 | - ent_future = Entity() | ||
| 740 | - ent_future.read_excel(ENT_DEMO_FUTURE) | ||
| 728 | + ent_future = Entity.from_excel(ENT_DEMO_FUTURE) | ||
| 741 | 729 | ent_future.check() | |
| 742 | 730 | ent_future.exposures.ref_year = 2040 | |
| 743 | 731 | ||
@@ -788,8 +776,7 @@ def test_calc_change_pass(self): | |||
| 788 | 776 | def test_calc_no_change_pass(self): | |
| 789 | 777 | """Test calc without future change""" | |
| 790 | 778 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 791 | - entity = Entity() | ||
| 792 | - entity.read_excel(ENT_DEMO_TODAY) | ||
| 779 | + entity = Entity.from_excel(ENT_DEMO_TODAY) | ||
| 793 | 780 | entity.check() | |
| 794 | 781 | entity.exposures.ref_year = 2018 | |
| 795 | 782 | cost_ben = CostBenefit() | |
@@ -817,8 +804,7 @@ class TestRiskFuncs(unittest.TestCase): | |||
| 817 | 804 | """Test risk functions definitions""" | |
| 818 | 805 | ||
| 819 | 806 | def test_impact(self): | |
| 820 | - ent = Entity() | ||
| 821 | - ent.read_excel(ENT_DEMO_TODAY) | ||
| 807 | + ent = Entity.from_excel(ENT_DEMO_TODAY) | ||
| 822 | 808 | ent.check() | |
| 823 | 809 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 824 | 810 | impact = Impact() | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -116,8 +116,7 @@ def test_ref_value_insure_pass(self): | |||
| 116 | 116 | """Test result against reference value""" | |
| 117 | 117 | # Read demo entity values | |
| 118 | 118 | # Set the entity default file to the demo one | |
| 119 | - ent = Entity() | ||
| 120 | - ent.read_excel(ENT_DEMO_TODAY) | ||
| 119 | + ent = Entity.from_excel(ENT_DEMO_TODAY) | ||
| 121 | 120 | ent.check() | |
| 122 | 121 | ||
| 123 | 122 | # Read default hazard file | |
@@ -413,7 +412,7 @@ def test_write_read_exp_test(self): | |||
| 413 | 412 | 0, len([i for i, j in zip(imp_write.event_name, imp_read.event_name) if i != j])) | |
| 414 | 413 | self.assertIsInstance(imp_read.crs, str) | |
| 415 | 414 | ||
| 416 | - def test_write_read_excel_pass(self): | ||
| 415 | + def test_excel_io(self): | ||
| 417 | 416 | """Test write and read in excel""" | |
| 418 | 417 | ent = Entity.from_excel(ENT_DEMO_TODAY) | |
| 419 | 418 | ent.check() | |
@@ -469,7 +468,7 @@ def test_local_exceedance_imp_pass(self): | |||
| 469 | 468 | ||
| 470 | 469 | # Read default hazard file | |
| 471 | 470 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 472 | - | ||
| 471 | + | ||
| 473 | 472 | # Create impact object | |
| 474 | 473 | impact = Impact() | |
| 475 | 474 | # Assign centroids to exposures | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -59,8 +59,7 @@ def impf_dem(x_paa=1, x_mdd=1): | |||
| 59 | 59 | impf_set.append(impf) | |
| 60 | 60 | return impf_set | |
| 61 | 61 | ||
| 62 | - exp = Exposures() | ||
| 63 | - exp.read_hdf5(EXP_DEMO_H5) | ||
| 62 | + exp = Exposures.from_hdf5(EXP_DEMO_H5) | ||
| 64 | 63 | def exp_dem(x_exp=1, exp=exp): | |
| 65 | 64 | exp_tmp = exp.copy(deep=True) | |
| 66 | 65 | exp_tmp.gdf.value *= x_exp | |
@@ -94,15 +93,13 @@ def make_input_vars(): | |||
| 94 | 93 | ||
| 95 | 94 | ||
| 96 | 95 | def ent_dem(): | |
| 97 | - entity = Entity() | ||
| 98 | - entity.read_excel(ENT_DEMO_TODAY) | ||
| 96 | + entity = Entity.from_excel(ENT_DEMO_TODAY) | ||
| 99 | 97 | entity.exposures.ref_year = 2018 | |
| 100 | 98 | entity.check() | |
| 101 | 99 | return entity | |
| 102 | 100 | ||
| 103 | 101 | def ent_fut_dem(): | |
| 104 | - entity = Entity() | ||
| 105 | - entity.read_excel(ENT_DEMO_FUTURE) | ||
| 102 | + entity = Entity.from_excel(ENT_DEMO_FUTURE) | ||
| 106 | 103 | entity.exposures.ref_year = 2040 | |
| 107 | 104 | entity.check() | |
| 108 | 105 | return entity | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -372,7 +372,7 @@ def from_excel(cls, file_name, description='', var_names=DEF_VAR_EXCEL): | |||
| 372 | 372 | ||
| 373 | 373 | def read_excel(self, *args, **kwargs): | |
| 374 | 374 | """This function is deprecated, use ImpactFuncSet.from_excel instead.""" | |
| 375 | - LOGGER.warning("The use of ImpactFuncSet.read?excel is deprecated." + | ||
| 375 | + LOGGER.warning("The use of ImpactFuncSet.read_excel is deprecated." + | ||
| 376 | 376 | "Use ImpactFuncSet.from_excel instead.") | |
| 377 | 377 | self.__dict__ = ImpactFuncSet.from_excel(*args, **kwargs).__dict__ | |
| 378 | 378 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -114,8 +114,7 @@ def __init__(self): | |||
| 114 | 114 | ||
| 115 | 115 | Read measures from file and checks consistency data: | |
| 116 | 116 | ||
| 117 | - >>> meas = MeasureSet() | ||
| 118 | - >>> meas.read_excel(ENT_TEMPLATE_XLS) | ||
| 117 | + >>> meas = MeasureSet.from_excel(ENT_TEMPLATE_XLS) | ||
| 119 | 118 | """ | |
| 120 | 119 | self.clear() | |
| 121 | 120 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -45,8 +45,7 @@ class TestApply(unittest.TestCase): | |||
| 45 | 45 | """Test implement measures functions.""" | |
| 46 | 46 | def test_change_imp_func_pass(self): | |
| 47 | 47 | """Test _change_imp_func""" | |
| 48 | - meas = MeasureSet() | ||
| 49 | - meas.read_mat(ENT_TEST_MAT) | ||
| 48 | + meas = MeasureSet.from_mat(ENT_TEST_MAT) | ||
| 50 | 49 | act_1 = meas.get_measure(name='Mangroves')[0] | |
| 51 | 50 | ||
| 52 | 51 | imp_set = ImpactFuncSet() | |
@@ -76,17 +75,15 @@ def test_change_imp_func_pass(self): | |||
| 76 | 75 | ||
| 77 | 76 | def test_cutoff_hazard_pass(self): | |
| 78 | 77 | """Test _cutoff_hazard_damage""" | |
| 79 | - meas = MeasureSet() | ||
| 80 | - meas.read_mat(ENT_TEST_MAT) | ||
| 78 | + meas = MeasureSet.from_mat(ENT_TEST_MAT) | ||
| 81 | 79 | act_1 = meas.get_measure(name='Seawall')[0] | |
| 82 | 80 | ||
| 83 | 81 | haz = Hazard.from_mat(HAZ_TEST_MAT) | |
| 84 | 82 | exp = Exposures.from_mat(ENT_TEST_MAT) | |
| 85 | 83 | exp.gdf.rename(columns={'impf': 'impf_TC'}, inplace=True) | |
| 86 | 84 | exp.check() | |
| 87 | 85 | ||
| 88 | - imp_set = ImpactFuncSet() | ||
| 89 | - imp_set.read_mat(ENT_TEST_MAT) | ||
| 86 | + imp_set = ImpactFuncSet.from_mat(ENT_TEST_MAT) | ||
| 90 | 87 | ||
| 91 | 88 | new_haz = act_1._cutoff_hazard_damage(exp, imp_set, haz) | |
| 92 | 89 | ||
@@ -110,8 +107,7 @@ def test_cutoff_hazard_pass(self): | |||
| 110 | 107 | ||
| 111 | 108 | def test_cutoff_hazard_region_pass(self): | |
| 112 | 109 | """Test _cutoff_hazard_damage in specific region""" | |
| 113 | - meas = MeasureSet() | ||
| 114 | - meas.read_mat(ENT_TEST_MAT) | ||
| 110 | + meas = MeasureSet.from_mat(ENT_TEST_MAT) | ||
| 115 | 111 | act_1 = meas.get_measure(name='Seawall')[0] | |
| 116 | 112 | act_1.exp_region_id = [1] | |
| 117 | 113 | ||
@@ -121,8 +117,7 @@ def test_cutoff_hazard_region_pass(self): | |||
| 121 | 117 | exp.gdf.region_id.values[10:] = 1 | |
| 122 | 118 | exp.check() | |
| 123 | 119 | ||
| 124 | - imp_set = ImpactFuncSet() | ||
| 125 | - imp_set.read_mat(ENT_TEST_MAT) | ||
| 120 | + imp_set = ImpactFuncSet.from_mat(ENT_TEST_MAT) | ||
| 126 | 121 | ||
| 127 | 122 | new_haz = act_1._cutoff_hazard_damage(exp, imp_set, haz) | |
| 128 | 123 | ||
@@ -255,8 +250,7 @@ def test_filter_exposures_pass(self): | |||
| 255 | 250 | exp.gdf.region_id[0] = 4 | |
| 256 | 251 | exp.check() | |
| 257 | 252 | ||
| 258 | - imp_set = ImpactFuncSet() | ||
| 259 | - imp_set.read_mat(ENT_TEST_MAT) | ||
| 253 | + imp_set = ImpactFuncSet.from_mat(ENT_TEST_MAT) | ||
| 260 | 254 | ||
| 261 | 255 | haz = Hazard.from_mat(HAZ_TEST_MAT) | |
| 262 | 256 | exp.assign_centroids(haz) | |
@@ -343,8 +337,7 @@ def test_apply_ref_pass(self): | |||
| 343 | 337 | """Test apply method: apply all measures but insurance""" | |
| 344 | 338 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 345 | 339 | ||
| 346 | - entity = Entity() | ||
| 347 | - entity.read_mat(ENT_TEST_MAT) | ||
| 340 | + entity = Entity.from_mat(ENT_TEST_MAT) | ||
| 348 | 341 | entity.measures._data['TC'] = entity.measures._data.pop('XX') | |
| 349 | 342 | for meas in entity.measures.get_measure('TC'): | |
| 350 | 343 | meas.haz_type = 'TC' | |
@@ -380,8 +373,7 @@ def test_calc_impact_pass(self): | |||
| 380 | 373 | ||
| 381 | 374 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 382 | 375 | ||
| 383 | - entity = Entity() | ||
| 384 | - entity.read_mat(ENT_TEST_MAT) | ||
| 376 | + entity = Entity.from_mat(ENT_TEST_MAT) | ||
| 385 | 377 | entity.exposures.gdf.rename(columns={'impf': 'impf_TC'}, inplace=True) | |
| 386 | 378 | entity.measures._data['TC'] = entity.measures._data.pop('XX') | |
| 387 | 379 | entity.measures.get_measure(name='Mangroves', haz_type='TC').haz_type = 'TC' | |
@@ -418,8 +410,7 @@ def test_calc_impact_transf_pass(self): | |||
| 418 | 410 | ||
| 419 | 411 | hazard = Hazard.from_mat(HAZ_TEST_MAT) | |
| 420 | 412 | ||
| 421 | - entity = Entity() | ||
| 422 | - entity.read_mat(ENT_TEST_MAT) | ||
| 413 | + entity = Entity.from_mat(ENT_TEST_MAT) | ||
| 423 | 414 | entity.exposures.gdf.rename(columns={'impf': 'impf_TC'}, inplace=True) | |
| 424 | 415 | entity.measures._data['TC'] = entity.measures._data.pop('XX') | |
| 425 | 416 | for meas in entity.measures.get_measure('TC'): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -55,15 +55,15 @@ def test_default_pass(self): | |||
| 55 | 55 | self.assertTrue(isinstance(def_entity.impact_funcs, ImpactFuncSet)) | |
| 56 | 56 | self.assertTrue(isinstance(def_entity.measures, MeasureSet)) | |
| 57 | 57 | ||
| 58 | - def test_read_mat(self): | ||
| 58 | + def test_from_mat(self): | ||
| 59 | 59 | """Read entity from mat file produced by climada.""" | |
| 60 | 60 | entity_mat = Entity.from_mat(ENT_TEST_MAT) | |
| 61 | 61 | self.assertEqual(entity_mat.exposures.tag.file_name, str(ENT_TEST_MAT)) | |
| 62 | 62 | self.assertEqual(entity_mat.disc_rates.tag.file_name, str(ENT_TEST_MAT)) | |
| 63 | 63 | self.assertEqual(entity_mat.measures.tag.file_name, str(ENT_TEST_MAT)) | |
| 64 | 64 | self.assertEqual(entity_mat.impact_funcs.tag.file_name, str(ENT_TEST_MAT)) | |
| 65 | 65 | ||
| 66 | - def test_read_excel(self): | ||
| 66 | + def test_from_excel(self): | ||
| 67 | 67 | """Read entity from an xls file following the template.""" | |
| 68 | 68 | entity_xls = Entity.from_excel(ENT_TEMPLATE_XLS) | |
| 69 | 69 | self.assertEqual(entity_xls.exposures.tag.file_name, str(ENT_TEMPLATE_XLS)) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments