File tree 1 file changed +9
-7
lines changed
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):
1971
1971
1972
1972
bounds = None
1973
1973
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
+
1981
1983
points = serialize (self .points , dims_to_collapse )
1982
1984
# Create the new collapsed coordinate.
1983
1985
coord = self .copy (points = np .array (points ), bounds = bounds )
You can’t perform that action at this time.
0 commit comments