hainegroup / oceanspy

A Python package to facilitate ocean model data analysis and visualization.
https://oceanspy.readthedocs.io
MIT License
98 stars 32 forks source link

wrong mate grid vars leads to incorrect transformed dimensions #327

Closed Mikejmnez closed 1 year ago

Mikejmnez commented 1 year ago

I just realized that I incorrectly defined the mate pairs for the new coordinates XU, YU and XV, YV. Mate is an attribute that is defined for variables at velocity points in dataset with complex topology. For example, U and V are mates (pair), an information that is required when data across facets (faces) have different topology (this is a consequence of the logical X dimension increasing with -Latitude in rotated faces).

The incorrect definition is that right now I set XU and YU as mate pairs, and XV and YV as another mate pair. This is incorrect. The correct pair is:

XU, YV

and

XV, YU

The definition of these mate variables happens in llc_rearrange.py ( line 639-682). The result of incorrect assignment leads to a transformed dataset with those variables (XU, YU, XV, YV) having incorrect transformed dimensions. Since the transformation is all done lazily, there is no error that flags it.

Until I fix this later today with the other PR that closes #324, a simple workaround this is to drop the grid variables with wrong dimensions for the cut_od dataset after the transformation. This is:

cut_od._ds = cut_od._ds.drop_vars(['XU', 'YU', 'XV', 'YV'])

Expect a PR later today fixing this.

Mikejmnez commented 1 year ago

closed by #328