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 @@ -2252,13 +2252,15 @@ def serialize(x, axis):
22522252
22532253 bounds = None
22542254 if self .has_bounds ():
2255- bounds = []
2256- for index in range (self .nbounds ):
2257- bounds_slice = np .take (self .bounds , index , axis = - 1 )
2258- serialized = serialize (bounds_slice , dims_to_collapse )
2259- bounds .append (serialized )
2260- # Make sure bounds dim comes last.
2261- bounds = np .moveaxis (bounds , 0 , - 1 )
2255+ # Express dims_to_collapse as non-negative integers.
2256+ if dims_to_collapse is None :
2257+ dims_to_collapse = range (self .ndim )
2258+ else :
2259+ dims_to_collapse = tuple (
2260+ dim % self .ndim for dim in dims_to_collapse
2261+ )
2262+ bounds = serialize (self .bounds , dims_to_collapse )
2263+
22622264 points = serialize (self .points , dims_to_collapse )
22632265 # Create the new collapsed coordinate.
22642266 coord = self .copy (points = np .array (points ), bounds = bounds )
You can’t perform that action at this time.
0 commit comments