import os
import requests
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
def generate_urls(data_type: str, start_date: str, end_date: str) -> list:
"""
Generate a list of URLs for flight lists, flight events, or measurements.
Args:
data_type (str): Type of data ("flight_list", "flight_events", "measurements").
start_date (str): The start date in the format YYYYMM or YYYYMMDD.
end_date (str): The end date in the format YYYYMM or YYYYMMDD.
Returns:
list: List of generated URLs.
"""
= f"https://www.eurocontrol.int/performance/data/download/OPDI/v002/{data_type}/{data_type}_"
base_url
= []
urls
if data_type == "flight_list":
= datetime.strptime(start_date, "%Y%m")
start_dt = datetime.strptime(end_date, "%Y%m")
end_dt = relativedelta(months=1)
delta
= start_dt
current_dt while current_dt <= end_dt:
= f"{base_url}{current_dt.strftime('%Y%m')}.parquet"
url
urls.append(url)+= delta
current_dt
return urls
def download_files(urls: list, save_folder: str):
"""
Download files from the generated URLs and save them in the specified folder.
Args:
urls (list): List of URLs to download.
save_folder (str): Folder to save downloaded files.
"""
=True)
os.makedirs(save_folder, exist_ok
for url in urls:
= url.split("/")[-1]
file_name = os.path.join(save_folder, file_name)
save_path
if os.path.exists(save_path):
print(f"Skipping {file_name}, already exists.")
continue
print(f"Downloading {url}...")
try:
= requests.get(url, stream=True)
response
response.raise_for_status()
with open(save_path, "wb") as file:
for chunk in response.iter_content(chunk_size=1024):
file.write(chunk)
print(f"Saved to {save_path}")
except requests.exceptions.RequestException as e:
print(f"Failed to download {url}: {e}")
if __name__ == "__main__":
= {
datasets "flight_list": ("202201", "202411")
}
for data_type, (start_date, end_date) in datasets.items():
= generate_urls(data_type, start_date, end_date)
urls f"./data/{data_type}") download_files(urls,
Download Flight List v0.0.2 Datasets
Below you will find links to download flight list v0.0.2 data files from January 01, 2022 to April 30, 2025. Each file is in Parquet format, providing a highly efficient way to store and manage large datasets. The datasets are organized by month.
Automated Download
If you want to automate your downloads, you can generate the link for downloading using the following format where YYYYMM
is the year and month of interest.
https://www.eurocontrol.int/performance/data/download/OPDI/v002/flight_list/flight_list_{YYYYMM}.parquet
library(httr)
library(lubridate)
library(fs)
<- function(data_type, start_date, end_date) {
generate_urls <- paste0("https://www.eurocontrol.int/performance/data/download/OPDI/v002/", data_type, "/", data_type, "_")
base_url <- c()
urls
<- ymd(paste0(start_date, "01"))
start_dt <- ymd(paste0(end_date, "01"))
end_dt <- months(1)
delta
<- start_dt
current_dt while (current_dt <= end_dt) {
<- paste0(base_url, format(current_dt, "%Y%m"), ".parquet")
url <- c(urls, url)
urls <- current_dt + delta
current_dt
}
return(urls)
}
<- function(urls, save_folder) {
download_files if (!dir_exists(save_folder)) {
dir_create(save_folder)
}
for (url in urls) {
<- basename(url)
file_name <- file.path(save_folder, file_name)
save_path
if (file_exists(save_path)) {
message("Skipping ", file_name, ", already exists.")
next
}
message("Downloading ", url, "...")
tryCatch({
<- GET(url, write_disk(save_path, overwrite = TRUE))
response
if (http_error(response)) {
warning("Failed to download ", url, ": HTTP error ", status_code(response))
else {
} message("Saved to ", save_path)
}
error = function(e) {
}, warning("Failed to download ", url, ": ", e$message)
})
}
}
# Example usage
<- generate_urls("flight_list", "202201", "202411")
urls download_files(urls, "./data/flight_list")
Download Available Datasets
Each dataset corresponds to a specific month and year, listed below for easy access.
- January 2022
Download flight_list_202201.parquet - February 2022
Download flight_list_202202.parquet - March 2022
Download flight_list_202203.parquet - April 2022
Download flight_list_202204.parquet - May 2022
Download flight_list_202205.parquet - June 2022
Download flight_list_202206.parquet - July 2022
Download flight_list_202207.parquet - August 2022
Download flight_list_202208.parquet - September 2022
Download flight_list_202209.parquet - October 2022
Download flight_list_202210.parquet - November 2022
Download flight_list_202211.parquet - December 2022
Download flight_list_202212.parquet - January 2023
Download flight_list_202301.parquet - February 2023
Download flight_list_202302.parquet - March 2023
Download flight_list_202303.parquet - April 2023
Download flight_list_202304.parquet - May 2023
Download flight_list_202305.parquet - June 2023
Download flight_list_202306.parquet - July 2023
Download flight_list_202307.parquet - August 2023
Download flight_list_202308.parquet - September 2023
Download flight_list_202309.parquet - October 2023
Download flight_list_202310.parquet - November 2023
Download flight_list_202311.parquet - December 2023
Download flight_list_202312.parquet - January 2024
Download flight_list_202401.parquet - February 2024
Download flight_list_202402.parquet - March 2024
Download flight_list_202403.parquet - April 2024
Download flight_list_202404.parquet - May 2024
Download flight_list_202405.parquet - June 2024
Download flight_list_202406.parquet - July 2024
Download flight_list_202407.parquet - August 2024
Download flight_list_202408.parquet - September 2024
Download flight_list_202409.parquet - October 2024
Download flight_list_202410.parquet - November 2024
Download flight_list_202411.parquet - December 2024
Download flight_list_202412.parquet - January 2025
Download flight_list_202501.parquet - February 2025
Download flight_list_202502.parquet - March 2025
Download flight_list_202503.parquet - April 2025
Download flight_list_202504.parquet
We hope you find these datasets useful for your analysis and research. If you have any questions or require further assistance, please contact us at [email protected].