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

Method __init__

xarray/computation/rolling_exp.py:71–92  ·  view source on GitHub ↗
(
        self,
        obj: T_DataWithCoords,
        windows: Mapping[Any, int | float],
        window_type: str = "span",
        min_weight: float = 0.0,
    )

Source from the content-addressed store, hash-verified

69 """
70
71 def __init__(
72 self,
73 obj: T_DataWithCoords,
74 windows: Mapping[Any, int | float],
75 window_type: str = "span",
76 min_weight: float = 0.0,
77 ):
78 if not module_available("numbagg"):
79 raise ImportError(
80 "numbagg >= 0.2.1 is required for rolling_exp but currently numbagg is not installed"
81 )
82
83 self.obj: T_DataWithCoords = obj
84 dim, window = next(iter(windows.items()))
85 self.dim = dim
86 self.alpha = _get_alpha(**{window_type: window})
87 self.min_weight = min_weight
88 # Don't pass min_weight=0 so we can support older versions of numbagg
89 kwargs = dict(alpha=self.alpha, axis=-1)
90 if min_weight > 0:
91 kwargs["min_weight"] = min_weight
92 self.kwargs = kwargs
93
94 def mean(self, keep_attrs: bool | None = None) -> T_DataWithCoords:
95 """

Callers

nothing calls this directly

Calls 3

module_availableFunction · 0.90
_get_alphaFunction · 0.85
itemsMethod · 0.80

Tested by

no test coverage detected