Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Buffer dtype mismatch, expected 'npy_intp' but got 'double' #45

Open
JPXKQX opened this issue Sep 9, 2024 · 0 comments
Open

[bug] Buffer dtype mismatch, expected 'npy_intp' but got 'double' #45

JPXKQX opened this issue Sep 9, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@JPXKQX
Copy link
Member

JPXKQX commented Sep 9, 2024

What happened?

Some users using the cutout operation (from anemoi-datasets) have the following error when calculating area weights over these nodes:

Buffer dtype mismatch, expected 'npy_intp' but got 'double'

Thanks to Ophélia Miralles for raising this issue.

What are the steps to reproduce the bug?

import torch
from anemoi.graphs.nodes.attributes import AreaWeights   

nodes = torch.load("graph.pt")["data"]
AreaWeights().get_raw_values(nodes)

Version

anemoi-graphs 0.3.0 (scipy 1.12, 1.13, and 1.14)

Platform (OS and architecture)

x86_64 GNU/Linux

Relevant log output

Exception has occurred: ValueError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
Buffer dtype mismatch, expected 'npy_intp' but got 'double'

  File ".../python3.10/site-packages/_voronoi.pyx", line 37, in scipy.spatial._voronoi.sort_vertices_of_regions
  File ".../python3.10/site-packages/scipy/spatial/_spherical_voronoi.py", line 261, in sort_vertices_of_regions
    _voronoi.sort_vertices_of_regions(self._simplices, self.regions)
  File ".../python3.10/site-packages/scipy/spatial/_spherical_voronoi.py", line 264, in _calculate_areas_3d
    self.sort_vertices_of_regions()
  File ".../python3.10/site-packages/scipy/spatial/_spherical_voronoi.py", line 339, in calculate_areas
    return self._calculate_areas_3d()
  File ".../anemoi-graphs/src/anemoi/graphs/nodes/attributes.py", line 123, in get_raw_values
    area_weights = sv.calculate_areas()

Accompanying data

The sample test graph can be downloaded from the following link:

wget https://object-store.os-api.cci1.ecmwf.int/ml-tests/test-data/anemoi-graphs/test_graph.pt

Organisation

ECMWF & MeteoSwiss

@JPXKQX JPXKQX added the bug Something isn't working label Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant