MCPcopy Index your code
hub / github.com/pydata/xarray / DataArray

Class DataArray

xarray/core/dataarray.py:258–7744  ·  view source on GitHub ↗

N-dimensional array with labeled coordinates and dimensions. DataArray provides a wrapper around numpy ndarrays that uses labeled dimensions and coordinates to support metadata aware operations. The API is similar to that for the pandas Series or DataFrame, but DataArray objects can

Source from the content-addressed store, hash-verified

256
257
258class DataArray(
259 AbstractArray,
260 DataWithCoords,
261 DataArrayArithmetic,
262 DataArrayAggregations,
263):
264 """N-dimensional array with labeled coordinates and dimensions.
265
266 DataArray provides a wrapper around numpy ndarrays that uses
267 labeled dimensions and coordinates to support metadata aware
268 operations. The API is similar to that for the pandas Series or
269 DataFrame, but DataArray objects can have any number of dimensions,
270 and their contents have fixed data types.
271
272 Additional features over raw numpy arrays:
273
274 - Apply operations over dimensions by name: ``x.sum('time')``.
275 - Select or assign values by integer location (like numpy):
276 ``x[:10]`` or by label (like pandas): ``x.loc['2014-01-01']`` or
277 ``x.sel(time='2014-01-01')``.
278 - Mathematical operations (e.g., ``x - y``) vectorize across
279 multiple dimensions (known in numpy as "broadcasting") based on
280 dimension names, regardless of their original order.
281 - Keep track of arbitrary metadata in the form of a Python
282 dictionary: ``x.attrs``
283 - Convert to a pandas Series: ``x.to_series()``.
284
285 Getting items from or doing mathematical operations with a
286 DataArray always returns another DataArray.
287
288 Parameters
289 ----------
290 data : array_like
291 Values for this array. Must be an ``numpy.ndarray``, ndarray
292 like, or castable to an ``ndarray``. If a self-described xarray
293 or pandas object, attempts are made to use this array's
294 metadata to fill in other unspecified arguments. A view of the
295 array's data is used instead of a copy if possible.
296 coords : sequence or dict of array_like or :py:class:`~xarray.Coordinates`, optional
297 Coordinates (tick labels) to use for indexing along each
298 dimension. The following notations are accepted:
299
300 - mapping {dimension name: array-like}
301 - sequence of tuples that are valid arguments for
302 ``xarray.Variable()``
303 - (dims, data)
304 - (dims, data, attrs)
305 - (dims, data, attrs, encoding)
306
307 Additionally, it is possible to define a coord whose name
308 does not match the dimension name, or a coord based on multiple
309 dimensions, with one of the following notations:
310
311 - mapping {coord name: DataArray}
312 - mapping {coord name: Variable}
313 - mapping {coord name: (dimension name, array-like)}
314 - mapping {coord name: (tuple of dimension names, array-like)}
315

Callers 15

scatter_example_datasetFunction · 0.90
from_irisFunction · 0.90
factorizeMethod · 0.90
compute_chunksMethod · 0.90
factorizeMethod · 0.90
compute_chunksMethod · 0.90
convert_calendarFunction · 0.90
interp_calendarFunction · 0.90
_normalize_argsFunction · 0.90
_temp_dataarrayFunction · 0.90
_construct_dataarrayMethod · 0.90
mapMethod · 0.90

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…