Skip to content
This repository was archived by the owner on Dec 20, 2024. It is now read-only.
This repository was archived by the owner on Dec 20, 2024. It is now read-only.

[bugfix] Ensure input to latlon_rad_to_cartesian is numpy array #31

@roxas6path

Description

@roxas6path

What happened?

The get_raw_values function belonging to anemoi.graphs.nodes.attributes.AreaWeights has an argument named nodes of type torch_geometric.data.storage.NodeStorage.

This torch_geometric.data.storage.NodeStorage class has a member x which is a two-dimensional array with values corresponding to the latitude and longitude values. This NodeStorage class member is a Torch Tensor.

In the get_raw_values function, we have:

def get_raw_values(self, nodes: NodeStorage, *args, **kwargs) -> np.ndarray:
    ...
    latitudes, longitudes = nodes.x[:, 0], nodes.x[:, 1]
    points = latlon_rad_to_cartesian(latitudes, longitudes)
    sv = SphericalVoronoi(points, self.radius, self.centre)

The scipy.spatial.SphericalVoronoi class requires the points value to be a numpy array.

What are the steps to reproduce the bug?

N/A

Version

0.2.2

Platform (OS and architecture)

Linux x86_64

Relevant log output

No response

Accompanying data

No response

Organisation

ECMWF

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions