Skip to content

Commit

Permalink
🐛 Fix bug with undetected nulls
Browse files Browse the repository at this point in the history
  • Loading branch information
i-be-snek committed Nov 27, 2024
1 parent 868ce8e commit 25c63d8
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions Database/fill_data_gap.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,24 +329,23 @@
for e_id in e_ids_missing_l1_impacts:
drop_l2 = True
for impact in l2.keys():
null_mask_l2 = l2[impact][[dg_utils.num_min, dg_utils.num_max]].isnull().any(axis=1)
null_mask_l2 = l2[impact][[dg_utils.num_min, dg_utils.num_max]].isnull().all(axis=1)
if not l2[impact][(~null_mask_l2) & (l2[impact][dg_utils.event_id] == e_id)].empty:
logger.warning(
f"L2 contains impacts not propagated to L1!\n{l2[impact][l2[impact][dg_utils.event_id] == e_id]}"
f"L2 {e_id} contains impacts not propagated to L1!\n{l2[impact][l2[impact][dg_utils.event_id] == e_id]}"
)
drop_l2 = False
if drop_l2:
missing_event_ids_to_drop.append(e_id)

drop_l3 = True
for impact in l3.keys():
null_mask_l3 = l3[impact][[dg_utils.num_min, dg_utils.num_max]].isnull().all(axis=1)
if not l3[impact][(~null_mask_l3) & (l3[impact][dg_utils.event_id] == e_id)].empty:
drop_l3 = False
logger.warning(
f"L3 contains impacts not propagated to L1!\n{l3[impact][l3[impact][dg_utils.event_id] == e_id]}"
f"L3 {e_id} contains impacts not propagated to L1!\n{l3[impact][l3[impact][dg_utils.event_id] == e_id]}"
)
if drop_l3:

if drop_l3 and drop_l2:
missing_event_ids_to_drop.append(e_id)

missing_event_ids_to_drop = list(set(missing_event_ids_to_drop))
Expand Down

0 comments on commit 25c63d8

Please sign in to comment.