Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
%The files required is in: o3_surface_20180701000000.nc
%Install Map Viewer
%Install Borders
%Colorblind Reference: https://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/30161/versions/4/screenshot.png
display()
function display()
ncfile = 'o3_surface_20180701000000.nc'; %contains all the data - Given on moodle
clc;
choose = 1; %bool value
if (choose == 1) %% Create a Menu and Choose one of the models
typechoosen = menu('Which model would you like to see?', 'Chimere Model', 'Emep Model', 'Ensemble Model', 'Eurad Model','Lotoseuros Model','Match Model','Mocage Model','Silam Model', 'Exit'); %% options that are shown in the menu.
if typechoosen == 1
showtype = ('chimere_ozone');
titlechoice = 'Chimere Figure';
elseif typechoosen == 2
showtype = ('emep_ozone');
titlechoice = 'Emep Figure';
elseif typechoosen == 3
showtype = ('ensemble_ozone');
titlechoice = 'Ensemble Figure';
elseif typechoosen == 4
showtype = ('eurad_ozone');
titlechoice = 'Eurad Figure';
elseif typechoosen == 5
showtype = ('lotoseuros_ozone');
titlechoice = 'Lotoseuros Figure';
elseif typechoosen == 6
showtype = ('match_ozone');
titlechoice = 'Match Figure';
elseif typechoosen == 7
showtype = ('mocage_ozone');
titlechoice = 'Mocage Figure';
elseif typechoosen == 8
showtype = ('silam_ozone');
titlechoice = 'Silam Figure';
elseif typechoosen ==9
close all;
end
clc;
end
clc;
if typechoosen ~=9 %% advance if the choosen one is other than the 9
ozone_end = ncread(ncfile, showtype); % reads one specific model from the combined file depending on the user choice in the menu above.
longitude = ncread(ncfile,'lon'); %% longitude variable
latitude = ncread(ncfile,'lat'); %% latitude variable
time = ncread(ncfile,'hour'); %% time variable
timel = length(time)*10 ; %% length of the time variable
clc;
[X,Y] = meshgrid(longitude,latitude) ;
figure('Name', titlechoice,'NumberTitle','off'); %%formats the figure info shown
set(gcf, 'Position', get(0, 'Screensize')); %% fullscreen
clf;
uicontrol( 'Position', [30 110 180 40],'String','Exit','Callback',@(src,evnt)quit ); %Call the exit function if pressed
uicontrol( 'Position', [30 160 180 40],'String','Colour Blindness','Callback',@(src,evnt)colour_blindness); %Call the colour_blindness function if pressed
uicontrol( 'Position', [30 200 180 40],'String','Menu','Callback',@(src,evnt)menu_back); %Call the menu_back function if pressed
uicontrol( 'Position', [30 290 180 40],'String','Start/Restart','Callback',@(src,evnt)start); %Call the menu_back function if pressed
uicontrol( 'Position', [30 250 88 40],'String','Resume','Callback',@(src,evnt)resume); %Call the menu_back function if pressed
uicontrol( 'Position', [122 250 88 40],'String','Pause','Callback',@(src,evnt)wait); %Call the menu_back function if pressed
info = 1;
clc;
end
function start()
for i = 1:timel %% loop to run the graphics and menus according with the time lenght
map = pcolor(X,Y,ozone_end(:,:,i)') ; %% set the data on the map.
map.EdgeAlpha = 0;
ylabel('Longitude')
xlabel('Latitude')
clc;
cities = shaperead('worldcities', 'UseGeoCoords', true); %% shows cities
geoshow(cities, 'Marker', 'O', 'Color', 'red')
lakes = shaperead('worldlakes', 'UseGeoCoords', true); %% shows lakes
geoshow(lakes, 'FaceColor', 'blue')
rivers = shaperead('worldrivers', 'UseGeoCoords', true); %% shows rivers
geoshow(rivers, 'Color', 'blue')
borders('countries','black') %% shows all the borders
clc;
choose = colorbar; % Colorbar that shows the Ozone level
choose.Label.String = 'Ozone Levels';
hold on
title(sprintf('Hour: %d',time(i))) %% Show the hours above the map.
clc;
pause(0.5)
end
end
function wait()
uiwait()
end
function resume()
uiresume()
end
function quit()
close all % Closes all windows
end
function colour_blindness() %% Menu to the color accessibility options
info = menu('Color Accessibility Options', 'Default', 'Protanopia','Deuteranopia','Tritanopia','Monochromacy');
if info == 1
colormap default; %%default colors
elseif info == 2
colormap winter; %%Protanopia colors.
elseif info == 3
colormap cool; %%Deuteranopia colors.
elseif info == 4
colormap copper; %%Tritanopia colors.
elseif info == 5
colormap bone; %%Greyscale
end
clc;
end
function menu_back() %% Menu to change the model
typechoosen = menu('Which model would you like to see?', 'Chimere', 'Emep', 'Ensemble', 'Eurad','Lotoseuros','Match','Mocage','Silam'); %% options that are shown in the menu.
if typechoosen == 1
showtype = ('chimere_ozone');
titlechoice = 'chimere_ozone';
elseif typechoosen == 2
showtype = ('emep_ozone');
titlechoice = 'emep_ozone';
elseif typechoosen == 3
showtype = ('ensemble_ozone');
titlechoice = 'ensemble_ozone';
elseif typechoosen == 4
showtype = ('eurad_ozone');
titlechoice = 'eurad_ozone';
elseif typechoosen == 5
showtype = ('lotoseuros_ozone');
titlechoice = 'lotoseuros_ozone';
elseif typechoosen == 6
showtype = ('match_ozone');
titlechoice = 'match_ozone';
elseif typechoosen == 7
showtype = ('mocage_ozone');
titlechoice = 'mocage_ozone';
elseif typechoosen == 8
showtype = ('silam_ozone');
titlechoice = 'silam_ozone';
end
ozone_end = ncread(ncfile, showtype); % reads one specific model from the combined file depending on the user choice in the menu above.
end
end