Post processor
- class anemoi.graphs.processors.post_process.BaseNodeMaskingProcessor(nodes_name: str, save_mask_indices_to_attr: str | None = None)
Bases:
PostProcessor
,ABC
Base class for mask based node processor.
- removing_nodes(graph: HeteroData) HeteroData
Remove nodes based on the mask passed.
- update_edge_indices(graph: HeteroData) HeteroData
Update the edge indices to the new position of the nodes.
- add_attribute(graph: HeteroData) HeteroData
Add an attribute of the mask indices as node attribute.
- class anemoi.graphs.processors.post_process.RemoveUnconnectedNodes(nodes_name: str, save_mask_indices_to_attr: str | None = None, ignore: str | None = None)
Bases:
BaseNodeMaskingProcessor
Remove unconnected nodes in the graph.
- ignore
Name of an attribute to ignore when removing nodes. Nodes with this attribute set to True will not be removed.
- Type:
str, optional
- save_mask_indices_to_attr
Name of the attribute to save the mask indices. If provided, the indices of the kept nodes will be saved in this attribute.
- Type:
str, optional
- compute_mask(graph)
Compute the mask of the connected nodes.
- prune_graph(graph, mask)
Prune the nodes with the specified mask.
- add_attribute(graph, mask)
Add an attribute of the mask indices as node attribute.
- update_graph(graph)
Post-process the graph.
- compute_mask(graph: HeteroData) Tensor
Compute the mask of connected nodes.
- class anemoi.graphs.processors.post_process.BaseEdgeMaskingProcessor(source_name: str, target_name: str)
Bases:
PostProcessor
,ABC
Base class for mask based edge processor.
- removing_edges(graph: HeteroData) HeteroData
Remove edges based on the mask passed.
- class anemoi.graphs.processors.post_process.RestrictEdgeLength(source_name: str, target_name: str, max_length_km: float, source_mask_attr_name: str | None = None, target_mask_attr_name: str | None = None)
Bases:
BaseEdgeMaskingProcessor
Remove edges longer than a given treshold from the graph.
- source_mask_attr_name
the postprocessing will be restricted to edges with source node having True in this mask_attr
- Type:
str , optional
- target_mask_attr_name
the postprocessing will be restricted to edges with target node having True in this mask_attr
- Type:
str, optional
- compute_mask(graph)
Compute the mask of the relevant edges longer than max_length_km.