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

Use of set to test uniqueness of grids in wrap_func_objects results in unwanted behavior. #206

Closed
JoerivanEngelen opened this issue Jan 29, 2024 · 1 comment · Fixed by #207
Assignees

Comments

@JoerivanEngelen
Copy link
Contributor

To create a list of unique grids, set is used

grids = set(grids)

However, this tests if grids refer to the same object, which results in behaviour like this:

import xugrid as xu

a = xu.data.disk()
grids = xu.concat([a, a], dim="foo").grids
print(len(grids)) # prints 1

grids2= xu.concat([xu.data.disk(), xu.data.disk()], dim="foo").grids
print(len(grids)) # prints 2

We want to test if grids are equal, as to be fixed in this issue:
#205

@github-project-automation github-project-automation bot moved this to 📯 New in iMOD Suite Jan 29, 2024
@JoerivanEngelen JoerivanEngelen moved this from 📯 New to 🤝 Accepted in iMOD Suite Jan 29, 2024
@Huite
Copy link
Collaborator

Huite commented Jan 29, 2024

Adding to some of the things in #205
If objects are equal, but not exactly (i.e. one has a celltree initialized, but the other doesn't), in general you'd want the richer object. But there's no clear definition of that, so I'd say: just take the first if there's many.

@JoerivanEngelen JoerivanEngelen moved this from 🤝 Accepted to 🏗 In Progress in iMOD Suite Jan 31, 2024
@JoerivanEngelen JoerivanEngelen self-assigned this Jan 31, 2024
@JoerivanEngelen JoerivanEngelen moved this from 🏗 In Progress to 🧐 In Review in iMOD Suite Jan 31, 2024
JoerivanEngelen added a commit that referenced this issue Jan 31, 2024
* Deal with review comments

* Simplify unique_grids method

* update changelog
@github-project-automation github-project-automation bot moved this from 🧐 In Review to ✅ Done in iMOD Suite Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants