diff --git "a/code/export-processed-data.ipynb" "b/code/export-processed-data.ipynb"
new file mode 100644--- /dev/null
+++ "b/code/export-processed-data.ipynb"
@@ -0,0 +1,339 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "56055bd3",
+ "metadata": {},
+ "source": [
+ "### Exporting the processed intersections, bus stops and focus points to the VED files."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "id": "b1e30678",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import os\n",
+ "import pandas as pd\n",
+ "import numpy as np\n",
+ "from tqdm.notebook import tqdm\n",
+ "import folium\n",
+ "import csv"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0591f464",
+ "metadata": {},
+ "source": [
+ "Read three CSV files: intersections, focus points and bus stops."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "id": "b380a50a",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "intersections = pd.read_csv('../data/processed/joined_coords_intersections.csv').to_numpy()\n",
+ "focus_points = pd.read_csv('../data/processed/joined_layer_coords_focus_points.csv')\n",
+ "# combine different focus points in the 'highway' column\n",
+ "focus_points['highway'] = focus_points.bfill(1)['highway']\n",
+ "focus_points = focus_points.to_numpy()\n",
+ "busstops = pd.read_csv('../data/processed/joined_coords_bus_stops.csv').to_numpy()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "bf202e40",
+ "metadata": {},
+ "source": [
+ "Create dictionaries where keys are the latitude/longitude coordinates."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "2a3c3ebb",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "intersections_dict = {(intersections[i,0], intersections[i,1]) : 1 for i in range(len(intersections))}\n",
+ "busstops_dict = {(busstops[i,0], busstops[i,1]) : 1 for i in range(len(busstops))}\n",
+ "focus_points_dict = {(focus_points[i,0], focus_points[i,1]) : focus_points[i,4] for i in range(len(focus_points))}"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "170161c7",
+ "metadata": {},
+ "source": [
+ "Let's visualize some of the intersections. Folium map is slow if we try to plot all of them. Therefore, we will plot the first 1000 intersections."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "66bb6abd",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
Make this Notebook Trusted to load map: File -> Trust Notebook
"
+ ],
+ "text/plain": [
+ ""
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "def plot_map(latlon):\n",
+ " tiles = \"cartodbpositron\"\n",
+ " map = folium.Map(prefer_canvas=True, tiles=tiles)\n",
+ " t = folium.TileLayer(tiles).add_to(map)\n",
+ " lats = [point[0] for point in latlon]\n",
+ " lons = [point[1] for point in latlon]\n",
+ " min_lat, max_lat = min(lats), max(lats)\n",
+ " min_lon, max_lon = min(lons), max(lons)\n",
+ " map.fit_bounds([[min_lat, min_lon], [max_lat, max_lon]])\n",
+ " for point in latlon:\n",
+ " folium.CircleMarker(\n",
+ " location=[point[0], point[1]], radius=2, fill=True, color='red',\n",
+ " popup='').add_to(map)\n",
+ " return map\n",
+ "\n",
+ "plot_map(list(intersections_dict.keys())[0:1000])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "453d7ed7",
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "application/vnd.jupyter.widget-view+json": {
+ "model_id": "f4c1c8888532499d99ef9a3b3122c2ad",
+ "version_major": 2,
+ "version_minor": 0
+ },
+ "text/plain": [
+ " 0%| | 0/54 [00:00, ?it/s]"
+ ]
+ },
+ "metadata": {},
+ "output_type": "display_data"
+ }
+ ],
+ "source": [
+ "data_path = \"../data/ved-speed-limits/\"\n",
+ "files = [os.path.join(data_path, file) for file in tqdm(os.listdir(data_path)) if file.endswith(\".csv\")]\n",
+ "files.sort()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "id": "163127e6",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "columns = ['DayNum', 'VehId', 'Trip', 'Timestamp(ms)', 'Latitude[deg]', \n",
+ " 'Longitude[deg]', 'Vehicle Speed[km/h]', 'MAF[g/sec]', \n",
+ " 'Engine RPM[RPM]', 'Absolute Load[%]', 'OAT[DegC]', 'Fuel Rate[L/hr]', \n",
+ " 'Air Conditioning Power[kW]', 'Air Conditioning Power[Watts]', \n",
+ " 'Heater Power[Watts]', 'HV Battery Current[A]', 'HV Battery SOC[%]', \n",
+ " 'HV Battery Voltage[V]', 'Short Term Fuel Trim Bank 1[%]', \n",
+ " 'Short Term Fuel Trim Bank 2[%]', 'Long Term Fuel Trim Bank 1[%]', \n",
+ " 'Long Term Fuel Trim Bank 2[%]', 'Matchted Latitude[deg]', 'Matched Longitude[deg]', \n",
+ " 'Match Type', 'Class of Speed Limit', 'Speed Limit[km/h]', \n",
+ " 'Speed Limit with Direction[km/h]', 'Intersection', 'Focus Points', 'Bus Stops']\n",
+ "\n",
+ "def get_save_path(filename):\n",
+ " return f\"../data/ved_with_intersections_focus_points/{filename[len(data_path)-1:]}\"\n",
+ "\n",
+ "def export_data(files, columns):\n",
+ " \n",
+ " for file in tqdm(files):\n",
+ " \n",
+ " ved_file = pd.read_csv(file, dtype={'Speed Limit[km/h]': 'str'}).to_numpy()\n",
+ " N = len(ved_file)\n",
+ " ved_file_sp = np.c_[ved_file, np.zeros(N), np.zeros(N), np.empty(N, dtype='