diff --git a/BigData.m b/BigData.m index ce81111..ea56d9e 100644 --- a/BigData.m +++ b/BigData.m @@ -1,9 +1,23 @@ -ncfile = 'o3_surface_20180701000000.nc'; +%The files required is in: o3_surface_20180701000000.nc +%Install Map Viewer +%Colorblind Reference: https://www.mathworks.com/matlabcentral/mlc-downloads/downloads/submissions/30161/versions/4/screenshot.png -colorblind = 1; -choose = 1; +display() +%close all -if (choose == 1) +function display() + ncfile = 'o3_surface_20180701000000.nc'; %contains all the 24 hours ozone models - Given on moodle + + clc; + colorblind = 1; %bool value + choose = 1; %bool value + + program_exit = 0; + + + while program_exit == 0 + + 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 typechoosen == 1 showtype = ('chimere_ozone'); @@ -35,62 +49,58 @@ clc; -ozone_end = ncread(ncfile, showtype);. - longitude = ncread(ncfile,'lon'); - latitude = ncread(ncfile,'lat'); - time = ncread(ncfile,'hour'); - timel = length(time) ; - + 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 + [X,Y] = meshgrid(longitude,latitude) ; - figure('Name', titlechoice,'NumberTitle','off'); - set(gcf, 'Position', get(0, 'Screensize')); + figure('Name', titlechoice,'NumberTitle','off'); %%formats the figure info shown + set(gcf, 'Position', get(0, 'Screensize')); %% fullscreen clf; - for i = 1:timel + for i = 1:timel %% loop to run the graphics and menus according with the time lenght clf; - map = pcolor(X,Y,ozone_end(:,:,i)') ; + 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); - geoshow(cities, 'Marker', 'O', 'Color', 'red') + 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 + geoshow(cities, 'Marker', 'O', 'Color', 'red') - lakes = shaperead('worldlakes', 'UseGeoCoords', true); - geoshow(lakes, 'FaceColor', 'blue') + lakes = shaperead('worldlakes', 'UseGeoCoords', true); %%shows lakes + geoshow(lakes, 'FaceColor', 'blue') - rivers = shaperead('worldrivers', 'UseGeoCoords', true); - geoshow(rivers, 'Color', 'blue') + rivers = shaperead('worldrivers', 'UseGeoCoords', true); %%shows rivers + geoshow(rivers, 'Color', 'blue') - choose = colorbar; - choose.Label.String = 'Ozone Levels'; - - hold on; - Choose = load('coast'); - plot(Choose.long,Choose.lat,'k') + choose = colorbar; % Colorbar that shows the Ozone level + choose.Label.String = 'Ozone Levels'; + + 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))) - pause(0.01) + 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. end end end - end - end -