uxarray icon indicating copy to clipboard operation
uxarray copied to clipboard

Retaining the original UGRID var names after encode_as?

Open erogluorhan opened this issue 2 years ago • 0 comments
trafficstars

Describe the feature you'd like added to this project

In such a simple workflow as follows, we are changing the original UGRID grid topology variable names that may not be favorable by the user:

  1. Read in a UGRID with custom names
  2. Perform things or not
  3. Encode the grid as UGRID (uxgrid.encode_as("ugrid")) for outputting in xarray.Dataset

Community request about it

See the following quote from #363 :

"Converting (or standardizing) names would certainly make the matter simple inside of uxarray, though it means that we are losing a bit of the original UGRID information. Keeping the original information in post-processed outputs may matter in some cases. (I certainly need to keep it, at least for now.) Uxarray does not (or does not need to) have writing IO functions implemented yet, as far as I know, and it is probably not a concern for now."

Additional context

From this, see:

  1. the flow was simply: read in ugrid, encode as ugrid; why variable/dim name changes?

I don't believe this should be something we need to worry about, especially for the following case

  1. Read in UGRID
  2. Do stuff (i.e. compute Mesh2_face_edges, compute face area)
  3. Encode as UGRID

If we chose to encode using the original variable and dimension names, there is a high likelyhood that the encoded dataset will have two types of variables/dims (original mixed with new ones from the computed variables). for the sake of standardization, I think its fair to assume that our encode_as functions will follow our definition of an unstructured grid, including the variable and dimension names. On the topic of our "definition", we should look into better documenting our definition of an unstructured grid, because even though we follow the UGRID conventions, we have been slowly adding our own variables, such as the way we represent Cartesian Coordinates. Once this is merged, I'll handle that in #408

Actually, your points make much sense to me. However, the following quote was from #363, so I think we should still take into consideration there might be some user expectations about this:

"Converting (or standardizing) names would certainly make the matter simple inside of uxarray, though it means that we are losing a bit of the original UGRID information. Keeping the original information in post-processed outputs may matter in some cases. (I certainly need to keep it, at least for now.) Uxarray does not (or does not need to) have writing IO functions implemented yet, as far as I know, and it is probably not a concern for now."

Describe the solution you'd like We might need to introduce again a structure like grid_var_names and use it for retaining the original names.

erogluorhan avatar Sep 15 '23 18:09 erogluorhan