@@ -405,10 +405,12 @@ def __getitem__(self, indices):
405405 f"{self.constructs.domain_axis_identity(_)!r} axis"
406406 )
407407
408- new = new.roll(shift=shift, axis=iaxis )
408+ new = new.roll(axis=iaxis, shift=shift )
409409 else:
410410 new = self.copy()
411411
412+ data = new.data
413+
412414 # ------------------------------------------------------------
413415 # Subspace the field construct's data
414416 # ------------------------------------------------------------
@@ -8685,7 +8687,9 @@ def _update_cell_methods(
86858687 ) # pragma: no cover
86868688
86878689 @_inplace_enabled(default=False)
8688- def insert_dimension(self, axis, position=0, inplace=False):
8690+ def insert_dimension(
8691+ self, axis, position=0, constructs=False, inplace=False
8692+ ):
86898693 """Insert a size 1 axis into the data array.
86908694
86918695 .. versionadded:: 3.0.0
@@ -8710,6 +8714,13 @@ def insert_dimension(self, axis, position=0, inplace=False):
87108714 data array. By default the new axis has position 0, the
87118715 slowest varying position.
87128716
8717+ constructs: `bool`, optional
8718+ If True then also insert the new axis into all
8719+ metadata constructs that don't already include it. By
8720+ default, metadata constructs are not changed.
8721+
8722+ .. versionadded:: 3.17.0
8723+
87138724 {{inplace: `bool`, optional}}
87148725
87158726 :Returns:
@@ -8753,24 +8764,13 @@ def insert_dimension(self, axis, position=0, inplace=False):
87538764 : time(1) = [2019-01-01 00:00:00]
87548765
87558766 """
8756- f = _inplace_enabled_define_and_cleanup(self)
8757-
8758- if axis is None:
8759- axis = f.set_construct(self._DomainAxis(1))
8760- else:
8761- axis = f.domain_axis(
8762- axis,
8763- key=True,
8764- default=ValueError("Can't identify a unique axis to insert"),
8765- )
8766-
8767- # Expand the dims in the field construct's data array
8768- super(Field, f).insert_dimension(
8769- axis=axis, position=position, inplace=True
8767+ return super().insert_dimension(
8768+ axis=axis,
8769+ position=position,
8770+ constructs=constructs,
8771+ inplace=inplace,
87708772 )
87718773
8772- return f
8773-
87748774 def indices(self, *mode, **kwargs):
87758775 """Create indices that define a subspace of the field construct.
87768776
0 commit comments