MCPcopy
hub / github.com/pydata/xarray / _replace

Method _replace

xarray/namedarray/core.py:318–344  ·  view source on GitHub ↗

Create a new array with the same typing information. The types for each argument cannot change, use self._new if that is a risk. Parameters ---------- dims : Iterable of Hashable, optional Name(s) of the dimension(s). Will co

(
        self,
        dims: _DimsLike | Default = _default,
        data: duckarray[_ShapeType_co, _DType_co] | Default = _default,
        attrs: _AttrsLike | Default = _default,
    )

Source from the content-addressed store, hash-verified

316 return _new(self, dims, data, attrs)
317
318 def _replace(
319 self,
320 dims: _DimsLike | Default = _default,
321 data: duckarray[_ShapeType_co, _DType_co] | Default = _default,
322 attrs: _AttrsLike | Default = _default,
323 ) -> Self:
324 """
325 Create a new array with the same typing information.
326
327 The types for each argument cannot change,
328 use self._new if that is a risk.
329
330 Parameters
331 ----------
332 dims : Iterable of Hashable, optional
333 Name(s) of the dimension(s).
334 Will copy the dims from x by default.
335 data : duckarray, optional
336 The actual data that populates the array. Should match the
337 shape specified by `dims`.
338 Will copy the data from x by default.
339 attrs : dict, optional
340 A dictionary containing any additional information or
341 attributes you want to store with the array.
342 Will copy the attrs from x by default.
343 """
344 return cast("Self", self._new(dims, data, attrs))
345
346 def _copy(
347 self,

Callers 3

_copyMethod · 0.95
chunkMethod · 0.95
as_numpyMethod · 0.95

Calls 1

_newMethod · 0.95

Tested by

no test coverage detected