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

Method as_numpy

xarray/core/dataarray.py:822–834  ·  view source on GitHub ↗

Coerces wrapped data and coordinates into numpy arrays, returning a DataArray. See Also -------- DataArray.to_numpy : Same but returns only the data as a numpy.ndarray object. Dataset.as_numpy : Converts all variables in a Dataset. DataArray.values

(self)

Source from the content-addressed store, hash-verified

820 return self.variable.to_numpy()
821
822 def as_numpy(self) -> Self:
823 """
824 Coerces wrapped data and coordinates into numpy arrays, returning a DataArray.
825
826 See Also
827 --------
828 DataArray.to_numpy : Same but returns only the data as a numpy.ndarray object.
829 Dataset.as_numpy : Converts all variables in a Dataset.
830 DataArray.values
831 DataArray.data
832 """
833 coords = {k: v.as_numpy() for k, v in self._coords.items()}
834 return self._replace(self.variable.as_numpy(), coords, indexes=self._indexes)
835
836 @property
837 def _in_memory(self) -> bool:

Callers 5

test_from_numpyMethod · 0.95
test_from_pintMethod · 0.95
test_from_sparseMethod · 0.95
test_from_cupyMethod · 0.95

Calls 2

_replaceMethod · 0.95
itemsMethod · 0.80

Tested by 5

test_from_numpyMethod · 0.76
test_from_pintMethod · 0.76
test_from_sparseMethod · 0.76
test_from_cupyMethod · 0.76