Beispiel #1
0
 def processVariable( self, request: TaskRequest, node: OpNode, variable: EDASArray ) -> EDASArray:
     data = variable.persist()
     norm = bool(node.getParm("norm", False))
     grouping = node.getParm("groupby", 't.month')
     climatology = data.groupby(grouping).mean('t')
     anomalies = data.groupby(grouping) - climatology
     if norm:
         anomalies = anomalies.groupby(grouping) / data.groupby(grouping).std('t')
     return variable.updateXa( anomalies, "decycle" )
Beispiel #2
0
 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