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 @@ -1968,13 +1968,15 @@ def serialize(x, axis):
19681968
19691969 bounds = None
19701970 if self .has_bounds ():
1971- bounds = []
1972- for index in range (self .nbounds ):
1973- bounds_slice = np .take (self .bounds , index , axis = - 1 )
1974- serialized = serialize (bounds_slice , dims_to_collapse )
1975- bounds .append (serialized )
1976- # Make sure bounds dim comes last.
1977- bounds = np .moveaxis (bounds , 0 , - 1 )
1971+ # Express dims_to_collapse as non-negative integers.
1972+ if dims_to_collapse is None :
1973+ dims_to_collapse = range (self .ndim )
1974+ else :
1975+ dims_to_collapse = tuple (
1976+ dim % self .ndim for dim in dims_to_collapse
1977+ )
1978+ bounds = serialize (self .bounds , dims_to_collapse )
1979+
19781980 points = serialize (self .points , dims_to_collapse )
19791981 # Create the new collapsed coordinate.
19801982 coord = self .copy (points = np .array (points ), bounds = bounds )
You can’t perform that action at this time.
0 commit comments