def oldaverageOverTime(field, makeTimes=0): """@deprecated Average the values in each time step If makeTimes is true (1) then we return a field mapping all of the times to the average. Else we just return the average """ if (GridUtil.isTimeSequence(field) == 0): return field cnt = 0 domainSet = field.getDomainSet() current = None for t in range(domainSet.getLength()): cnt = cnt + 1 rangeValue = field.getSample(t) if (current is None): current = rangeValue.clone() else: current = current + rangeValue if (cnt == 0): return None current = current / cnt if (makeTimes): return Util.makeTimeField(current, GridUtil.getDateTimeList(field)) return current
def oldaverageOverTime(field,makeTimes = 0): """@deprecated Average the values in each time step If makeTimes is true (1) then we return a field mapping all of the times to the average. Else we just return the average """ if (GridUtil.isTimeSequence(field)==0): return field; cnt = 0; domainSet = field.getDomainSet() current = None; for t in range(domainSet.getLength()): cnt=cnt+1 rangeValue = field.getSample(t) if(current is None): current = rangeValue.clone(); else: current = current+rangeValue; if(cnt == 0): return None; current = current/cnt; if(makeTimes): return Util.makeTimeField(current, GridUtil.getDateTimeList(field)) return current