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 @@ -2224,13 +2224,15 @@ def serialize(x, axis):
22242224
22252225 bounds = None
22262226 if self .has_bounds ():
2227- bounds = []
2228- for index in range (self .nbounds ):
2229- bounds_slice = np .take (self .bounds , index , axis = - 1 )
2230- serialized = serialize (bounds_slice , dims_to_collapse )
2231- bounds .append (serialized )
2232- # Make sure bounds dim comes last.
2233- bounds = np .moveaxis (bounds , 0 , - 1 )
2227+ # Express dims_to_collapse as non-negative integers.
2228+ if dims_to_collapse is None :
2229+ dims_to_collapse = range (self .ndim )
2230+ else :
2231+ dims_to_collapse = tuple (
2232+ dim % self .ndim for dim in dims_to_collapse
2233+ )
2234+ bounds = serialize (self .bounds , dims_to_collapse )
2235+
22342236 points = serialize (self .points , dims_to_collapse )
22352237 # Create the new collapsed coordinate.
22362238 coord = self .copy (points = np .array (points ), bounds = bounds )
You can’t perform that action at this time.
0 commit comments