Merge branch 'develop' into feature/from_netcdf_fast #1163
5 fail, 712 pass in 8m 42s
Annotations
Check warning on line 0 in climada.hazard.test.test_tc_tracks_synth.TestSynth
github-actions / Core / Unit Test Results (3.11)
test_random_no_landfall_pass (climada.hazard.test.test_tc_tracks_synth.TestSynth) failed
tests_xml/tests.xml [took 0s]
Raw output
NameError: name 'climada' is not defined
self = <climada.hazard.test.test_tc_tracks_synth.TestSynth testMethod=test_random_no_landfall_pass>
def test_random_no_landfall_pass(self):
"""Test calc_perturbed_trajectories with decay and no historical tracks with landfall"""
tc_track = tc.TCTracks.from_processed_ibtracs_csv(TEST_TRACK_SHORT)
expected_warning = "only %s historical tracks were provided. " % len(
tc_track.data
)
with self.assertLogs("climada.hazard.tc_tracks_synth", level="INFO") as cm:
> tc_track.calc_perturbed_trajectories(use_global_decay_params=False)
climada/hazard/test/test_tc_tracks_synth.py:633:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <climada.hazard.tc_tracks.TCTracks object at 0x7fbd16ca4890>
kwargs = {'use_global_decay_params': False}
def calc_perturbed_trajectories(self, **kwargs):
"""See function in `climada.hazard.tc_tracks_synth`."""
> climada.hazard.tc_tracks_synth.calc_perturbed_trajectories(self, **kwargs)
E NameError: name 'climada' is not defined
climada/hazard/tc_tracks.py:1396: NameError
Check warning on line 0 in climada.hazard.test.test_tc_tracks_synth.TestSynth
github-actions / Core / Unit Test Results (3.11)
test_random_walk_decay_pass (climada.hazard.test.test_tc_tracks_synth.TestSynth) failed
tests_xml/tests.xml [took 0s]
Raw output
NameError: name 'climada' is not defined
self = <climada.hazard.test.test_tc_tracks_synth.TestSynth testMethod=test_random_walk_decay_pass>
def test_random_walk_decay_pass(self):
"""Test land decay is called from calc_perturbed_trajectories."""
assert TC_ANDREW_FL.is_file()
tc_track = tc.TCTracks.from_processed_ibtracs_csv(TC_ANDREW_FL)
nb_synth_tracks = 2
# should work if using global parameters
with self.assertLogs("climada.hazard.tc_tracks_synth", level="DEBUG") as cm0:
> tc_track.calc_perturbed_trajectories(
nb_synth_tracks=nb_synth_tracks,
seed=25,
decay=True,
use_global_decay_params=True,
)
climada/hazard/test/test_tc_tracks_synth.py:684:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <climada.hazard.tc_tracks.TCTracks object at 0x7fbd16e3be50>
kwargs = {'decay': True, 'nb_synth_tracks': 2, 'seed': 25, 'use_global_decay_params': True}
def calc_perturbed_trajectories(self, **kwargs):
"""See function in `climada.hazard.tc_tracks_synth`."""
> climada.hazard.tc_tracks_synth.calc_perturbed_trajectories(self, **kwargs)
E NameError: name 'climada' is not defined
climada/hazard/tc_tracks.py:1396: NameError
Check warning on line 0 in climada.hazard.test.test_tc_tracks_synth.TestSynth
github-actions / Core / Unit Test Results (3.11)
test_random_walk_identical_pass (climada.hazard.test.test_tc_tracks_synth.TestSynth) failed
tests_xml/tests.xml [took 0s]
Raw output
NameError: name 'climada' is not defined
self = <climada.hazard.test.test_tc_tracks_synth.TestSynth testMethod=test_random_walk_identical_pass>
def test_random_walk_identical_pass(self):
"""Test 0 perturbation leads to identical tracks."""
tc_track = tc.TCTracks.from_processed_ibtracs_csv(TC_ANDREW_FL)
nb_synth_tracks = 2
> tc_track.calc_perturbed_trajectories(
nb_synth_tracks=nb_synth_tracks,
max_shift_ini=0,
max_dspeed_rel=0,
max_ddirection=0,
decay=False,
)
climada/hazard/test/test_tc_tracks_synth.py:730:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <climada.hazard.tc_tracks.TCTracks object at 0x7fbd16c70e10>
kwargs = {'decay': False, 'max_ddirection': 0, 'max_dspeed_rel': 0, 'max_shift_ini': 0, ...}
def calc_perturbed_trajectories(self, **kwargs):
"""See function in `climada.hazard.tc_tracks_synth`."""
> climada.hazard.tc_tracks_synth.calc_perturbed_trajectories(self, **kwargs)
E NameError: name 'climada' is not defined
climada/hazard/tc_tracks.py:1396: NameError
Check warning on line 0 in climada.hazard.test.test_tc_tracks_synth.TestSynth
github-actions / Core / Unit Test Results (3.11)
test_random_walk_ref_pass (climada.hazard.test.test_tc_tracks_synth.TestSynth) failed
tests_xml/tests.xml [took 0s]
Raw output
NameError: name 'climada' is not defined
self = <climada.hazard.test.test_tc_tracks_synth.TestSynth testMethod=test_random_walk_ref_pass>
def test_random_walk_ref_pass(self):
"""Test against MATLAB reference."""
tc_track = tc.TCTracks.from_processed_ibtracs_csv(TEST_TRACK_SHORT)
nb_synth_tracks = 2
> tc_track.calc_perturbed_trajectories(
nb_synth_tracks=nb_synth_tracks, seed=25, decay=False
)
climada/hazard/test/test_tc_tracks_synth.py:641:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <climada.hazard.tc_tracks.TCTracks object at 0x7fbd16331c10>
kwargs = {'decay': False, 'nb_synth_tracks': 2, 'seed': 25}
def calc_perturbed_trajectories(self, **kwargs):
"""See function in `climada.hazard.tc_tracks_synth`."""
> climada.hazard.tc_tracks_synth.calc_perturbed_trajectories(self, **kwargs)
E NameError: name 'climada' is not defined
climada/hazard/tc_tracks.py:1396: NameError
Check warning on line 0 in climada.hazard.test.test_tc_tracks_synth.TestSynth
github-actions / Core / Unit Test Results (3.11)
test_random_walk_single_point (climada.hazard.test.test_tc_tracks_synth.TestSynth) failed
tests_xml/tests.xml [took 1s]
Raw output
NameError: name 'climada' is not defined
self = <climada.hazard.test.test_tc_tracks_synth.TestSynth testMethod=test_random_walk_single_point>
def test_random_walk_single_point(self):
found = False
for year in range(1951, 1981):
tc_track = tc.TCTracks.from_ibtracs_netcdf(
provider="usa", year_range=(year, year), discard_single_points=False
)
singlept = np.where([x["time"].size == 1 for x in tc_track.data])[0]
found = len(singlept) > 0
if found:
# found a case with a single-point track, keep max three tracks for efficiency
tc_track.data = tc_track.data[max(0, singlept[0] - 1) : singlept[0] + 2]
n_tr = tc_track.size
tc_track.equal_timestep()
> tc_track.calc_perturbed_trajectories(nb_synth_tracks=2)
climada/hazard/test/test_tc_tracks_synth.py:770:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <climada.hazard.tc_tracks.TCTracks object at 0x7fbd16834f90>
kwargs = {'nb_synth_tracks': 2}
def calc_perturbed_trajectories(self, **kwargs):
"""See function in `climada.hazard.tc_tracks_synth`."""
> climada.hazard.tc_tracks_synth.calc_perturbed_trajectories(self, **kwargs)
E NameError: name 'climada' is not defined
climada/hazard/tc_tracks.py:1396: NameError