File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -2135,13 +2135,15 @@ def serialize(x, axis):
21352135
21362136 bounds = None
21372137 if self .has_bounds ():
2138- bounds = []
2139- for index in range (self .nbounds ):
2140- bounds_slice = np .take (self .bounds , index , axis = - 1 )
2141- serialized = serialize (bounds_slice , dims_to_collapse )
2142- bounds .append (serialized )
2143- # Make sure bounds dim comes last.
2144- bounds = np .moveaxis (bounds , 0 , - 1 )
2138+ # Express dims_to_collapse as non-negative integers.
2139+ if dims_to_collapse is None :
2140+ dims_to_collapse = range (self .ndim )
2141+ else :
2142+ dims_to_collapse = tuple (
2143+ dim % self .ndim for dim in dims_to_collapse
2144+ )
2145+ bounds = serialize (self .bounds , dims_to_collapse )
2146+
21452147 points = serialize (self .points , dims_to_collapse )
21462148 # Create the new collapsed coordinate.
21472149 coord = self .copy (points = np .array (points ), bounds = bounds )
You can’t perform that action at this time.
0 commit comments