diff --git a/BigData.m b/BigData.m index ea56d9e..5af056e 100644 --- a/BigData.m +++ b/BigData.m @@ -1,24 +1,18 @@ %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() -%close all function display() - ncfile = 'o3_surface_20180701000000.nc'; %contains all the 24 hours ozone models - Given on moodle + ncfile = 'o3_surface_20180701000000.nc'; %contains all the data - Given on moodle clc; - colorblind = 1; %bool value - choose = 1; %bool value - - program_exit = 0; - - while program_exit == 0 + choose = 1; %bool value - if (choose == 1) %% if statement for the menu. Menu allows the user to choose which ozone model they would like to view whilst also assigning their choice to title. - 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 (choose == 1) %% Create a Menu and Choose one of the models + typechoosen = menu('Which model would you like to see?', 'Chimere', 'Emep', 'Ensemble', 'Eurad','Lotoseuros','Match','Mocage','Silam', 'Exit'); %% options that are shown in the menu. if typechoosen == 1 showtype = ('chimere_ozone'); titlechoice = 'chimere_ozone'; @@ -43,64 +37,117 @@ function display() elseif typechoosen == 8 showtype = ('silam_ozone'); titlechoice = 'silam_ozone'; + elseif typechoosen ==9 + close all; end - choose = 0; + clc end - + clc; - 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) ; %% 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 140 100 30],'String','Exit','Callback',@(src,evnt)quit ); %Call the exit function if pressed + uicontrol( 'Position', [30 190 100 30],'String','Colour Blindness','Callback',@(src,evnt)colour_blindness); %Call the colour_blindness function if pressed + uicontrol( 'Position', [30 220 100 30],'String','Menu','Callback',@(src,evnt)menu_back); %Call the menu_back function if pressed + uicontrol( 'Position', [30 250 100 30],'String','Start/Restart','Callback',@(src,evnt)start); %Call the menu_back function if pressed + + + info = 1; + clc; + + + function start() for i = 1:timel %% loop to run the graphics and menus according with the time lenght - clf; + map = pcolor(X,Y,ozone_end(:,:,i)') ; %% set the data on the map. map.EdgeAlpha = 0; + ylabel('Longitude') xlabel('Latitude') - if (colorblind == 1) %Menu to choose the colorblindness option. - info = menu('Color Accessibility Options', 'Default', 'Protanopia','Deuteranopia','Tritanopia','Monochromacy'); - if info == 1 - colormap default; - 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 - colorblind = 0; - end - clc - cities = shaperead('worldcities', 'UseGeoCoords', true); %%shows cities + clc; + + cities = shaperead('worldcities', 'UseGeoCoords', true); %% shows cities geoshow(cities, 'Marker', 'O', 'Color', 'red') - lakes = shaperead('worldlakes', 'UseGeoCoords', true); %%shows lakes + lakes = shaperead('worldlakes', 'UseGeoCoords', true); %% shows lakes geoshow(lakes, 'FaceColor', 'blue') - rivers = shaperead('worldrivers', 'UseGeoCoords', true); %%shows rivers + 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; - hold on; - Choose = load('coast'); % loads the coast for the map. - plot(Choose.long,Choose.lat,'k') %plots the map - shading interp ; - title(sprintf('Hour: %f',time(i))) %% Show the hours above the map. - pause(0.01) %% Pause of 0.01 seconds but can change depends of the hardware. + pause(1) %% Pause of 1 seconds but can change depends of the hardware. + + end + end + function quit() + pause(1) + 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 + clc; + ozone_end = ncread(ncfile, showtype); % reads one specific model from the combined file depending on the user choice in the menu above. end - end end