uxarray: Inconsistent Normalization of Cartesian Coordinates in `node_x`, `node_y`, and `node_z`

Version

v2024.06

How did you install UXarray?

Conda

What happened?

Our project performs geometric operations on unstructured grids on a unit sphere, which means all points on the sphere should be normalized. The normalized Cartesian coordinates are stored in the node_x, node_y, and node_z variables.

However, while in most cases the node_x, node_y, and node_z variables are normalized as they should be, when reading in the MPAS data, these variables are not normalized. This inconsistency leads to breakdowns in subsequent operations.

What did you expect to happen?

the node_x, node_y, and node_z variables to be consistently normalized across all datasets, including the MPAS data.

It is crucial to emphasize and document that node_x, node_y, and node_zmust always represent normalized points on the sphere. Ensuring these variables are normalized as required is essential for the robustness and reliability of our project.

Can you provide a MCVE to repoduce the bug?

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (15 by maintainers)

Most upvoted comments

After our discussions, it seems crucial to emphasize that the fundamental premise of our project is based on a spherical surface. Users should not expect our calculations to apply to any other surfaces, such as the actual shape of the Earth. By clearly highlighting this premise, users can make informed choices: they can either use the normalized node coordinates or simply multiply them by the Earth’s radius.

the node_x, node_y, and node_z variables to be consistently normalized across all datasets, including the MPAS data.

I’d prefer if we had an option to select the normalization, either as a parameter to ux.open_grid or as a method part of the Grid class, with warnings/exceptions raised when running a feature that requires normalization. While it’s not computationally expensive, it might be misleading to someone simply trying to use UXarray to load in the data and use the values that are expected from the grid file.

As of now, this would only impact any MPAS, EXODUS, or UGRID files that contain Cartesian coordinates.

image
# Option 1: parameter 
uxgrid = ux.open_grid(..., normalize_cartesian_coordinates=True)

# Option2 : Grid method
uxgrid.normalize_cartesian_coordinates()

We can support both options as well

Wondering what @erogluorhan and @rajeeja think about this design.