Node builder
- class anemoi.graphs.nodes.builders.from_file.AnemoiDatasetNodes(dataset: DictConfig, name: str)
Bases:
BaseNodeBuilderNodes from an anemoi dataset.
- get_coordinates()
Get the lat-lon coordinates of the nodes.
- register_nodes(graph, name)
Register the nodes in the graph.
- register_attributes(graph, name, config)
Register the attributes in the nodes of the graph specified.
- update_graph(graph, name, attrs_config)
Update the graph with new nodes and attributes.
- get_coordinates() Tensor
Get the coordinates of the nodes.
- Returns:
A 2D tensor with the coordinates, in radians.
- Return type:
torch.Tensor of shape (num_nodes, 2)
- class anemoi.graphs.nodes.builders.from_file.TextNodes(dataset: str | Path, name: str, idx_lon: int = 0, idx_lat: int = 1)
Bases:
BaseNodeBuilderNodes from text file.
- dataset
The path including filename to txt file containing the coordinates of the nodes.
- Type:
str | Path
- get_coordinates() Tensor
Get the coordinates of the nodes.
- Returns:
A 2D tensor with the coordinates, in radians.
- Return type:
torch.Tensor of shape (num_nodes, 2)
- class anemoi.graphs.nodes.builders.from_file.NPZFileNodes(npz_file: str, name: str, lat_key: str = 'latitudes', lon_key: str = 'longitudes')
Bases:
BaseNodeBuilderNodes from NPZ defined grids.
- get_coordinates()
Get the lat-lon coordinates of the nodes.
- register_nodes(graph, name)
Register the nodes in the graph.
- register_attributes(graph, name, config)
Register the attributes in the nodes of the graph specified.
- update_graph(graph, name, attrs_config)
Update the graph with new nodes and attributes.
- get_coordinates() Tensor
Get the coordinates of the nodes.
- Returns:
A 2D tensor with the coordinates, in radians.
- Return type:
torch.Tensor of shape (num_nodes, 2)
- class anemoi.graphs.nodes.builders.from_file.LimitedAreaNPZFileNodes(npz_file: str, reference_node_name: str, name: str, lat_key: str = 'latitudes', lon_key: str = 'longitudes', mask_attr_name: str | None = None, margin_radius_km: float = 100.0)
Bases:
NPZFileNodesNodes from NPZ defined grids using an area of interest.
- register_nodes(graph: HeteroData) None
Register nodes in the graph.
- Parameters:
graph (HeteroData) – The graph to register the nodes.
- Returns:
The graph with the registered nodes.
- Return type:
HeteroData
- get_coordinates() ndarray
Get the coordinates of the nodes.
- Returns:
A 2D tensor with the coordinates, in radians.
- Return type:
torch.Tensor of shape (num_nodes, 2)
- class anemoi.graphs.nodes.builders.from_file.XArrayNodes(dataset: str, name: str, lat_key: str = 'lat', lon_key: str = 'lon')
Bases:
BaseNodeBuilderClass for creating graph nodes based on a xarray-compatible file format.
- Parameters:
dataset (str) – Path to xarray compatible file (e.g., NetCDF or zarr) containing latitude and longitude variables.
name (str) – Identifier to use for the nodes within the graph.
lat_key (str, optional) – Variable name for latitude in the dataset (default: “lat”).
lon_key (str, optional) – Variable name for longitude in the dataset (default: “lon”).
- get_coordinates()
Get the lat-lon coordinates of the nodes.
- register_nodes(graph, name)
Register the nodes in the graph.
- register_attributes(graph, name, config)
Register the attributes in the nodes of the graph specified.
- update_graph(graph, name, attrs_config)
Update the graph with new nodes and attributes.
- class anemoi.graphs.nodes.builders.from_healpix.HEALPixNodes(resolution: int, name: str)
Bases:
BaseNodeBuilderNodes from HEALPix grid.
HEALPix is an acronym for Hierarchical Equal Area isoLatitude Pixelization of a sphere.
- get_coordinates()
Get the lat-lon coordinates of the nodes.
- register_nodes(graph, name)
Register the nodes in the graph.
- register_attributes(graph, name, config)
Register the attributes in the nodes of the graph specified.
- update_graph(graph, name, attrs_config)
Update the graph with new nodes and attributes.
- get_coordinates() Tensor
Get the coordinates of the nodes.
- Returns:
Coordinates of the nodes, in radians.
- Return type:
torch.Tensor of shape (num_nodes, 2)
- class anemoi.graphs.nodes.builders.from_healpix.LimitedAreaHEALPixNodes(resolution: str, reference_node_name: str, name: str, mask_attr_name: str | None = None, margin_radius_km: float = 100.0)
Bases:
HEALPixNodesNodes from HEALPix grid using an area of interest.
- register_nodes(graph: HeteroData) None
Register nodes in the graph.
- Parameters:
graph (HeteroData) – The graph to register the nodes.
- Returns:
The graph with the registered nodes.
- Return type:
HeteroData
- get_coordinates() ndarray
Get the coordinates of the nodes.
- Returns:
Coordinates of the nodes, in radians.
- Return type:
torch.Tensor of shape (num_nodes, 2)
- class anemoi.graphs.nodes.builders.from_refined_icosahedron.TriNodes(resolution: int | list[int], name: str)
Bases:
IcosahedralNodesNodes based on iterative refinements of an icosahedron.
It depends on the trimesh Python library.
- class anemoi.graphs.nodes.builders.from_refined_icosahedron.HexNodes(resolution: int | list[int], name: str)
Bases:
IcosahedralNodesNodes based on iterative refinements of an icosahedron.
It depends on the h3 Python library.
- class anemoi.graphs.nodes.builders.from_refined_icosahedron.LimitedAreaTriNodes(resolution: int | list[int], reference_node_name: str, name: str, mask_attr_name: str | None = None, margin_radius_km: float = 100.0)
Bases:
LimitedAreaIcosahedralNodesNodes based on iterative refinements of an icosahedron using an area of interest.
It depends on the trimesh Python library.
- Parameters:
area_mask_builder (AreaMaskBuilder) – The area of interest mask builder.
- class anemoi.graphs.nodes.builders.from_refined_icosahedron.LimitedAreaHexNodes(resolution: int | list[int], reference_node_name: str, name: str, mask_attr_name: str | None = None, margin_radius_km: float = 100.0)
Bases:
LimitedAreaIcosahedralNodesNodes based on iterative refinements of an icosahedron using an area of interest.
It depends on the h3 Python library.
- Parameters:
area_mask_builder (AreaMaskBuilder) – The area of interest mask builder.
- class anemoi.graphs.nodes.builders.from_refined_icosahedron.StretchedTriNodes(global_resolution: int, lam_resolution: int, name: str, reference_node_name: str, mask_attr_name: str | None = None, margin_radius_km: float = 100.0)
Bases:
StretchedIcosahedronNodesNodes based on iterative refinements of an icosahedron with 2 different resolutions.
It depends on the trimesh Python library.