Code Monkey home page Code Monkey logo

passive-opensky-collection's Introduction

Passive-OpenSky-Collection

Python 3.x repo for passively collecting data from OpenSky using the OpenSky API.

Requirements

OpenSky Account

You will need to obtain an OpenSky account for accessing their data to full capacity. Account rresgistration can be found here: Register.

OpenSky API

The OpenSky API python package will need to be cloned and installed from the OpenSky Github. Follow the recommended pip installation.

Usage

collectData.py is simple script for passively collecting real-time data from OpenSky in a compatible format with the Python Traffic module. The data is then saved as compressed numpy arrays.

The run script is as follows:

python collectData.py --username your_username --password your_password
                      --bbox min_latitude max_latitude min_longitude max_longitude

This script will begin collecting data approximately every 5 seconds from OpenSky for the specified bounding box. Data will be collected for approximately 1 hour and then saved to a created data directory with the following format: data/<year>/<month>/<day>/<hour>.npz. .npz files are compressed numpy arrays which are much more memory efficient as compared to .csv and even .npy files. In addition, collecting data in 1 hour increments ensures that the python script does not consume too much memory. In the event that a file aleady exists for that hour, then the minute will also be added to the file name: /<hour>_<min>.npy.

Please note that the data corresponding to <hour> will be all of the data collected from the point of save to 1 hour in the past. Depending on when the script is started, this time may be over two hours. For example, if the script is started at 1430, the first data will be saved as /13.npy and incorporate the data from 1430 to 1330.

To access the .npz data, you can use the following command,

import numpy as np

data = np.load("path/to/file.npz",allow_pickle=True)['data']

Example

Below are two example outputs from collecting 2 and 20 hours worth of data! Scripts to generate this plot are coming soon...

2 hours

2 Hours

20 hours

20 Hours

Acknowledging

If you found this repository useful or interesting, please help by adding a star to help the visibility :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.