Skip to content

Commit

Permalink
prevent computing synthetic tracks twice
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Hartman committed Aug 5, 2022
1 parent 3b2a8a9 commit 838746b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions climada/hazard/tc_tracks_synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ def calc_perturbed_trajectories(tracks,
'Please ensure constant time steps by applying equal_timestep beforehand')
time_step_h = time_step_h[0]

# ensure we're not making synths from synths
if not sum(1 for t in tracks.data if t.orig_event_flag) == tracks.size:
raise ValueError(
"Not all tracks are original; refusing to compute perturbed "
"trajectories on perturbed trajectories."
)

# number of random value per synthetic track:
# 2*nb_synth_tracks for starting points (lon, lat)
# nb_synth_tracks*(track.time.size-1) for angle and same for translation perturbation
Expand Down

0 comments on commit 838746b

Please sign in to comment.