Node attributes

class anemoi.graphs.nodes.attributes.SphericalAreaWeights(norm: str | None = None, radius: float = 1.0, centre: ndarray = array([0, 0, 0]), fill_value: float = 0.0, dtype: str = 'float32')

Bases: BaseNodeAttribute

Implements the 3D area of the nodes as the weights.

norm

Normalisation of the weights.

Type:

str

radius

Radius of the sphere.

Type:

float

centre

Centre of the sphere.

Type:

np.ndarray

fill_value

Value to fill the empty regions.

Type:

float

compute(self, graph, nodes_name)

Compute the area attributes for each node.

get_raw_values(nodes: NodeStorage, **kwargs) ndarray

Compute the area associated to each node.

It uses Voronoi diagrams to compute the area of each node.

Parameters:
  • nodes (NodeStorage) – Nodes of the graph.

  • kwargs (dict) – Additional keyword arguments.

Returns:

Attributes.

Return type:

np.ndarray

class anemoi.graphs.nodes.attributes.PlanarAreaWeights(norm: str | None = None, dtype: str = 'float32')

Bases: BaseNodeAttribute

Implements the 2D area of the nodes as the weights.

norm

Normalisation of the weights.

Type:

str

compute(self, graph, nodes_name)

Compute the area attributes for each node.

class anemoi.graphs.nodes.attributes.UniformWeights(norm: str | None = None, dtype: str = 'float32')

Bases: BaseNodeAttribute

Implements a uniform weight for the nodes.

compute(self, graph, nodes_name)

Compute the area attributes for each node.

get_raw_values(nodes: NodeStorage, **kwargs) Tensor

Compute the weights.

Parameters:
  • nodes (NodeStorage) – Nodes of the graph.

  • kwargs (dict) – Additional keyword arguments.

Returns:

Ones.

Return type:

torch.Tensor

class anemoi.graphs.nodes.attributes.CutOutMask

Bases: BooleanBaseNodeAttribute

Cut out mask.

class anemoi.graphs.nodes.attributes.NonmissingAnemoiDatasetVariable(variable: str)

Bases: BooleanBaseNodeAttribute

Mask of valid (not missing) values of a Anemoi dataset variable.

It reads a variable from a Anemoi dataset and returns a boolean mask of nonmissing values in the first timestep.

variable

Variable to read from the Anemoi dataset.

Type:

str

compute(self, graph, nodes_name)

Compute the attribute for each node.

class anemoi.graphs.nodes.attributes.BooleanAndMask(masks: str | Type[BooleanBaseNodeAttribute] | list[str | Type[BooleanBaseNodeAttribute]])

Bases: BooleanOperation

Boolean AND mask.

class anemoi.graphs.nodes.attributes.BooleanNot(masks: str | Type[BooleanBaseNodeAttribute] | list[str | Type[BooleanBaseNodeAttribute]])

Bases: BooleanOperation

Boolean NOT mask.

class anemoi.graphs.nodes.attributes.BooleanOrMask(masks: str | Type[BooleanBaseNodeAttribute] | list[str | Type[BooleanBaseNodeAttribute]])

Bases: BooleanOperation

Boolean OR mask.