def processVariable( self, request: TaskRequest, node: OpNode, variable: EDASArray ) -> EDASArray: variable.persist() axisIndex = variable.getAxisIndex( node.axes, 0, 0 ) dim = variable.xr.dims[axisIndex] window_size = node.getParm("wsize", variable.xr.shape[axisIndex]//8 ) lowpass_args = { dim:int(window_size), "center":True, "min_periods": 1 } lowpass = variable.xr.rolling(**lowpass_args).mean() return EDASArray( variable.name, variable.domId, lowpass )
def processVariable( self, request: TaskRequest, node: OpNode, variable: EDASArray ) -> EDASArray: data = variable.persist() axisIndex = variable.getAxisIndex( node.axes, 0, 0 ) dim = data.dims[axisIndex] window_size = node.getParm("wsize", data.shape[axisIndex] // 8) detrend_args = {dim: int(window_size), "center": True, "min_periods": 1} trend = data.rolling(**detrend_args).mean() detrend: EDASArray = variable - variable.updateXa(trend, "trend") return detrend