From cce71ca78781f6ef6bf224b450693adea43a1b94 Mon Sep 17 00:00:00 2001 From: duckravel Date: Wed, 15 Apr 2020 13:20:17 +0800 Subject: [PATCH 1/3] 1. add the spatiotemporal boundary 2. change visulizations 3. add summary statistics --- examples/api_request_duckravel.ipynb | 1002 ++++++++++++++++++++++++++ 1 file changed, 1002 insertions(+) create mode 100644 examples/api_request_duckravel.ipynb diff --git a/examples/api_request_duckravel.ipynb b/examples/api_request_duckravel.ipynb new file mode 100644 index 0000000..d1c25d6 --- /dev/null +++ b/examples/api_request_duckravel.ipynb @@ -0,0 +1,1002 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Package loading and basic configurations" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "%load_ext autoreload\n", + "%autoreload 2\n", + "\n", + "# load dependencies'\n", + "import pandas as pd\n", + "import geopandas as gpd\n", + "\n", + "from envirocar import TrackAPI, DownloadClient, BboxSelector, ECConfig\n", + "\n", + "# create an initial but optional config and an api client\n", + "config = ECConfig()\n", + "track_api = TrackAPI(api_client=DownloadClient(config=config))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Querying enviroCar Tracks" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "The following cell queries tracks from the enviroCar API. It defines a bbox for the area of Münster (Germany) and requests 50 tracks. The result is a GeoDataFrame, which is a geo-extended Pandas dataframe from the GeoPandas library. It contains all information of the track in a flat dataframe format including a specific geometry column. \n", + "## Select data from dataframe\n", + "* https://geopandas.org/indexing.html\n", + "* https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
idtimegeometryGPS Altitude.valueGPS Altitude.unitGPS Bearing.valueGPS Bearing.unitThrottle Position.valueThrottle Position.unitSpeed.value...sensor.constructionYearsensor.manufacturertrack.appVersiontrack.touVersionO2 Lambda Voltage ER.valueO2 Lambda Voltage ER.unitMAF.valueMAF.unitO2 Lambda Voltage.valueO2 Lambda Voltage.unit
05e8baea465b80c5d6b4dbfbf2020-04-06T20:43:35POINT (7.65079 51.95400)100.237808m337.001680deg16.283688%6.000000...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
15e8baea465b80c5d6b4dbfc12020-04-06T20:43:40POINT (7.65079 51.95412)102.772222m11.636667deg17.920277%14.260606...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
25e8baea465b80c5d6b4dbfc22020-04-06T20:43:45POINT (7.65083 51.95435)104.020541m6.089730deg16.000000%23.999999...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
35e8baea465b80c5d6b4dbfc32020-04-06T20:43:50POINT (7.65086 51.95463)103.999999m4.503939deg16.000000%21.000001...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
45e8baea465b80c5d6b4dbfc42020-04-06T20:43:55POINT (7.65090 51.95480)104.000001m7.967200deg16.000000%3.000000...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
..................................................................
1855e10ec089115b85a123197422020-01-04T15:40:26POINT (7.61381 52.00054)96.000000m325.882644deg15.000000%6.000000...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
1865e10ec089115b85a123197432020-01-04T15:40:31POINT (7.61374 52.00060)96.000000m330.004187deg15.000000%5.000000...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
1875e10ec089115b85a123197442020-01-04T15:40:36POINT (7.61366 52.00063)96.000000m0.000000deg15.000000%2.000000...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
1885e10ec089115b85a123197452020-01-04T15:40:40POINT (7.61366 52.00063)95.999998m0.000000deg14.000000%0.000000...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
1895e10ec089115b85a123197462020-01-04T15:40:45POINT (7.61366 52.00063)96.000001m0.000000degNaNNaNNaN...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

6637 rows × 54 columns

\n", + "
" + ], + "text/plain": [ + " id time geometry \\\n", + "0 5e8baea465b80c5d6b4dbfbf 2020-04-06T20:43:35 POINT (7.65079 51.95400) \n", + "1 5e8baea465b80c5d6b4dbfc1 2020-04-06T20:43:40 POINT (7.65079 51.95412) \n", + "2 5e8baea465b80c5d6b4dbfc2 2020-04-06T20:43:45 POINT (7.65083 51.95435) \n", + "3 5e8baea465b80c5d6b4dbfc3 2020-04-06T20:43:50 POINT (7.65086 51.95463) \n", + "4 5e8baea465b80c5d6b4dbfc4 2020-04-06T20:43:55 POINT (7.65090 51.95480) \n", + ".. ... ... ... \n", + "185 5e10ec089115b85a12319742 2020-01-04T15:40:26 POINT (7.61381 52.00054) \n", + "186 5e10ec089115b85a12319743 2020-01-04T15:40:31 POINT (7.61374 52.00060) \n", + "187 5e10ec089115b85a12319744 2020-01-04T15:40:36 POINT (7.61366 52.00063) \n", + "188 5e10ec089115b85a12319745 2020-01-04T15:40:40 POINT (7.61366 52.00063) \n", + "189 5e10ec089115b85a12319746 2020-01-04T15:40:45 POINT (7.61366 52.00063) \n", + "\n", + " GPS Altitude.value GPS Altitude.unit GPS Bearing.value GPS Bearing.unit \\\n", + "0 100.237808 m 337.001680 deg \n", + "1 102.772222 m 11.636667 deg \n", + "2 104.020541 m 6.089730 deg \n", + "3 103.999999 m 4.503939 deg \n", + "4 104.000001 m 7.967200 deg \n", + ".. ... ... ... ... \n", + "185 96.000000 m 325.882644 deg \n", + "186 96.000000 m 330.004187 deg \n", + "187 96.000000 m 0.000000 deg \n", + "188 95.999998 m 0.000000 deg \n", + "189 96.000001 m 0.000000 deg \n", + "\n", + " Throttle Position.value Throttle Position.unit Speed.value ... \\\n", + "0 16.283688 % 6.000000 ... \n", + "1 17.920277 % 14.260606 ... \n", + "2 16.000000 % 23.999999 ... \n", + "3 16.000000 % 21.000001 ... \n", + "4 16.000000 % 3.000000 ... \n", + ".. ... ... ... ... \n", + "185 15.000000 % 6.000000 ... \n", + "186 15.000000 % 5.000000 ... \n", + "187 15.000000 % 2.000000 ... \n", + "188 14.000000 % 0.000000 ... \n", + "189 NaN NaN NaN ... \n", + "\n", + " sensor.constructionYear sensor.manufacturer track.appVersion \\\n", + "0 2007 Dodge NaN \n", + "1 2007 Dodge NaN \n", + "2 2007 Dodge NaN \n", + "3 2007 Dodge NaN \n", + "4 2007 Dodge NaN \n", + ".. ... ... ... \n", + "185 2007 Dodge NaN \n", + "186 2007 Dodge NaN \n", + "187 2007 Dodge NaN \n", + "188 2007 Dodge NaN \n", + "189 2007 Dodge NaN \n", + "\n", + " track.touVersion O2 Lambda Voltage ER.value O2 Lambda Voltage ER.unit \\\n", + "0 NaN NaN NaN \n", + "1 NaN NaN NaN \n", + "2 NaN NaN NaN \n", + "3 NaN NaN NaN \n", + "4 NaN NaN NaN \n", + ".. ... ... ... \n", + "185 NaN NaN NaN \n", + "186 NaN NaN NaN \n", + "187 NaN NaN NaN \n", + "188 NaN NaN NaN \n", + "189 NaN NaN NaN \n", + "\n", + " MAF.value MAF.unit O2 Lambda Voltage.value O2 Lambda Voltage.unit \n", + "0 NaN NaN NaN NaN \n", + "1 NaN NaN NaN NaN \n", + "2 NaN NaN NaN NaN \n", + "3 NaN NaN NaN NaN \n", + "4 NaN NaN NaN NaN \n", + ".. ... ... ... ... \n", + "185 NaN NaN NaN NaN \n", + "186 NaN NaN NaN NaN \n", + "187 NaN NaN NaN NaN \n", + "188 NaN NaN NaN NaN \n", + "189 NaN NaN NaN NaN \n", + "\n", + "[6637 rows x 54 columns]" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# set boundary\n", + "bbox = BboxSelector([ \n", + " 7.5777467, # min_x\n", + " 51.9514909, # min_y\n", + " 7.6544357, # max_x\n", + " 51.9693827 # max_y\n", + "])\n", + "# issue a query\n", + "track_df = track_api.get_tracks(bbox=bbox,num_results=50) # requesting 50 tracks inside the bbox\n", + "# retrieve data in a temporal period\n", + "track_df20 = track_df.loc[lambda track_df:track_df['time']>'2020-01-01-T00:00:00,:']\n", + "track_df20" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAeoAAAHSCAYAAAAjRIj6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO3df5CV133f8c9XuwHsDVSmBlohb5cCseKREKhbsWSnilRlFQSKTKducAyxY3WgmspJsDpTgZeEyhEDHaUYd5zWBiXtZEA2iW22bhcTdiZDPSFAvXgJyBYVIGGsxQFcasOgCgz69o+9a5bV3b3n3vv8us/zfs142Hvvee797mN0P5zzPOccc3cBAIBsuiPtAgAAwNgIagAAMoygBgAgwwhqAAAyjKAGACDDmtMuoJz3v//93tbWlnYZ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8/Grko5KukvSfElfMLMpCZaXCDN7n4Z6zLM09Lu2mNnK0c3KHJq7OYyB52K47SMaCurnkqswOYHnYquk59z9ZtL1JSnwXBTm+zPwfMT+/ZnboNbQNbXvuPv5Mq+9KWmvu1919x9J+pak3N4oUzLe+fikhoay3N1PaeiazD2JVpeMX5H0hrtfdPefSvq6hq7DjvSmpA+MeHy3yg+DNrqQcyEzmyfpJUkfdvf/k3CNSQk5F+2SvmJmZyR9RNJ/MrNlyZaZiND/Rory/RlyPmL//sxzUP+Gyg/zStJ/k/RPzKzZzN4raaGkVxOrLB3jnY+zGrp+LTObIemDkl5PqK4knZXUYWbvLV1PelTv/v/9G5I+Xrr7u0NDQ10/TLrQBFQ8F2bWqqEvpt9099dSqDEpFc+Fu89y9zZ3b5P0VUn/2t17ki81diH/jRTp+zPkfMT+/dkc5ZtlRekvT5ekfzXiuaclyd2/6O6vmtleScckvSPpJXd/JZViE1DpfEj6A0n/1cyOa2jo97nSv5Rzxd0Pm9lXJX1HQzd7DEjaNupc7NHQnd+nJL2loX8t507gufh9SX9XQ71HSbrhOdw5KfBcFELIuSjS92fg343Yvz9ZQhQAgAzL89A3AAANj6AGACDDCGoAADKMoAYAIMMIagAAMoygBgAgwwhqAAAy7P8DiHWI51iYM9oAAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "track_df20.plot(figsize=(8, 10))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Generating single tracks" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
track.idtrack.begintrack.endtrack.lengthsensor.fuelTypesensor.constructionYearsensor.manufacturerpathcolor
05e8baea465b80c5d6b4dbfbd2020-04-06T20:43:35Z2020-04-06T22:31:45Z169.237435gasoline2007Dodge[[7.650794616923975, 51.954004035200796], [7.6...(119, 51, 233)
15e8baea365b80c5d6b4db3952020-04-06T13:22:10Z2020-04-06T14:49:10Z142.209935gasoline2007Dodge[[8.547851458544846, 52.951931982446574], [8.5...(231, 24, 105)
25e6b28e377e02d42aa7d0fdf2020-03-12T17:43:10Z2020-03-12T17:54:29Z4.821775diesel2012BMW[[7.651782336187098, 51.93495048766459], [7.65...(8, 128, 116)
35e6a934f77e02d42aa7972ee2020-03-12T09:04:50Z2020-03-12T09:19:31Z8.872236diesel2012BMW[[7.652008193297737, 51.953823353214716], [7.6...(142, 123, 247)
45e8b930965b80c5d6b4d7ccf2020-03-07T12:33:15Z2020-03-07T12:50:00Z11.969578gasoline2018Volkswagen[[7.64068925342399, 51.95732784163833], [7.641...(178, 138, 52)
55e8b930a65b80c5d6b4d7f2b2020-03-07T08:45:25Z2020-03-07T09:00:33Z10.938464gasoline2018Volkswagen[[7.777017871693869, 51.98788788463152], [7.77...(31, 234, 16)
65e42ccb63965f3689459b8712020-02-03T17:11:48Z2020-02-03T17:29:25Z9.308336gasoline2019Ford[[7.656319815305157, 51.93630087949337], [7.65...(214, 22, 2)
75e24ca2a63c90936dc7b43122020-01-19T18:15:23Z2020-01-19T19:50:01Z161.712887gasoline2007Dodge[[7.652897245590533, 51.95421742650057], [7.65...(9, 166, 73)
85e24ca2463c90936dc7b2d942020-01-17T15:58:38Z2020-01-17T16:06:21Z1.152504gasoline2007Dodge[[7.6463266040035, 51.95539490559379], [7.6463...(38, 31, 164)
95e24ca2563c90936dc7b32bb2020-01-17T15:10:14Z2020-01-17T15:25:12Z6.931139gasoline2007Dodge[[7.674832880184066, 52.00732622926195], [7.67...(12, 5, 226)
105e5e5ecd77e02d42aa94ee1c2020-01-09T12:12:53Z2020-01-09T12:23:16Z2.986634gasoline2000VW[[7.65026072181028, 51.94107696873941], [7.650...(92, 121, 123)
115e4a353b3965f368945da8312020-01-08T09:16:45Z2020-01-08T09:30:37Z9.129420diesel2012BMW[[7.6020395805890315, 51.96762650870718], [7.6...(220, 118, 226)
125e1ecec31126d80318bfac5a2020-01-05T16:07:13Z2020-01-05T18:05:50Z171.928734gasoline2007Dodge[[7.653771777296277, 51.972339185734185], [7.6...(228, 65, 104)
135e1eceab1126d80318bf9f7f2020-01-05T15:52:01Z2020-01-05T16:00:01Z2.341898gasoline2007Dodge[[7.652863232019939, 51.957484114542815], [7.6...(76, 36, 235)
145e10ec059115b85a123190d02020-01-04T19:36:04Z2020-01-04T19:40:06Z1.050231gasoline2007Dodge[[7.645364547902668, 51.955026043641425], [7.6...(252, 48, 167)
155e10ec089115b85a123196862020-01-04T15:24:53Z2020-01-04T15:40:45Z7.494835gasoline2007Dodge[[7.652154746679927, 51.953997225623596], [7.6...(255, 99, 164)
\n", + "
" + ], + "text/plain": [ + " track.id track.begin track.end \\\n", + "0 5e8baea465b80c5d6b4dbfbd 2020-04-06T20:43:35Z 2020-04-06T22:31:45Z \n", + "1 5e8baea365b80c5d6b4db395 2020-04-06T13:22:10Z 2020-04-06T14:49:10Z \n", + "2 5e6b28e377e02d42aa7d0fdf 2020-03-12T17:43:10Z 2020-03-12T17:54:29Z \n", + "3 5e6a934f77e02d42aa7972ee 2020-03-12T09:04:50Z 2020-03-12T09:19:31Z \n", + "4 5e8b930965b80c5d6b4d7ccf 2020-03-07T12:33:15Z 2020-03-07T12:50:00Z \n", + "5 5e8b930a65b80c5d6b4d7f2b 2020-03-07T08:45:25Z 2020-03-07T09:00:33Z \n", + "6 5e42ccb63965f3689459b871 2020-02-03T17:11:48Z 2020-02-03T17:29:25Z \n", + "7 5e24ca2a63c90936dc7b4312 2020-01-19T18:15:23Z 2020-01-19T19:50:01Z \n", + "8 5e24ca2463c90936dc7b2d94 2020-01-17T15:58:38Z 2020-01-17T16:06:21Z \n", + "9 5e24ca2563c90936dc7b32bb 2020-01-17T15:10:14Z 2020-01-17T15:25:12Z \n", + "10 5e5e5ecd77e02d42aa94ee1c 2020-01-09T12:12:53Z 2020-01-09T12:23:16Z \n", + "11 5e4a353b3965f368945da831 2020-01-08T09:16:45Z 2020-01-08T09:30:37Z \n", + "12 5e1ecec31126d80318bfac5a 2020-01-05T16:07:13Z 2020-01-05T18:05:50Z \n", + "13 5e1eceab1126d80318bf9f7f 2020-01-05T15:52:01Z 2020-01-05T16:00:01Z \n", + "14 5e10ec059115b85a123190d0 2020-01-04T19:36:04Z 2020-01-04T19:40:06Z \n", + "15 5e10ec089115b85a12319686 2020-01-04T15:24:53Z 2020-01-04T15:40:45Z \n", + "\n", + " track.length sensor.fuelType sensor.constructionYear sensor.manufacturer \\\n", + "0 169.237435 gasoline 2007 Dodge \n", + "1 142.209935 gasoline 2007 Dodge \n", + "2 4.821775 diesel 2012 BMW \n", + "3 8.872236 diesel 2012 BMW \n", + "4 11.969578 gasoline 2018 Volkswagen \n", + "5 10.938464 gasoline 2018 Volkswagen \n", + "6 9.308336 gasoline 2019 Ford \n", + "7 161.712887 gasoline 2007 Dodge \n", + "8 1.152504 gasoline 2007 Dodge \n", + "9 6.931139 gasoline 2007 Dodge \n", + "10 2.986634 gasoline 2000 VW \n", + "11 9.129420 diesel 2012 BMW \n", + "12 171.928734 gasoline 2007 Dodge \n", + "13 2.341898 gasoline 2007 Dodge \n", + "14 1.050231 gasoline 2007 Dodge \n", + "15 7.494835 gasoline 2007 Dodge \n", + "\n", + " path color \n", + "0 [[7.650794616923975, 51.954004035200796], [7.6... (119, 51, 233) \n", + "1 [[8.547851458544846, 52.951931982446574], [8.5... (231, 24, 105) \n", + "2 [[7.651782336187098, 51.93495048766459], [7.65... (8, 128, 116) \n", + "3 [[7.652008193297737, 51.953823353214716], [7.6... (142, 123, 247) \n", + "4 [[7.64068925342399, 51.95732784163833], [7.641... (178, 138, 52) \n", + "5 [[7.777017871693869, 51.98788788463152], [7.77... (31, 234, 16) \n", + "6 [[7.656319815305157, 51.93630087949337], [7.65... (214, 22, 2) \n", + "7 [[7.652897245590533, 51.95421742650057], [7.65... (9, 166, 73) \n", + "8 [[7.6463266040035, 51.95539490559379], [7.6463... (38, 31, 164) \n", + "9 [[7.674832880184066, 52.00732622926195], [7.67... (12, 5, 226) \n", + "10 [[7.65026072181028, 51.94107696873941], [7.650... (92, 121, 123) \n", + "11 [[7.6020395805890315, 51.96762650870718], [7.6... (220, 118, 226) \n", + "12 [[7.653771777296277, 51.972339185734185], [7.6... (228, 65, 104) \n", + "13 [[7.652863232019939, 51.957484114542815], [7.6... (76, 36, 235) \n", + "14 [[7.645364547902668, 51.955026043641425], [7.6... (252, 48, 167) \n", + "15 [[7.652154746679927, 51.953997225623596], [7.6... (255, 99, 164) " + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# filter out unique track id\n", + "track_id = track_df20['track.id'].unique()\n", + "tracks = []\n", + "# store single tracks\n", + "for i in track_id:\n", + " some_track=track_df20[track_df20['track.id']==i]\n", + " tracks.extend([some_track])" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Generate data for pathlayer" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# generate data for pathlayer\n", + "unitrack={'track.id':[],'track.begin':[],'track.end':[],'track.length':[],'sensor.fuelType':[],'sensor.constructionYear':[],'sensor.manufacturer':[],'path':[]}\n", + "for i in tracks:\n", + " unitrack['track.id'].extend(i[0:1]['track.id'])\n", + " unitrack['track.begin'].extend(i[0:1]['track.begin'])\n", + " unitrack['track.end'].extend(i[0:1]['track.end'])\n", + " unitrack['track.length'].extend(i[0:1]['track.length'])\n", + " unitrack['sensor.fuelType'].extend(i[0:1]['sensor.fuelType'])\n", + " unitrack['sensor.constructionYear'].extend(i[0:1]['sensor.constructionYear'])\n", + " unitrack['sensor.manufacturer'].extend(i[0:1]['sensor.manufacturer'])\n", + " # convert points in path formate [[x,y]]\n", + " coords = i['geometry'].apply(lambda coord:[coord.x,coord.y])\n", + " path = [] \n", + " for j in coords:\n", + " path.append(j)\n", + " unitrack['path'].append(path)\n", + "pathdata = pd.DataFrame(unitrack)\n", + "# add color column for visualization\n", + "pathdata['color']=pd.Series(color(track_id))\n", + "pathdata" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Visualization with pydeck pathlayer\n", + "* https://github.com/uber/deck.gl/tree/master/bindings/pydeck/examples" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "\n", + " \n", + " " + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/plain": [ + "'D:\\\\出國\\\\Erasmus Degree\\\\One Drive\\\\OneDrive - Universitat Jaume I\\\\Semester2\\\\Flaoting Car Project\\\\Assignment1\\\\envirocar-py\\\\examples\\\\path_layer.html'" + ] + }, + "execution_count": 8, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import pydeck as pdk\n", + "# set view parameters\n", + "view_state = pdk.ViewState(\n", + " longitude=7.5963592529296875,\n", + " latitude=51.96246168188569,\n", + " zoom=10,\n", + " min_zoom=5,\n", + " max_zoom=15,\n", + " pitch=40.5,\n", + " bearing=-27.36)\n", + "# use pathlayer\n", + "pathlayer = pdk.Layer(\n", + " type=\"PathLayer\",\n", + " data=pathdata,\n", + " pickable=True,\n", + " get_color='color',\n", + " width_scale=10,\n", + " width_min_pixels=2,\n", + " get_path=\"path\",\n", + " get_width=0.5,\n", + ")\n", + "# add layer, view parameters on map panels\n", + "r = pdk.Deck(layers=[pathlayer], initial_view_state=view_state,mapbox_key=\"pk.eyJ1Ijoic3lkbmV5bGFpIiwiYSI6ImNrM2FyODdlcTBldGszZWszMjg2czA2eDEifQ.4LfuP0PEmRPMt37x8Xpx5Q\")\n", + "# layout \n", + "r.to_html(\"path_layer.html\", iframe_width=900)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Summary Statistics" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Track number 16\n", + "Survey time 2020-01-04T15:24:53Z to 2020-04-06T22:31:45Z\n", + "Length \n", + " min: 1.0502307779995348 \n", + " max: 171.92873411934082 \n", + " mean 45.13037754770366\n", + "Car number by Manufacturer\n", + " Dodge 9\n", + " BMW 3\n", + " Volkswagen 2\n", + " Ford 1\n", + " VW 1\n", + "Car number by production year\n", + " 2007 9\n", + " 2012 3\n", + " 2018 2\n", + " 2019 1\n", + " 2000 1\n", + "Car number by fueltype\n", + " gasoline 13\n", + " diesel 3\n" + ] + } + ], + "source": [ + "arr=pathdata['sensor.manufacturer']\n", + "arr.unique()\n", + "tol=[]\n", + "for i in arr.unique():\n", + " ta=sum(arr.str.count(i))\n", + " tol.append(ta)\n", + "print('Track number',pathdata['track.id'].size)\n", + "print('Survey time',pathdata['track.begin'].min(),'to',pathdata['track.end'].max())\n", + "print('Length','\\n','min:',pathdata['track.length'].min(),'\\n', 'max:',pathdata['track.length'].max(),'\\n','mean',pathdata['track.length'].mean())\n", + "print('Car number by Manufacturer')\n", + "for i in pathdata['sensor.manufacturer'].unique():\n", + " print(' ',i,sum(pathdata['sensor.manufacturer'].str.count(i)))\n", + "print('Car number by production year')\n", + "for i in pathdata['sensor.constructionYear'].unique(): \n", + " print(' ',i,list(pathdata['sensor.constructionYear']).count(i))\n", + "print('Car number by fueltype')\n", + "for i in pathdata['sensor.fuelType'].unique():\n", + " print(' ',i,sum(pathdata['sensor.fuelType'].str.count(i)))" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "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.8.2" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +} From 5679bd3e856d4d576c2fb7456a96106acf48e4d4 Mon Sep 17 00:00:00 2001 From: duckravel Date: Wed, 15 Apr 2020 15:22:00 +0800 Subject: [PATCH 2/3] rename the file --- ...avel.ipynb => Assignment1_duckravel.ipynb} | 539 ++++++++++++++++-- 1 file changed, 483 insertions(+), 56 deletions(-) rename examples/{api_request_duckravel.ipynb => Assignment1_duckravel.ipynb} (72%) diff --git a/examples/api_request_duckravel.ipynb b/examples/Assignment1_duckravel.ipynb similarity index 72% rename from examples/api_request_duckravel.ipynb rename to examples/Assignment1_duckravel.ipynb index d1c25d6..551f69d 100644 --- a/examples/api_request_duckravel.ipynb +++ b/examples/Assignment1_duckravel.ipynb @@ -506,7 +506,444 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 15, + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + " \n", + "
idtimegeometryGPS Altitude.valueGPS Altitude.unitGPS Bearing.valueGPS Bearing.unitThrottle Position.valueThrottle Position.unitSpeed.value...sensor.constructionYearsensor.manufacturertrack.appVersiontrack.touVersionO2 Lambda Voltage ER.valueO2 Lambda Voltage ER.unitMAF.valueMAF.unitO2 Lambda Voltage.valueO2 Lambda Voltage.unit
05e8baea465b80c5d6b4dbfbf2020-04-06T20:43:35POINT (7.65079 51.95400)100.237808m337.001680deg16.283688%6.000000...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
15e8baea465b80c5d6b4dbfc12020-04-06T20:43:40POINT (7.65079 51.95412)102.772222m11.636667deg17.920277%14.260606...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
25e8baea465b80c5d6b4dbfc22020-04-06T20:43:45POINT (7.65083 51.95435)104.020541m6.089730deg16.000000%23.999999...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
35e8baea465b80c5d6b4dbfc32020-04-06T20:43:50POINT (7.65086 51.95463)103.999999m4.503939deg16.000000%21.000001...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
45e8baea465b80c5d6b4dbfc42020-04-06T20:43:55POINT (7.65090 51.95480)104.000001m7.967200deg16.000000%3.000000...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
..................................................................
12835e8baea465b80c5d6b4dc4c32020-04-06T22:31:25POINT (8.79894 53.07385)54.000001m0.000000deg15.000000%0.000000...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
12845e8baea465b80c5d6b4dc4c42020-04-06T22:31:30POINT (8.79894 53.07385)54.000000m0.000000deg16.090625%0.000000...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
12855e8baea465b80c5d6b4dc4c52020-04-06T22:31:35POINT (8.79894 53.07385)54.000001m0.000000deg15.000000%0.000000...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
12865e8baea465b80c5d6b4dc4c62020-04-06T22:31:40POINT (8.79893 53.07385)54.999999m136.499998deg15.000000%0.000000...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
12875e8baea465b80c5d6b4dc4c72020-04-06T22:31:45POINT (8.79892 53.07385)57.000001m0.408683degNaNNaNNaN...2007DodgeNaNNaNNaNNaNNaNNaNNaNNaN
\n", + "

1288 rows × 54 columns

\n", + "
" + ], + "text/plain": [ + " id time geometry \\\n", + "0 5e8baea465b80c5d6b4dbfbf 2020-04-06T20:43:35 POINT (7.65079 51.95400) \n", + "1 5e8baea465b80c5d6b4dbfc1 2020-04-06T20:43:40 POINT (7.65079 51.95412) \n", + "2 5e8baea465b80c5d6b4dbfc2 2020-04-06T20:43:45 POINT (7.65083 51.95435) \n", + "3 5e8baea465b80c5d6b4dbfc3 2020-04-06T20:43:50 POINT (7.65086 51.95463) \n", + "4 5e8baea465b80c5d6b4dbfc4 2020-04-06T20:43:55 POINT (7.65090 51.95480) \n", + "... ... ... ... \n", + "1283 5e8baea465b80c5d6b4dc4c3 2020-04-06T22:31:25 POINT (8.79894 53.07385) \n", + "1284 5e8baea465b80c5d6b4dc4c4 2020-04-06T22:31:30 POINT (8.79894 53.07385) \n", + "1285 5e8baea465b80c5d6b4dc4c5 2020-04-06T22:31:35 POINT (8.79894 53.07385) \n", + "1286 5e8baea465b80c5d6b4dc4c6 2020-04-06T22:31:40 POINT (8.79893 53.07385) \n", + "1287 5e8baea465b80c5d6b4dc4c7 2020-04-06T22:31:45 POINT (8.79892 53.07385) \n", + "\n", + " GPS Altitude.value GPS Altitude.unit GPS Bearing.value \\\n", + "0 100.237808 m 337.001680 \n", + "1 102.772222 m 11.636667 \n", + "2 104.020541 m 6.089730 \n", + "3 103.999999 m 4.503939 \n", + "4 104.000001 m 7.967200 \n", + "... ... ... ... \n", + "1283 54.000001 m 0.000000 \n", + "1284 54.000000 m 0.000000 \n", + "1285 54.000001 m 0.000000 \n", + "1286 54.999999 m 136.499998 \n", + "1287 57.000001 m 0.408683 \n", + "\n", + " GPS Bearing.unit Throttle Position.value Throttle Position.unit \\\n", + "0 deg 16.283688 % \n", + "1 deg 17.920277 % \n", + "2 deg 16.000000 % \n", + "3 deg 16.000000 % \n", + "4 deg 16.000000 % \n", + "... ... ... ... \n", + "1283 deg 15.000000 % \n", + "1284 deg 16.090625 % \n", + "1285 deg 15.000000 % \n", + "1286 deg 15.000000 % \n", + "1287 deg NaN NaN \n", + "\n", + " Speed.value ... sensor.constructionYear sensor.manufacturer \\\n", + "0 6.000000 ... 2007 Dodge \n", + "1 14.260606 ... 2007 Dodge \n", + "2 23.999999 ... 2007 Dodge \n", + "3 21.000001 ... 2007 Dodge \n", + "4 3.000000 ... 2007 Dodge \n", + "... ... ... ... ... \n", + "1283 0.000000 ... 2007 Dodge \n", + "1284 0.000000 ... 2007 Dodge \n", + "1285 0.000000 ... 2007 Dodge \n", + "1286 0.000000 ... 2007 Dodge \n", + "1287 NaN ... 2007 Dodge \n", + "\n", + " track.appVersion track.touVersion O2 Lambda Voltage ER.value \\\n", + "0 NaN NaN NaN \n", + "1 NaN NaN NaN \n", + "2 NaN NaN NaN \n", + "3 NaN NaN NaN \n", + "4 NaN NaN NaN \n", + "... ... ... ... \n", + "1283 NaN NaN NaN \n", + "1284 NaN NaN NaN \n", + "1285 NaN NaN NaN \n", + "1286 NaN NaN NaN \n", + "1287 NaN NaN NaN \n", + "\n", + " O2 Lambda Voltage ER.unit MAF.value MAF.unit O2 Lambda Voltage.value \\\n", + "0 NaN NaN NaN NaN \n", + "1 NaN NaN NaN NaN \n", + "2 NaN NaN NaN NaN \n", + "3 NaN NaN NaN NaN \n", + "4 NaN NaN NaN NaN \n", + "... ... ... ... ... \n", + "1283 NaN NaN NaN NaN \n", + "1284 NaN NaN NaN NaN \n", + "1285 NaN NaN NaN NaN \n", + "1286 NaN NaN NaN NaN \n", + "1287 NaN NaN NaN NaN \n", + "\n", + " O2 Lambda Voltage.unit \n", + "0 NaN \n", + "1 NaN \n", + "2 NaN \n", + "3 NaN \n", + "4 NaN \n", + "... ... \n", + "1283 NaN \n", + "1284 NaN \n", + "1285 NaN \n", + "1286 NaN \n", + "1287 NaN \n", + "\n", + "[1288 rows x 54 columns]" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# filter out unique track id\n", + "track_id = track_df20['track.id'].unique()\n", + "tracks = []\n", + "# store single tracks\n", + "for i in track_id:\n", + " some_track=track_df20[track_df20['track.id']==i]\n", + " tracks.extend([some_track])\n", + "tracks[0]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Generate data for pathlayer" + ] + }, + { + "cell_type": "code", + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -552,7 +989,7 @@ " 2007\n", " Dodge\n", " [[7.650794616923975, 51.954004035200796], [7.6...\n", - " (119, 51, 233)\n", + " (128, 236, 71)\n", " \n", " \n", " 1\n", @@ -564,7 +1001,7 @@ " 2007\n", " Dodge\n", " [[8.547851458544846, 52.951931982446574], [8.5...\n", - " (231, 24, 105)\n", + " (27, 112, 39)\n", " \n", " \n", " 2\n", @@ -576,7 +1013,7 @@ " 2012\n", " BMW\n", " [[7.651782336187098, 51.93495048766459], [7.65...\n", - " (8, 128, 116)\n", + " (189, 245, 173)\n", " \n", " \n", " 3\n", @@ -588,7 +1025,7 @@ " 2012\n", " BMW\n", " [[7.652008193297737, 51.953823353214716], [7.6...\n", - " (142, 123, 247)\n", + " (55, 214, 253)\n", " \n", " \n", " 4\n", @@ -600,7 +1037,7 @@ " 2018\n", " Volkswagen\n", " [[7.64068925342399, 51.95732784163833], [7.641...\n", - " (178, 138, 52)\n", + " (53, 108, 27)\n", " \n", " \n", " 5\n", @@ -612,7 +1049,7 @@ " 2018\n", " Volkswagen\n", " [[7.777017871693869, 51.98788788463152], [7.77...\n", - " (31, 234, 16)\n", + " (16, 117, 152)\n", " \n", " \n", " 6\n", @@ -624,7 +1061,7 @@ " 2019\n", " Ford\n", " [[7.656319815305157, 51.93630087949337], [7.65...\n", - " (214, 22, 2)\n", + " (76, 60, 235)\n", " \n", " \n", " 7\n", @@ -636,7 +1073,7 @@ " 2007\n", " Dodge\n", " [[7.652897245590533, 51.95421742650057], [7.65...\n", - " (9, 166, 73)\n", + " (133, 61, 195)\n", " \n", " \n", " 8\n", @@ -648,7 +1085,7 @@ " 2007\n", " Dodge\n", " [[7.6463266040035, 51.95539490559379], [7.6463...\n", - " (38, 31, 164)\n", + " (131, 204, 13)\n", " \n", " \n", " 9\n", @@ -660,7 +1097,7 @@ " 2007\n", " Dodge\n", " [[7.674832880184066, 52.00732622926195], [7.67...\n", - " (12, 5, 226)\n", + " (168, 249, 169)\n", " \n", " \n", " 10\n", @@ -672,7 +1109,7 @@ " 2000\n", " VW\n", " [[7.65026072181028, 51.94107696873941], [7.650...\n", - " (92, 121, 123)\n", + " (254, 16, 206)\n", " \n", " \n", " 11\n", @@ -684,7 +1121,7 @@ " 2012\n", " BMW\n", " [[7.6020395805890315, 51.96762650870718], [7.6...\n", - " (220, 118, 226)\n", + " (107, 109, 67)\n", " \n", " \n", " 12\n", @@ -696,7 +1133,7 @@ " 2007\n", " Dodge\n", " [[7.653771777296277, 51.972339185734185], [7.6...\n", - " (228, 65, 104)\n", + " (124, 174, 254)\n", " \n", " \n", " 13\n", @@ -708,7 +1145,7 @@ " 2007\n", " Dodge\n", " [[7.652863232019939, 51.957484114542815], [7.6...\n", - " (76, 36, 235)\n", + " (182, 121, 151)\n", " \n", " \n", " 14\n", @@ -720,7 +1157,7 @@ " 2007\n", " Dodge\n", " [[7.645364547902668, 51.955026043641425], [7.6...\n", - " (252, 48, 167)\n", + " (126, 43, 140)\n", " \n", " \n", " 15\n", @@ -732,7 +1169,7 @@ " 2007\n", " Dodge\n", " [[7.652154746679927, 51.953997225623596], [7.6...\n", - " (255, 99, 164)\n", + " (231, 36, 20)\n", " \n", " \n", "\n", @@ -776,52 +1213,37 @@ "15 7.494835 gasoline 2007 Dodge \n", "\n", " path color \n", - "0 [[7.650794616923975, 51.954004035200796], [7.6... (119, 51, 233) \n", - "1 [[8.547851458544846, 52.951931982446574], [8.5... (231, 24, 105) \n", - "2 [[7.651782336187098, 51.93495048766459], [7.65... (8, 128, 116) \n", - "3 [[7.652008193297737, 51.953823353214716], [7.6... (142, 123, 247) \n", - "4 [[7.64068925342399, 51.95732784163833], [7.641... (178, 138, 52) \n", - "5 [[7.777017871693869, 51.98788788463152], [7.77... (31, 234, 16) \n", - "6 [[7.656319815305157, 51.93630087949337], [7.65... (214, 22, 2) \n", - "7 [[7.652897245590533, 51.95421742650057], [7.65... (9, 166, 73) \n", - "8 [[7.6463266040035, 51.95539490559379], [7.6463... (38, 31, 164) \n", - "9 [[7.674832880184066, 52.00732622926195], [7.67... (12, 5, 226) \n", - "10 [[7.65026072181028, 51.94107696873941], [7.650... (92, 121, 123) \n", - "11 [[7.6020395805890315, 51.96762650870718], [7.6... (220, 118, 226) \n", - "12 [[7.653771777296277, 51.972339185734185], [7.6... (228, 65, 104) \n", - "13 [[7.652863232019939, 51.957484114542815], [7.6... (76, 36, 235) \n", - "14 [[7.645364547902668, 51.955026043641425], [7.6... (252, 48, 167) \n", - "15 [[7.652154746679927, 51.953997225623596], [7.6... (255, 99, 164) " + "0 [[7.650794616923975, 51.954004035200796], [7.6... (128, 236, 71) \n", + "1 [[8.547851458544846, 52.951931982446574], [8.5... (27, 112, 39) \n", + "2 [[7.651782336187098, 51.93495048766459], [7.65... (189, 245, 173) \n", + "3 [[7.652008193297737, 51.953823353214716], [7.6... (55, 214, 253) \n", + "4 [[7.64068925342399, 51.95732784163833], [7.641... (53, 108, 27) \n", + "5 [[7.777017871693869, 51.98788788463152], [7.77... (16, 117, 152) \n", + "6 [[7.656319815305157, 51.93630087949337], [7.65... (76, 60, 235) \n", + "7 [[7.652897245590533, 51.95421742650057], [7.65... (133, 61, 195) \n", + "8 [[7.6463266040035, 51.95539490559379], [7.6463... (131, 204, 13) \n", + "9 [[7.674832880184066, 52.00732622926195], [7.67... (168, 249, 169) \n", + "10 [[7.65026072181028, 51.94107696873941], [7.650... (254, 16, 206) \n", + "11 [[7.6020395805890315, 51.96762650870718], [7.6... (107, 109, 67) \n", + "12 [[7.653771777296277, 51.972339185734185], [7.6... (124, 174, 254) \n", + "13 [[7.652863232019939, 51.957484114542815], [7.6... (182, 121, 151) \n", + "14 [[7.645364547902668, 51.955026043641425], [7.6... (126, 43, 140) \n", + "15 [[7.652154746679927, 51.953997225623596], [7.6... (231, 36, 20) " ] }, - "execution_count": 3, + "execution_count": 13, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "# filter out unique track id\n", - "track_id = track_df20['track.id'].unique()\n", - "tracks = []\n", - "# store single tracks\n", - "for i in track_id:\n", - " some_track=track_df20[track_df20['track.id']==i]\n", - " tracks.extend([some_track])" - ] - }, - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Generate data for pathlayer" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [ + "import random\n", + "def color(arr):\n", + " colorlist = []\n", + " n = arr.size\n", + " for i in range(n):\n", + " colorlist.append(tuple([random.randint(0,255),random.randint(0,255),random.randint(0,255)]))\n", + " return colorlist\n", "# generate data for pathlayer\n", "unitrack={'track.id':[],'track.begin':[],'track.end':[],'track.length':[],'sensor.fuelType':[],'sensor.constructionYear':[],'sensor.manufacturer':[],'path':[]}\n", "for i in tracks:\n", @@ -976,6 +1398,11 @@ "for i in pathdata['sensor.fuelType'].unique():\n", " print(' ',i,sum(pathdata['sensor.fuelType'].str.count(i)))" ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [] } ], "metadata": { From 0a2983f39975033b2ebfc8b852211e399b667b02 Mon Sep 17 00:00:00 2001 From: duckravel Date: Wed, 15 Apr 2020 16:00:48 +0800 Subject: [PATCH 3/3] 1. add the spatiotemporal boundary 2. change visulizations 3. add summary statistics --- examples/Assignment1_duckravel.ipynb | 86 ++++++++++++++-------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/examples/Assignment1_duckravel.ipynb b/examples/Assignment1_duckravel.ipynb index 551f69d..9a09321 100644 --- a/examples/Assignment1_duckravel.ipynb +++ b/examples/Assignment1_duckravel.ipynb @@ -467,16 +467,16 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "" + "" ] }, - "execution_count": 10, + "execution_count": 3, "metadata": {}, "output_type": "execute_result" }, @@ -506,7 +506,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 4, "metadata": {}, "outputs": [ { @@ -918,7 +918,7 @@ "[1288 rows x 54 columns]" ] }, - "execution_count": 15, + "execution_count": 4, "metadata": {}, "output_type": "execute_result" } @@ -943,7 +943,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 5, "metadata": {}, "outputs": [ { @@ -989,7 +989,7 @@ " 2007\n", " Dodge\n", " [[7.650794616923975, 51.954004035200796], [7.6...\n", - " (128, 236, 71)\n", + " (5, 19, 28)\n", " \n", " \n", " 1\n", @@ -1001,7 +1001,7 @@ " 2007\n", " Dodge\n", " [[8.547851458544846, 52.951931982446574], [8.5...\n", - " (27, 112, 39)\n", + " (22, 153, 139)\n", " \n", " \n", " 2\n", @@ -1013,7 +1013,7 @@ " 2012\n", " BMW\n", " [[7.651782336187098, 51.93495048766459], [7.65...\n", - " (189, 245, 173)\n", + " (166, 21, 241)\n", " \n", " \n", " 3\n", @@ -1025,7 +1025,7 @@ " 2012\n", " BMW\n", " [[7.652008193297737, 51.953823353214716], [7.6...\n", - " (55, 214, 253)\n", + " (11, 45, 35)\n", " \n", " \n", " 4\n", @@ -1037,7 +1037,7 @@ " 2018\n", " Volkswagen\n", " [[7.64068925342399, 51.95732784163833], [7.641...\n", - " (53, 108, 27)\n", + " (125, 138, 17)\n", " \n", " \n", " 5\n", @@ -1049,7 +1049,7 @@ " 2018\n", " Volkswagen\n", " [[7.777017871693869, 51.98788788463152], [7.77...\n", - " (16, 117, 152)\n", + " (182, 162, 132)\n", " \n", " \n", " 6\n", @@ -1061,7 +1061,7 @@ " 2019\n", " Ford\n", " [[7.656319815305157, 51.93630087949337], [7.65...\n", - " (76, 60, 235)\n", + " (132, 199, 87)\n", " \n", " \n", " 7\n", @@ -1073,7 +1073,7 @@ " 2007\n", " Dodge\n", " [[7.652897245590533, 51.95421742650057], [7.65...\n", - " (133, 61, 195)\n", + " (247, 163, 199)\n", " \n", " \n", " 8\n", @@ -1085,7 +1085,7 @@ " 2007\n", " Dodge\n", " [[7.6463266040035, 51.95539490559379], [7.6463...\n", - " (131, 204, 13)\n", + " (167, 139, 236)\n", " \n", " \n", " 9\n", @@ -1097,7 +1097,7 @@ " 2007\n", " Dodge\n", " [[7.674832880184066, 52.00732622926195], [7.67...\n", - " (168, 249, 169)\n", + " (220, 193, 147)\n", " \n", " \n", " 10\n", @@ -1109,7 +1109,7 @@ " 2000\n", " VW\n", " [[7.65026072181028, 51.94107696873941], [7.650...\n", - " (254, 16, 206)\n", + " (167, 208, 252)\n", " \n", " \n", " 11\n", @@ -1121,7 +1121,7 @@ " 2012\n", " BMW\n", " [[7.6020395805890315, 51.96762650870718], [7.6...\n", - " (107, 109, 67)\n", + " (225, 135, 42)\n", " \n", " \n", " 12\n", @@ -1133,7 +1133,7 @@ " 2007\n", " Dodge\n", " [[7.653771777296277, 51.972339185734185], [7.6...\n", - " (124, 174, 254)\n", + " (211, 224, 218)\n", " \n", " \n", " 13\n", @@ -1145,7 +1145,7 @@ " 2007\n", " Dodge\n", " [[7.652863232019939, 51.957484114542815], [7.6...\n", - " (182, 121, 151)\n", + " (253, 56, 41)\n", " \n", " \n", " 14\n", @@ -1157,7 +1157,7 @@ " 2007\n", " Dodge\n", " [[7.645364547902668, 51.955026043641425], [7.6...\n", - " (126, 43, 140)\n", + " (164, 175, 244)\n", " \n", " \n", " 15\n", @@ -1169,7 +1169,7 @@ " 2007\n", " Dodge\n", " [[7.652154746679927, 51.953997225623596], [7.6...\n", - " (231, 36, 20)\n", + " (182, 84, 63)\n", " \n", " \n", "\n", @@ -1213,25 +1213,25 @@ "15 7.494835 gasoline 2007 Dodge \n", "\n", " path color \n", - "0 [[7.650794616923975, 51.954004035200796], [7.6... (128, 236, 71) \n", - "1 [[8.547851458544846, 52.951931982446574], [8.5... (27, 112, 39) \n", - "2 [[7.651782336187098, 51.93495048766459], [7.65... (189, 245, 173) \n", - "3 [[7.652008193297737, 51.953823353214716], [7.6... (55, 214, 253) \n", - "4 [[7.64068925342399, 51.95732784163833], [7.641... (53, 108, 27) \n", - "5 [[7.777017871693869, 51.98788788463152], [7.77... (16, 117, 152) \n", - "6 [[7.656319815305157, 51.93630087949337], [7.65... (76, 60, 235) \n", - "7 [[7.652897245590533, 51.95421742650057], [7.65... (133, 61, 195) \n", - "8 [[7.6463266040035, 51.95539490559379], [7.6463... (131, 204, 13) \n", - "9 [[7.674832880184066, 52.00732622926195], [7.67... (168, 249, 169) \n", - "10 [[7.65026072181028, 51.94107696873941], [7.650... (254, 16, 206) \n", - "11 [[7.6020395805890315, 51.96762650870718], [7.6... (107, 109, 67) \n", - "12 [[7.653771777296277, 51.972339185734185], [7.6... (124, 174, 254) \n", - "13 [[7.652863232019939, 51.957484114542815], [7.6... (182, 121, 151) \n", - "14 [[7.645364547902668, 51.955026043641425], [7.6... (126, 43, 140) \n", - "15 [[7.652154746679927, 51.953997225623596], [7.6... (231, 36, 20) " + "0 [[7.650794616923975, 51.954004035200796], [7.6... (5, 19, 28) \n", + "1 [[8.547851458544846, 52.951931982446574], [8.5... (22, 153, 139) \n", + "2 [[7.651782336187098, 51.93495048766459], [7.65... (166, 21, 241) \n", + "3 [[7.652008193297737, 51.953823353214716], [7.6... (11, 45, 35) \n", + "4 [[7.64068925342399, 51.95732784163833], [7.641... (125, 138, 17) \n", + "5 [[7.777017871693869, 51.98788788463152], [7.77... (182, 162, 132) \n", + "6 [[7.656319815305157, 51.93630087949337], [7.65... (132, 199, 87) \n", + "7 [[7.652897245590533, 51.95421742650057], [7.65... (247, 163, 199) \n", + "8 [[7.6463266040035, 51.95539490559379], [7.6463... (167, 139, 236) \n", + "9 [[7.674832880184066, 52.00732622926195], [7.67... (220, 193, 147) \n", + "10 [[7.65026072181028, 51.94107696873941], [7.650... (167, 208, 252) \n", + "11 [[7.6020395805890315, 51.96762650870718], [7.6... (225, 135, 42) \n", + "12 [[7.653771777296277, 51.972339185734185], [7.6... (211, 224, 218) \n", + "13 [[7.652863232019939, 51.957484114542815], [7.6... (253, 56, 41) \n", + "14 [[7.645364547902668, 51.955026043641425], [7.6... (164, 175, 244) \n", + "15 [[7.652154746679927, 51.953997225623596], [7.6... (182, 84, 63) " ] }, - "execution_count": 13, + "execution_count": 5, "metadata": {}, "output_type": "execute_result" } @@ -1276,7 +1276,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -1293,7 +1293,7 @@ " " ], "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -1305,7 +1305,7 @@ "'D:\\\\出國\\\\Erasmus Degree\\\\One Drive\\\\OneDrive - Universitat Jaume I\\\\Semester2\\\\Flaoting Car Project\\\\Assignment1\\\\envirocar-py\\\\examples\\\\path_layer.html'" ] }, - "execution_count": 8, + "execution_count": 6, "metadata": {}, "output_type": "execute_result" } @@ -1347,7 +1347,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 7, "metadata": {}, "outputs": [ {