Skip to content

Commit

Permalink
fix: remove the bug in the graph cleaning function
Browse files Browse the repository at this point in the history
Co-authored-by: Jesper Dramsch <[email protected]>
  • Loading branch information
theissenhelen and JesperDramsch committed Aug 14, 2024
1 parent 3d8b1ea commit 6997711
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/anemoi/graphs/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,12 @@ def clean(self, graph: HeteroData) -> HeteroData:
HeteroData
cleaned graph
"""
LOGGER.info("Cleaning graph.")
for type_name in chain(graph.node_types, graph.edge_types):
for attr_name in list(graph[type_name].keys()):
if attr_name.startswith("_"):
del graph[type_name][attr_name]
attr_names_to_remove = [attr_name for attr_name in graph[type_name] if attr_name.startswith("_")]
for attr_name in attr_names_to_remove:
del graph[type_name][attr_name]
LOGGER.info(f"{attr_name} deleted from graph.")

return graph

Expand Down

0 comments on commit 6997711

Please sign in to comment.