A general purpose AIS I/O library using the GPSd AIVDM schema.
Figure out which files to touch when working with spatiotemporal data.
We have a lot of data that needs to be chunked by primary key, datetime, and space but we don’t want to sort through all of it whenever we just want to look at a small piece. The solution is a sidecar metadata file and a file structure organized as a spatial quadtree that is interacted with via a simple and lightweight NoSQL engine that is aware of these components.
Data is grouped in directories matching quadtree nodes in files that are grouped time and primary key. Managing the actual files is up to the user. This library only knows how to interact with the sidecar files.
We want to have both an API:
import melvil import datetime # The base directory, match expression, etc. are all defined in a configfile # Only process data from the past 30 days that appears in the lower left # quadrant of the world, as specified by WGS84 max_ts = datetime.datetime.now()q min_ts = max_ts - datetime.timedelta(days=30) bbox = (-180, -90 0, 0) for fp in melvil.search(min_ts=min_ts, max_ts=max_ts, bbox=bbox): with open(fp) as f: # Do something
And a CLI:
$ melvil search --min-ts 2014-01-01 --max-ts 2015-01-01 --bbox -180 -90 0 0 /path/to/output/file/1 /path/to/output/file/2 /path/to/output/file/3 ...
Under the hood melvil is looking for
$ git clone https://github.com/SkyTruth/Dewey $ cd Dewey $ virtualenv venv $ pip install -e .[test] $ py.test tests --cov melvil --term-missing melvil