def test_calc_decay_no_landfall_pass(self): """Test _calc_land_decay with no historical tracks with landfall""" tc_track = tc.TCTracks() tc_track.read_processed_ibtracs_csv(TEST_TRACK_SHORT) extent = tc_track.get_extent() land_geom = climada.util.coordinates.get_land_geometry( extent=extent, resolution=10 ) tc.track_land_params(tc_track.data[0], land_geom) with self.assertLogs('climada.hazard.tc_tracks_synth', level='INFO') as cm: tc_synth._calc_land_decay(tc_track.data, land_geom) self.assertIn('No historical track with landfall.', cm.output[0])
def test_calc_land_decay_pass(self): """Test _calc_land_decay with environmental pressure function.""" tc_track = tc.TCTracks.from_processed_ibtracs_csv(TC_ANDREW_FL) extent = tc_track.get_extent() land_geom = climada.util.coordinates.get_land_geometry(extent=extent, resolution=10) tc.track_land_params(tc_track.data[0], land_geom) v_rel, p_rel = tc_synth._calc_land_decay(tc_track.data, land_geom) self.assertEqual(7, len(v_rel)) for i, val in enumerate(v_rel.values()): self.assertAlmostEqual(val, 0.0038894834) self.assertTrue(i - 1 in v_rel.keys()) self.assertEqual(7, len(p_rel)) for i, val in enumerate(p_rel.values()): self.assertAlmostEqual(val[0], 1.0598491) self.assertAlmostEqual(val[1], 0.0041949237) self.assertTrue(i - 1 in p_rel.keys())