From de5f249e39d25c8fec5719c815c0074533bbc035 Mon Sep 17 00:00:00 2001 From: "Abdul-Hadi Amer (amera3)" Date: Mon, 3 Aug 2020 05:02:40 +0100 Subject: [PATCH] Uploading final work for assignment submission --- Untitled3.m | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 Untitled3.m diff --git a/Untitled3.m b/Untitled3.m new file mode 100644 index 0000000..ed8b1be --- /dev/null +++ b/Untitled3.m @@ -0,0 +1,71 @@ +%%Open nc file which is used to extract the date +ncfile = 'o3_surface_20180701000000.nc'; +clc; + +%%Welcome message +disp('Hi, welcome to my ensemble visualization program') +x = input('Press any key to move to the next page') +clc; +disp('This program allows you to view the ozone layer on different map models in a european map') +disp('This program has accessiblity support for colour blind users') +colorblind = input("if you're colourblind please enter 1, if not enter 0 .."); +clc; +%%This section of code let's the user pick which ozone model they want to +%%use +disp('Pick 1 of the 3 ozone map models') +disp('1: Match Ozone map model') +disp('2: Mocage Ozone map model') +disp('3: Emep Ozone map model') +MenuMapChoice = input('Enter the map model number you want to use') +if MenuMapChoice == 1 + ozoneModel = 'match_ozone' + clc; + disp('Match Ozone map model will be used to display the ozone effect') + pause(2) +elseif MenuMapChoice == 2 + ozoneModel = 'mocage_ozone' + clc; + disp('Mocage Ozone map model will be used to display the ozone effect') + pause(2) +elseif MenuMapChoice == 3 + ozoneModel = 'emep_ozone' + clc; + disp('Emep Ozone map model will be used to display the ozone effect') + pause(2) +end + +disp('Extracting map data ...') +%%Extract data from the nc file to create the ensemble +lon = ncread(ncfile,'lon'); +lat = ncread(ncfile,'lat'); +time = ncread(ncfile,'hour'); +SelectedOzone = ncread(ncfile,ozoneModel); %%this extracts the user selected Ozone model +[X,Y] = meshgrid(lon,lat); +clc; + +%%adjusting the colourscheme of the map for colourblindness +if colorblind == 0 + colormap default +elseif colorblind == 1 + colormap gray + disp("Now the map has a greyscale colour theme") +end + +disp('The map in the figure will load shortly ..') +%%Loops over the hours and shows the ozone layer for that hour +for k = 1 : length(time) + clf; %%clear figure window + matrix = pcolor(X,Y,SelectedOzone(:,:,k)'); + matrix.EdgeAlpha = 0; + matrix.FaceAlpha = 0.8; + load coast %%loads the coastlines on map + cities = shaperead('worldcities', 'UseGeoCoords', true);%%loads the cities + bar = colorbar; %%creating the colour bar on the side which indicates the ozone levels + bar.Label.String = 'Ozone Level'; + geoshow(cities, 'Marker', '+', 'Color', 'red') %%shows the cities on the map + hold on; + plot(long,lat,'k') + title(sprintf('Ensemble Data on Europe')) + annotation('textbox' , [0.2, 0.2, 0.5, 0], 'string', "Major European cities outlined by '+' symbol", 'EdgeColor','none') + pause(0.1) +end \ No newline at end of file