def sort(ref):
    from vista.set import Constants
    from vista.set import ElementFilterIterator
    dx=[]
    iter=ElementFilterIterator(ref.data.iterator, Constants.DEFAULT_FLAG_FILTER)
    while not iter.atEnd():
        dx.append(iter.element.y)
        iter.advance()
    dx.sort()
    return dx
Example #2
0
def sort(ref):
    from vista.set import Constants
    from vista.set import ElementFilterIterator
    dx=[]
    iter=ElementFilterIterator(ref.data.iterator, Constants.DEFAULT_FLAG_FILTER)
    while not iter.atEnd():
        dx.append(iter.element.y)
        iter.advance()
    dx.sort()
    return dx
Example #3
0
def sort(ref, end_of_sept=True, tw=None):
    from vista.set import Constants
    from vista.set import ElementFilterIterator
    if tw != None:
        data=ref.data.createSlice(tw)
    dx=[]
    iter=ElementFilterIterator(data.iterator, Constants.DEFAULT_FLAG_FILTER)
    while not iter.atEnd():
        if (end_of_sept) :
            if (iter.element.XString.find('30SEP')>=0):
                dx.append(iter.element.y)
        else:
            dx.append(iter.element.y)
        iter.advance()
    dx.sort()
    return dx
Example #4
0
def sort(ref, end_of_sept=True, tw=None):
    from vista.set import Constants
    from vista.set import ElementFilterIterator
    if tw != None:
        data=ref.data.createSlice(tw)
    dx=[]
    iter=ElementFilterIterator(data.iterator, Constants.DEFAULT_FLAG_FILTER)
    while not iter.atEnd():
        if (end_of_sept) :
            if (iter.element.XString.find('30SEP')>=0):
                dx.append(iter.element.y)
        else:
            dx.append(iter.element.y)
        iter.advance()
    dx.sort()
    return dx
Example #5
0
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)
Example #6
0
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)
Example #7
0
# get the data set contained in the data reference
ds = ref.getData()
# create a 1 year slice
st = ds.getTimeWindow().getStartTime()
#FIXME: ds = ds[str(st):str(st+'1year')]
# get the iterator on that data set, these iterates 
# through all the values in the data set. Till now there is no 
# difference between stepping thro the data set or the
# iterator
dsi = ds.getIterator()
# lets filter out the missing values...
missing_filter = Constants.DEFAULT_FILTER
# lets create an iterator that skips over values for which
# missing_filter.isAcceptable returns false
# this iterator takes another iterator and the filter
missing_iterator = ElementFilterIterator(dsi,missing_filter)

# the x value: element.getX()
# the y value: element.getY()
# the flag (if available else = 0): element.getFlag()
element = missing_iterator.getElement()
print element.getX(), element.getY(), element.getFlag()
# 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():
Example #8
0
# get the data set contained in the data reference
ds = ref.getData()
# create a 1 year slice
st = ds.getTimeWindow().getStartTime()
#FIXME: ds = ds[str(st):str(st+'1year')]
# get the iterator on that data set, these iterates
# through all the values in the data set. Till now there is no
# difference between stepping thro the data set or the
# iterator
dsi = ds.getIterator()
# lets filter out the missing values...
missing_filter = Constants.DEFAULT_FILTER
# lets create an iterator that skips over values for which
# missing_filter.isAcceptable returns false
# this iterator takes another iterator and the filter
missing_iterator = ElementFilterIterator(dsi, missing_filter)

# the x value: element.getX()
# the y value: element.getY()
# the flag (if available else = 0): element.getFlag()
element = missing_iterator.getElement()
print element.getX(), element.getY(), element.getFlag()
# 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():