Skip to content
Snippets Groups Projects
Commit da3382ea authored by Nils-Arne Dreier's avatar Nils-Arne Dreier Committed by Siddhant Tibrewal
Browse files

fix: set global indices in healpix grid definition

parent 668609d8
No related branches found
No related tags found
1 merge request!54Improvements from integration of Hiopy into the Global Hackathon Atmo-only Runs
Pipeline #102634 waiting for manual action
......@@ -88,4 +88,6 @@ def def_healpix_grid(coyote, nside, nest=True, cell_idx=None):
verts_xyz, quads = np.unique(boundaries_xyz, return_inverse=True, axis=0)
vlon, vlat = _xyz2lonlat(verts_xyz)
vertex_of_cell = quads.reshape(-1, 4).T
coyote.def_grid(4 * np.ones(len(cell_idx)), vlon, vlat, vertex_of_cell.T.flatten(), clon, clat)
coyote.def_grid(
4 * np.ones(len(cell_idx)), vlon, vlat, vertex_of_cell.T.flatten(), clon, clat, cell_idx
)
......@@ -61,27 +61,33 @@ PYBIND11_MODULE(coyote, m) {
py::array_t<double, py::array::c_style | py::array::forcecast> y_vertices,
py::array_t<int, py::array::c_style | py::array::forcecast> cell_to_vertex,
std::optional<py::array_t<double, py::array::c_style | py::array::forcecast>> x_cells,
std::optional<py::array_t<double, py::array::c_style | py::array::forcecast>>
y_cells) {
std::optional<py::array_t<double, py::array::c_style | py::array::forcecast>> y_cells,
std::optional<py::array_t<int, py::array::c_style | py::array::forcecast>>
global_cell_indices) {
std::optional<std::span<const double>> _x_cells = std::nullopt;
if (x_cells)
_x_cells = _array2span(x_cells.value());
std::optional<std::span<const double>> _y_cells = std::nullopt;
if (y_cells)
_y_cells = _array2span(y_cells.value());
std::optional<std::span<const int>> _global_cell_indices = std::nullopt;
if (global_cell_indices)
_global_cell_indices = _array2span(global_cell_indices.value());
c.def_grid(_array2span(num_vertices_per_cell),
_array2span(x_vertices),
_array2span(y_vertices),
_array2span(cell_to_vertex),
_x_cells,
_y_cells);
_y_cells,
_global_cell_indices);
},
"num_vertices_per_cell"_a,
"x_vertices"_a,
"y_vertices"_a,
"cell_to_vertex"_a,
py::arg("x_cells") = std::nullopt,
py::arg("y_cells") = std::nullopt)
py::arg("x_cells") = std::nullopt,
py::arg("y_cells") = std::nullopt,
py::arg("global_cell_idx") = std::nullopt)
.def("get_all_comp_grid_fields", &Coyote::get_all_comp_grid_fields);
py::class_<Event>(m, "Event")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment