From 4b0ee7bfbcf25fb3c546cd9b251a89e8fde2f147 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Fri, 4 Oct 2024 17:23:50 -0400 Subject: [PATCH] WIP: air traffic control example --- examples/air-traffic-control.ipynb | 306 +++++++++++++++++++++++++++++ 1 file changed, 306 insertions(+) create mode 100644 examples/air-traffic-control.ipynb diff --git a/examples/air-traffic-control.ipynb b/examples/air-traffic-control.ipynb new file mode 100644 index 00000000..11a7f37e --- /dev/null +++ b/examples/air-traffic-control.ipynb @@ -0,0 +1,306 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "from io import BytesIO\n", + "\n", + "import pyarrow as pa\n", + "import pyarrow.parquet as pq\n", + "import requests\n", + "\n", + "import lonboard\n", + "from lonboard.experimental import TripsLayer\n", + "from lonboard import Map\n", + "import arro3.core" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "'0.5.0-beta.2'" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "arro3.core.__version__" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "url = \"https://github.com/kylebarron/adsb-extract/releases/download/v0.1/2024-10-03_traces.parquet\"" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [], + "source": [ + "r = requests.get(url)" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": {}, + "outputs": [], + "source": [ + "table = pq.read_table(BytesIO(r.content))" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [], + "source": [ + "timestamps = table[\"timestamp\"]" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/Users/kyle/github/developmentseed/lonboard/lonboard/_geoarrow/ops/reproject.py:33: UserWarning: No CRS exists on data. If no data is shown on the map, double check that your CRS is WGS84.\n", + " warn(\n", + "/Users/kyle/github/developmentseed/lonboard/lonboard/experimental/traits.py:146: UserWarning: Reducing precision of input timestamp data to 's' to fit into available GPU precision.\n", + " warnings.warn(\n" + ] + } + ], + "source": [ + "layer = TripsLayer(table=table, get_timestamps=table[\"timestamp\"])" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "m = Map(layer)" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "a1794393a04d49ec84606b857dc3e6da", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "Map(custom_attribution='', layers=(TripsLayer(get_timestamps=arro3.core.ChunkedArray" + ] + }, + "execution_count": 21, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "layer.get_timestamps" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "lonboard", + "language": "python", + "name": "lonboard" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.8" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}