示例#1
0
parser.add_argument('--date_from', help='Date from (YYYY-MM-DD)')
parser.add_argument('--date_to', help='Date to (YYYY-MM-DD)')

args = parser.parse_args()

if not to_envvar(args.config):
    parser.error('Config file "{}" not found.'.format(args.config))

from skylines import app, db
from skylines.model import Airport, Flight, IGCFile
from skylines.lib import files
from sqlalchemy import func
from time import mktime, strptime
from datetime import datetime

app.test_request_context().push()

query = db.session.query(Flight).outerjoin(Flight.takeoff_airport).join(IGCFile)

if args.flight_id is not None:
    print "Filter by flight id: " + str(args.flight_id)
    query = query.filter(Flight.id == args.flight_id)

if args.country_code is not None:
    print "Filter by takeoff airport country code: " + str(args.country_code)
    query = query.filter(func.lower(Airport.country_code) == func.lower(str(args.country_code)))

if args.airport_name is not None:
    print "Filter by takeoff airport name: " + str(args.airport_name)
    query = query.filter(func.lower(Airport.name) == func.lower(str(args.airport_name)))
示例#2
0
    changed = diff.changed()
    distance = airport.distance(airport_w2k)

    if changed or distance > 0.1:
        print "{}  {}  {}" \
            .format(airport.country_code, airport.name, airport.icao)

        if distance > 0.1:
            print "  moved by {}m".format(distance)

        for item in changed:
            print "  {} from {} to {}" \
                .format(item, row2dict(airport)[item], airport_w2k.__dict__[item])


app.test_request_context().push()

welt2000 = get_database(path=args.welt2000_path)

current_date = datetime.utcnow()
i = 0

for airport_w2k in welt2000:
    if (airport_w2k.type != 'airport' and
            airport_w2k.type != 'glider_site' and
            airport_w2k.type != 'ulm'):
        continue

    i += 1
    if i % 100 == 0:
        db.session.flush()
示例#3
0
def setup():
    app.add_babel()
    app.test_request_context().push()
    g.current_user = None
def setup():
    app.add_babel()
    app.test_request_context().push()
    g.current_user = None