Beispiel #1
0
def create_country(start, end):
    """Create CountryStats."""

    days = get_database_days(start, end)

    pbar = tqdm(days)
    for single_date in pbar:
        pbar.set_description(datetime.strftime(single_date, "%Y-%m-%d"))
        result = create_country_stats(session=db.session, date=single_date)
Beispiel #2
0
def compute_logbook(start, end):
    """Compute logbook."""

    days = get_database_days(start, end)

    pbar = tqdm(days)
    for single_date in pbar:
        pbar.set_description(single_date.strftime("%Y-%m-%d"))
        result = logbook_update_entries(session=db.session, date=single_date)
Beispiel #3
0
def create_ognrange(start=None, end=None):
    """Create receiver coverage stats for Melissas ognrange."""

    days = get_database_days(start, end)

    pbar = tqdm(days)
    for single_date in pbar:
        pbar.set_description(datetime.strftime(single_date, "%Y-%m-%d"))
        result = update_receiver_coverages(session=db.session,
                                           date=single_date)
Beispiel #4
0
def compute_takeoff_landing(start, end):
    """Compute takeoffs and landings."""

    days = get_database_days(start, end)

    pbar = tqdm(days)
    for single_date in pbar:
        pbar.set_description(datetime.strftime(single_date, "%Y-%m-%d"))
        (start, end) = date_to_timestamps(single_date)
        result = update_takeoff_landings(start=start, end=end)
Beispiel #5
0
def create(start, end, flight_type):
    """Compute flights. Flight type: 0: all flights, 1: below 1000m AGL, 2: below 50m AGL + faster than 250 km/h, 3: inverse coverage'"""

    days = get_database_days(start, end)

    pbar = tqdm(days)
    for single_date in pbar:
        pbar.set_description(datetime.strftime(single_date, "%Y-%m-%d"))
        if flight_type <= 2:
            result = compute_flights(date=single_date, flight_type=flight_type)
        else:
            result = compute_gaps(date=single_date)
Beispiel #6
0
def create(start, end):
    """Create DeviceStats, ReceiverStats and RelationStats."""

    days = get_database_days(start, end)

    pbar = tqdm(days)
    for single_date in pbar:
        pbar.set_description(datetime.strftime(single_date, "%Y-%m-%d"))
        result = create_device_stats(session=db.session, date=single_date)
        result = update_device_stats_jumps(session=db.session,
                                           date=single_date)
        result = create_receiver_stats(session=db.session, date=single_date)
        result = create_relation_stats(session=db.session, date=single_date)
        result = update_qualities(session=db.session, date=single_date)
Beispiel #7
0
def update_mgrs(start, end):
    """Create location_mgrs_short."""

    days = get_database_days(start, end)

    pbar = tqdm(days)
    for single_date in pbar:
        datestr = datetime.strftime(single_date, "%Y-%m-%d")
        pbar.set_description(datestr)
        for pbar2 in tqdm([
                "{:02d}:{:02d}".format(hh, mm) for hh in range(0, 24)
                for mm in range(0, 60)
        ]):
            sql = """
                UPDATE aircraft_beacons
                SET location_mgrs_short = left(location_mgrs, 5) || substring(location_mgrs, 6, 2) || substring(location_mgrs, 11, 2)
                WHERE timestamp BETWEEN '{0} {1}:00' and '{0} {1}:59' AND location_mgrs_short IS NULL;
            """.format(datestr, pbar2)

            # print(sql)
            db.session.execute(sql)
            db.session.commit()