def getLast25hours(ref): dsi = ref.getData().getIterator() esi = ElementFilterIterator(dsi, Constants.DEFAULT_FLAG_FILTER) while not esi.atEnd(): esi.advance() esi.retreat() el = esi.getElement() endTime = TimeFactory.getInstance().createTime(el.getXString()) tidalDay = TimeFactory.getInstance().createTimeInterval('25hours') startTime = endTime.create(endTime) startTime.incrementBy(tidalDay,-1) tw = TimeFactory.getInstance().createTimeWindow(startTime,endTime) return DataReference.create(ref,tw)
def getLast25hours(ref): dsi = ref.getData().getIterator() esi = ElementFilterIterator(dsi, Constants.DEFAULT_FLAG_FILTER) while not esi.atEnd(): esi.advance() esi.retreat() el = esi.getElement() endTime = TimeFactory.getInstance().createTime(el.getXString()) tidalDay = TimeFactory.getInstance().createTimeInterval('25hours') startTime = endTime.create(endTime) startTime.incrementBy(tidalDay, -1) tw = TimeFactory.getInstance().createTimeWindow(startTime, endTime) return DataReference.create(ref, tw)
# get the 30th good value missing_iterator.positionAtIndex(29) element = missing_iterator.getElement() print element.getX(), element.getY(), element.getFlag() # a loop to loop over all the values till it # reaches the end # we get the element and advance, then check if are at end # if not we continue doing so till we hit the end while not missing_iterator.atEnd(): element = missing_iterator.getElement(); missing_iterator.advance() # # lets step through back, always retreat then get element then check # while not missing_iterator.atStart(): missing_iterator.retreat() element = missing_iterator.getElement() # # to rewind quickly missing_iterator.resetIterator(); # # Lets now do the flags # # each flag filter is predefined in FlagUtils class questionable_filter = FlagUtils.QUESTIONABLE_FILTER reject_filter = FlagUtils.REJECT_FILTER # to make our job easier there is a composite filter called # CompositeFilter. It accepts an array of ElementFilter's # and its isAcceptable method returns true only when all the # contained element filters consider the element acceptable
# get the 30th good value missing_iterator.positionAtIndex(29) element = missing_iterator.getElement() print element.getX(), element.getY(), element.getFlag() # a loop to loop over all the values till it # reaches the end # we get the element and advance, then check if are at end # if not we continue doing so till we hit the end while not missing_iterator.atEnd(): element = missing_iterator.getElement() missing_iterator.advance() # # lets step through back, always retreat then get element then check # while not missing_iterator.atStart(): missing_iterator.retreat() element = missing_iterator.getElement() # # to rewind quickly missing_iterator.resetIterator() # # Lets now do the flags # # each flag filter is predefined in FlagUtils class questionable_filter = FlagUtils.QUESTIONABLE_FILTER reject_filter = FlagUtils.REJECT_FILTER # to make our job easier there is a composite filter called # CompositeFilter. It accepts an array of ElementFilter's # and its isAcceptable method returns true only when all the # contained element filters consider the element acceptable