[Bug]: Singletons breaks default sort_ascending=True
in swap_lon_axis()
#389
Labels
type: bug
Inconsistencies or issues which will cause an issue or problem for users or implementors.
What happened?
Hey @mzelinka and @pochedls, this issue is related to
height
being a singleton coordinate. Singleton coordinate variables are included alongside other coordinate variables (refer to code example below). There is an open xarray issue regarding singletons here: pydata/xarray#6196How it affects
swap_lon_axis()
In
swap_lon_axis()
, we are getting all of the coordinates keys usinglon
, which includesheight
.This causes
swap_lon_axis(ds, sort_ascending=True)
to break on this file.xcdat/xcdat/axis.py
Lines 235 to 236 in d5d4fd7
xcdat/xcdat/axis.py
Lines 259 to 260 in d5d4fd7
Temporary workaround:
sort_ascending=False
inswap_lon_axis()
and perform sorting manuallyThe fix for
swap_lon_axis()
is to ignore singleton coordinate keys.Originally posted by @tomvothecoder in #296 (reply in thread)
What did you expect to happen?
swap_lon_axis()
should disregard singletons such asheight
when sorting coordinates.Minimal Complete Verifiable Example
No response
Relevant log output
No response
Anything else we need to know?
No response
Environment
xcdat=0.4.0
The text was updated successfully, but these errors were encountered: