-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
155 additions
and
139 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import matplotlib.pyplot as plt | ||
import cartopy.crs as ccrs | ||
import cartopy.feature as cfeature | ||
|
||
|
||
def draw_map(boundary=[111, 117.5, 19, 25.5]): | ||
""" | ||
Create plt ax obtject with cartopy map on the given boundary box. | ||
""" | ||
|
||
ax = plt.axes(projection=ccrs.PlateCarree()) | ||
ax.set_extend(boundary, ccrs.PlateCarree()) | ||
|
||
# Add map features | ||
ax.add_feature(cfeature.LAND) | ||
ax.add_feature(cfeature.OCEAN) | ||
|
||
# Draw gridlines | ||
gridlines = ax.gridlines(draw_labels=True, zorder=0, | ||
linestyle="dashed", linewidth=0.5, color="dimgrey") | ||
gridlines.top_labels = False | ||
gridlines.right_labels = False | ||
|
||
return ax |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import numpy as np\n", | ||
"import pandas as pd\n", | ||
"import cartopy.crs as ccrs\n", | ||
"import cartopy.feature as cfeature\n", | ||
"import matplotlib.pyplot as plt\n", | ||
"\n", | ||
"from air_traffic.visual import draw_map\n", | ||
"from air_traffic.io import read_trajectories, read_trajectories_range" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"plt.rcParams.update({\n", | ||
" \"text.usetex\": True,\n", | ||
" \"font.family\": \"serif\",\n", | ||
" \"font.serif\": [\"Palatino\"]\n", | ||
" }\n", | ||
")\n", | ||
"\n", | ||
"ncolor = 25\n", | ||
"cmap = plt.cm.get_cmap(\"rainbow\", ncolor)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"datadir = \"\"\n", | ||
"savedir = \"\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# 1 - Distribution of Trajectories\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"data = read_trajectories(datadir, \"2017-01-01\")\n", | ||
"ax = draw_map()\n", | ||
"\n", | ||
"for i, df in enumerate(data):\n", | ||
"\n", | ||
" lat = df[\"latitude\"].to_numpy()\n", | ||
" lon = df[\"longitude\"].to_numpy()\n", | ||
" c = cmap(i % ncolor)\n", | ||
"\n", | ||
" ax.plot(lon, lat, transform=ccrs.Geodetic(),\n", | ||
" marker=\".\", ms=1.5, linewidth=0.5, alpha=0.8, color=c)\n", | ||
"\n", | ||
"plt.cla()\n", | ||
"plt.clf()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# 2 - Trajectories Entry and End Points" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# 3 - Clustering of Entry Direction" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3.8.10 64-bit", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"name": "python", | ||
"version": "3.8.10" | ||
}, | ||
"orig_nbformat": 4, | ||
"vscode": { | ||
"interpreter": { | ||
"hash": "916dbcbb3f70747c44a77c7bcd40155683ae19c65e1c03b4aa3499c5328201f1" | ||
} | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.