Programming Basics for Logistics Algorithms:
Mini-project
1
2
HW5: Mini-project on Data Analysis
1. Download flight data for from the dataset alldelays.csv to access flight delays information provided by EUROCONTROL
2. Choose a research question from the list and clearly state it, add your group number in front of the corresponding questions
3. Extract the data you need for the corresponding airports/data periods from the dataset
4. Code the calculations to answer your research question
5. Illustrate the results using 2 different types of plots in Matlab
6. Send HW5 report to the examiner (Tatiana Polishchuk) in one email, containing:
3
Advanced File Operations
EUROCONTROL Performance Review Unit (PRU): ATFM arrival flight delays
Data covers:
Years 2016-2024 (not much data for the pandemics years 2020-2021)
All European airports
4
Mini-project
EUROCONTROL Performance Review Unit (PRU): ATFM arrival flight delays
5
Advanced File Operations
Example: extract data subset from a data file
% clear Workspace
clear; clear all
% load flight delay data into the array variable delay_data
delay_data = readtable('alldelays.csv');
6
Advanced File Operations
Example: extract data subset corresponding for Munich airport
% extract delay data for the particular airport of Munich
flight_data = delay_data(strcmp(delay_data.APT_ICAO, 'EDDM'), :);
% save the delay data for Munich airport in a separate data file
writetable(flight_data, 'munich.csv');
7
Advanced File Operations
EUROCONTROL Performance Review Unit (PRU): ATFM arrival flight delays
Query examples:
8
Advanced File Operations
Example: analyse the delays in Munich airport: code
% Clean the data to leave only the rows containing information about the delays
num_lines = size(flight_data,1)
count = 0;
for i=1:(num_lines-1)
if (flight_data.DLY_APT_ARR_1{i}>0)
count = count +1;
delay_data_munich(count,:) = flight_data(i,:);
end
end
writetable(delay_data_munich,'munich_delays.csv')
% now delay_data_clean contains only non-zero rows with delay information
% make calculations for the delays attributed to weather in Munich airport
9
Advanced File Operations
Example (cont.): analyse the delays in Munich airport code
% Calculate delays (in number of flights) Munich airport for all years
sum_delays = sum(delay_data_munich.FLT_APT_ARR_1)
% Calculate delays (in minutes) attributed to weather in Munich airport for all years
sum_weather_delays = sum(delay_data_munich.DLY_APT_ARR_W_1)
! Note: the data cells corresponding to minutes of delays is stored in “string” format in the delay datatable. This type is not appropriate for operation of summation!
There are 2 ways to resolve:
-use casting operation per cell in a loop applying str2double (it does not work for the whole column),
-or to make your life easy, open the datafile 'munich_delays.csv' (see previous slide) in Excel and format the corresponding column/cells to Number.
10
Plotting Figures
Example (cont.): analyse the delays in Munich airport code
%% Create a bar plot
figure;
bar([sum_delays, sum_weather_delays], 'FaceColor', [0.5 0.7 1]);
xticklabels({'Total Delays', 'Weather Delays'});
ylabel('Delay Minutes');
title('Munich Airport Delays');
grid on;
% Save figure
saveas(gcf, 'munich_delays_bar.png');
11
HW5: Mini-project on Data Analysis
12
HW5: Mini-project on Data Analysis
*Tips: There are many plotting functions available in Matlab. Try different types, not only the ones I’ve showed in the example.
Very useful type of plotting statistics is boxplot (see an example below, but note that it does not correspond to the delay dataset).
Boxplot: code