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