Skip to content

Precision issue from Grid.__from_vert__() using np.unique() #305

Closed as not planned

Description

@hongyuchen1030

Describe the bug
Currently, the Grid.__from_vert__() method uses numpy.unique() to identify duplicate nodes in the coordinates format, which may lead to precision inconsistencies. For example, two nodes whose coordinates are within a threshold of 10^-12 may be considered different nodes. This can cause errors when working with Grid objects that require precise node information.

To Reproduce

  1. Create a Grid object using Grid.__from_vert__().
  2. Initialize the Grid object with an input array that contains nodes with coordinates that are within a threshold of 10^-12.
  3. Access the nodes using the Grid.nodes attribute.
  4. Notice that duplicate nodes may be present, even though they should be considered the same node.

Expected behavior
I would expect that Grid.__from_vert__() identifies duplicate nodes based on a threshold of 10^-12. This would ensure that nodes with similar coordinates are considered the same node.

Additional context
This bug affects the precision of node information in Grid objects and can cause errors in downstream analysis. It would be helpful to update Grid.__from_vert__() to use a threshold when identifying duplicate nodes to ensure consistent behavior.

Activity

  1. added
    bug
    on May 3, 2023
  2. moved this from 📝 To Do to ✅ Done in UXarray Developmenton Aug 22, 2023
  3. moved this from ✅ Done to Closed (Undone) in UXarray Developmenton Aug 22, 2023
  4. moved this from Closed (Undone) to ✅ Done in UXarray Developmenton Aug 22, 2023
  5. moved this from ✅ Done to Closed (Undone) in UXarray Developmenton Aug 22, 2023
  6. moved this from Closed (Undone) to ✅ Done in UXarray Developmenton Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Fields

Priority

None yet

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions