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

Class Variable

xarray/tests/test_namedarray.py:406–442  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

404 assert narr_int.dtype == dtype_int
405
406 class Variable(
407 NamedArray[_ShapeType_co, _DType_co], Generic[_ShapeType_co, _DType_co]
408 ):
409 @overload
410 def _new(
411 self,
412 dims: _DimsLike | Default = ...,
413 data: duckarray[Any, _DType] = ...,
414 attrs: _AttrsLike | Default = ...,
415 ) -> Variable[Any, _DType]: ...
416
417 @overload
418 def _new(
419 self,
420 dims: _DimsLike | Default = ...,
421 data: Default = ...,
422 attrs: _AttrsLike | Default = ...,
423 ) -> Variable[_ShapeType_co, _DType_co]: ...
424
425 def _new(
426 self,
427 dims: _DimsLike | Default = _default,
428 data: duckarray[Any, _DType] | Default = _default,
429 attrs: _AttrsLike | Default = _default,
430 ) -> Variable[Any, _DType] | Variable[_ShapeType_co, _DType_co]:
431 dims_ = copy.copy(self._dims) if dims is _default else dims
432
433 attrs_: Mapping[Any, Any] | None
434 if attrs is _default:
435 attrs_ = None if self._attrs is None else self._attrs.copy()
436 else:
437 attrs_ = attrs
438
439 if data is _default:
440 return type(self)(dims_, copy.copy(self._data), attrs_)
441 cls_ = cast("type[Variable[Any, _DType]]", type(self))
442 return cls_(dims_, data, attrs_)
443
444 var_float: Variable[Any, np.dtype[np.float32]]
445 var_float = Variable(("x",), np.array([1.5, 3.2], dtype=dtype_float))

Callers 15

setUpMethod · 0.90
test_pickleMethod · 0.90
test_missing_valuesMethod · 0.90
test_graph_manipulationFunction · 0.90
test_groupby_math_moreFunction · 0.90
setupMethod · 0.90
test_groupby_sumMethod · 0.90
lazy_inaccessibleMethod · 0.90

Calls

no outgoing calls

Tested by 15

setUpMethod · 0.72
test_pickleMethod · 0.72
test_missing_valuesMethod · 0.72
test_graph_manipulationFunction · 0.72
test_groupby_math_moreFunction · 0.72
setupMethod · 0.72
test_groupby_sumMethod · 0.72
lazy_inaccessibleMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…