Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -14,7 +14,7 @@ repos:
args: [--allow-missing-credentials]
- id: detect-private-key
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
rev: v0.49.1
hooks:
- id: markdownlint
name: Markdownlint
Expand All @@ -28,14 +28,14 @@ repos:
]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
rev: v2.4.3
hooks:
- id: codespell
name: codespell
description: Checks for common misspellings in text files
exclude: 'notebooks/.*'
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.3
rev: v0.16.5
hooks:
- id: ruff
types_or: [python, pyi, jupyter]
Expand Down
15 changes: 6 additions & 9 deletions notebooks/air-pollution/air-pollution.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,19 @@
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import bokeh\n",
"import geopandas as gpd\n",
"import matplotlib.pyplot as plt\n",
"\n",
"import bokeh\n",
"import pandas as pd\n",
"from bokeh.core.validation import silence\n",
"from bokeh.core.validation.warnings import EMPTY_LAYOUT, MISSING_RENDERERS\n",
"from bokeh.layouts import column\n",
"from bokeh.models import Legend, Panel, Tabs\n",
"\n",
"from bokeh.core.validation.warnings import EMPTY_LAYOUT, MISSING_RENDERERS\n",
"\n",
"from bokeh.core.validation import silence\n",
"\n",
"bokeh.core.validation.silence(EMPTY_LAYOUT, True)\n",
"bokeh.core.validation.silence(MISSING_RENDERERS, True)\n",
"from bokeh.plotting import figure, show, output_notebook, ColumnDataSource\n",
"from bokeh.io import output_notebook"
"from bokeh.io import output_notebook\n",
"from bokeh.plotting import ColumnDataSource, figure, output_notebook, show"
]
},
{
Expand Down
16 changes: 8 additions & 8 deletions notebooks/air-pollution/emissions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import geopandas as gpd\n",
"import matplotlib.pyplot as plt"
"import matplotlib.pyplot as plt\n",
"import pandas as pd"
]
},
{
Expand All @@ -33,14 +33,13 @@
"outputs": [],
"source": [
"import bokeh\n",
"from bokeh.core.validation.warnings import EMPTY_LAYOUT, MISSING_RENDERERS\n",
"from bokeh.layouts import column\n",
"from bokeh.models import Legend, Panel, Tabs\n",
"\n",
"from bokeh.core.validation.warnings import EMPTY_LAYOUT, MISSING_RENDERERS\n",
"\n",
"bokeh.core.validation.silence(EMPTY_LAYOUT, True)\n",
"bokeh.core.validation.silence(MISSING_RENDERERS, True)\n",
"from bokeh.plotting import figure, show, output_notebook"
"from bokeh.plotting import figure, output_notebook, show"
]
},
{
Expand All @@ -53,10 +52,10 @@
},
"outputs": [],
"source": [
"from bokeh.plotting import ColumnDataSource\n",
"from bokeh.io import output_notebook\n",
"from bokeh.core.validation import silence\n",
"from bokeh.core.validation.warnings import EMPTY_LAYOUT\n",
"from bokeh.io import output_notebook\n",
"from bokeh.plotting import ColumnDataSource\n",
"\n",
"# Use the silence function to ignore the EMPTY_LAYOUT warning\n",
"silence(EMPTY_LAYOUT, True)\n",
Expand Down Expand Up @@ -341,9 +340,10 @@
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import glob\n",
"\n",
"import pandas as pd\n",
"\n",
"# Step 1: List all text files\n",
"file_paths = glob.glob(\n",
" \"../../data/air_pollution/ENE_emi_txt/*.txt\"\n",
Expand Down
14 changes: 7 additions & 7 deletions notebooks/ais-analysis/01-lebanon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import folium\n",
"import h3.api.numpy_int as h3int\n",
"from shapely.geometry import mapping, Polygon\n",
"\n",
"import os\n",
"import subprocess\n",
"import sys"
"import sys\n",
"\n",
"import folium\n",
"import h3.api.numpy_int as h3int\n",
"import pandas as pd\n",
"from shapely.geometry import Polygon, mapping"
]
},
{
Expand Down Expand Up @@ -3041,7 +3041,7 @@
" \"append\"\n",
" ).partitionBy(\"year\", \"month\").parquet(save_path)\n",
"\n",
" print(f\"Finished: {datetime.now()-start}\")\n",
" print(f\"Finished: {datetime.now() - start}\")\n",
" sdf.unpersist()"
]
},
Expand Down
13 changes: 6 additions & 7 deletions notebooks/ais-analysis/03-lebanon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@
},
"outputs": [],
"source": [
"from pyspark.sql import functions as F\n",
"import h3.api.numpy_int as h3int\n",
"from pyspark.sql import Window\n",
"from pyspark.sql.types import LongType\n",
"\n",
"import h3.api.numpy_int as h3int"
"from pyspark.sql import functions as F\n",
"from pyspark.sql.types import LongType"
]
},
{
Expand All @@ -84,10 +83,10 @@
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import geopandas as gpd\n",
"import json\n",
"\n",
"import json"
"import geopandas as gpd\n",
"import pandas as pd"
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions notebooks/ais-analysis/04-lebanon.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import os\n",
"\n",
"import numpy as np\n",
"import os"
"import pandas as pd"
]
},
{
Expand Down
7 changes: 3 additions & 4 deletions notebooks/aviation-trends/aviation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
},
"outputs": [],
"source": [
"import pandas as pd\n",
"import matplotlib.pyplot as plt"
"import matplotlib.pyplot as plt\n",
"import pandas as pd"
]
},
{
Expand Down Expand Up @@ -409,9 +409,8 @@
}
],
"source": [
"import numpy as np\n",
"import matplotlib.patches as mpatches\n",
"\n",
"import numpy as np\n",
"\n",
"df = top_categories_seats\n",
"sorted_df = df.sort_values(by=[\"date\", \"total_seats\"], ascending=[True, False])\n",
Expand Down
24 changes: 14 additions & 10 deletions notebooks/aviation-trends/aviation_update.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@
"outputs": [],
"source": [
"# Define empty dataset to concat all the arrivals and departures\n",
"departures = pd.read_csv('../../data/aviation/departures_BEY_2026-01-01_2026-04-07.csv')\n",
"arrivals = pd.read_csv('../../data/aviation/arrivals_BEY_2026-01-01_2026-04-07.csv')"
"departures = pd.read_csv(\"../../data/aviation/departures_BEY_2026-01-01_2026-04-07.csv\")\n",
"arrivals = pd.read_csv(\"../../data/aviation/arrivals_BEY_2026-01-01_2026-04-07.csv\")"
]
},
{
Expand Down Expand Up @@ -124,7 +124,6 @@
},
"outputs": [],
"source": [
"from bokeh.plotting import figure, show\n",
"from bokeh.io import output_notebook\n",
"from bokeh.models import (\n",
" ColumnDataSource,\n",
Expand All @@ -133,10 +132,11 @@
" HoverTool,\n",
" Label,\n",
" Span,\n",
" Tabs,\n",
" TabPanel,\n",
" Tabs,\n",
")\n",
"from bokeh.palettes import Spectral6\n",
"from bokeh.plotting import figure, show\n",
"\n",
"\n",
"def get_area_plot(\n",
Expand Down Expand Up @@ -437,7 +437,7 @@
"\n",
"after = departures_exploded.shape[0]\n",
"print(\n",
" f\"There are {after} flights after duplication check. {before-after} flights were duplicated\"\n",
" f\"There are {after} flights after duplication check. {before - after} flights were duplicated\"\n",
")"
]
},
Expand Down Expand Up @@ -996,7 +996,9 @@
"# Initialize an empty list to store the tabs\n",
"tabs = []\n",
"\n",
"departures_last_date = pd.to_datetime(departures_exploded[\"flight_date\"]).max().strftime(\"%B %d %Y\")\n",
"departures_last_date = (\n",
" pd.to_datetime(departures_exploded[\"flight_date\"]).max().strftime(\"%B %d %Y\")\n",
")\n",
"\n",
"# Loop through each dataset and its corresponding color\n",
"for (title, data), color in zip(datasets.items(), colors):\n",
Expand Down Expand Up @@ -1069,7 +1071,7 @@
"layout = column(main_title, tabs_layout)\n",
"\n",
"# Show the tabs\n",
"show(layout)\n"
"show(layout)"
]
},
{
Expand Down Expand Up @@ -1242,7 +1244,7 @@
"\n",
"after = arrivals_exploded.shape[0]\n",
"print(\n",
" f\"There are {after} flights after duplication check. {before-after} flights were duplicated\"\n",
" f\"There are {after} flights after duplication check. {before - after} flights were duplicated\"\n",
")"
]
},
Expand Down Expand Up @@ -1642,7 +1644,9 @@
"# Initialize an empty list to store the tabs\n",
"tabs = []\n",
"\n",
"arrivals_last_date = pd.to_datetime(arrivals_exploded[\"flight_date\"]).max().strftime(\"%B %d %Y\")\n",
"arrivals_last_date = (\n",
" pd.to_datetime(arrivals_exploded[\"flight_date\"]).max().strftime(\"%B %d %Y\")\n",
")\n",
"\n",
"# Loop through each dataset and its corresponding color\n",
"for (title, data), color in zip(datasets.items(), colors):\n",
Expand Down Expand Up @@ -1715,7 +1719,7 @@
"layout = column(main_title, tabs_layout)\n",
"\n",
"# Show the tabs\n",
"show(layout)\n"
"show(layout)"
]
},
{
Expand Down
Loading