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

Implement Cube.remesh #4751

Open
wjbenfold opened this issue May 19, 2022 · 2 comments
Open

Implement Cube.remesh #4751

wjbenfold opened this issue May 19, 2022 · 2 comments

Comments

@wjbenfold
Copy link
Contributor

✨ Feature Request

Some operations on an iris.cube.Cube with an unstrcutured mesh attached cause this mesh to be lost and the MeshCoords to become normal AuxCoords. I propose that we add a remesh method to a Cube that can be used to recreate a mesh in this situation.

The remesh method would need to take an argument specifying the dimension the mesh coordinates should be taken from (or the actual coordinates) and could optionally clean the mesh up by reducing duplicated nodes down to a single node.

Motivation

Currently, the remeshing process requires the same five(ish) lines of code from the user whenever this occurs, or their own function. By offering this convenience we can make this easier. I wouldn't go as far as to remesh cubes automatically after an operation appears to have caused a user to inadvertently drop the mesh from a cube because I think that's too far towards making their decisions for them.

Example code for doing this job:

new_mesh = Mesh.from_coords(*region_cube.coords(dimensions=1))
new_mesh_coords = new_mesh.to_MeshCoords(conv_cube.location)
for coord in new_mesh_coords:
    region_cube.remove_coord(coord.name())
    region_cube.add_aux_coord(coord, 1)
@github-actions
Copy link
Contributor

github-actions bot commented Oct 2, 2023

In order to maintain a backlog of relevant issues, we automatically label them as stale after 500 days of inactivity.

If this issue is still important to you, then please comment on this issue and the stale label will be removed.

Otherwise this issue will be automatically closed in 28 days time.

@github-actions github-actions bot added the Stale A stale issue/pull-request label Oct 2, 2023
@trexfeathers trexfeathers removed the Stale A stale issue/pull-request label Oct 2, 2023
@scitools-ci scitools-ci bot removed this from 🚴 Peloton Dec 15, 2023
@trexfeathers
Copy link
Contributor

This is very closely linked to #5991 - it's probably a choice between 1 and the other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

2 participants