Beispiel #1
0
    def getDataFrom(station):
        stuff = []

        station = station  #+ ':0'
        station_id = Station.findById('Station', station).id
        prepare = Measurement.query.filter_by(station_id=station_id).order_by(
            Measurement.mtime.asc())
        for item in prepare:
            stuff.append({
                'station':
                Station.findById('Station', station).code,
                'value':
                item.value,
                'time':
                datetime.strftime(item.mtime, '%Y-%m-%d %H:%M')
            })
        return stuff
Beispiel #2
0
    def getAllDataFromWhere(fromTime, toTime, defType='air_temperature'):
        fixThis = []
        returnThis = Measurement.query.filter(
            Measurement.mtime >= fromTime).filter(
                Measurement.mtime <= toTime).filter(
                    Measurement.mType == defType).all()
        for mes in returnThis:
            #fixThis.append({'station': mes.station , 'value' : mes.value, 'time': datetime.strftime(mes.mtime, '%Y-%m-%dT%H:%M:%S.000Z')})
            fixThis.append({
                'station':
                Station.findById('Station', mes.station_id).code,
                'value':
                mes.value,
                'time':
                datetime.strftime(mes.mtime, '%Y-%m-%d %H:%M:%S.000Z')
            })

        return fixThis