From 663ba124cc1ceba48eeabd6d2863bd382a960b8c Mon Sep 17 00:00:00 2001 From: "Olalekan Busari (busario2)" Date: Wed, 22 Apr 2020 21:20:04 +0100 Subject: [PATCH] Add files via upload --- FinalCode.m | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 FinalCode.m diff --git a/FinalCode.m b/FinalCode.m new file mode 100644 index 0000000..aeca387 --- /dev/null +++ b/FinalCode.m @@ -0,0 +1,73 @@ +%%Open File and clear workspace +ncfile = 'o3_surface_20180701000000.nc'; +clc; + +%%Give user welcome message and declare options for maps +disp('Hello user, welcome to my map visualisation tool.') +disp('With this program, you can view an array of different ozone related maps.') +greet = input('To get started press the enter key') +disp('1 - Chimere Ozone Map of Europe') +disp('2 - Emep Ozone Map of Europe') +disp('3 - Ensemble Ozone Map of Europe') +disp('4 - Eurad Ozone Map of Europe') +disp('5 - Lotoseuros Ozone Map of Europe') +disp('6 - Match Ozone Map of Europe') +disp('7 - Mocage Ozone Map of Europe') +disp('8 - Silam Ozone Map of Europe') +map_choice = input('Which map would you like to view?') +if map_choice == 1 + picked_map = 'chimere_ozone' +elseif map_choice == 2 + picked_map = 'emep_ozone' +elseif map_choice == 3 + picked_map = 'ensemble_ozone' +elseif map_choice == 4 + picked_map = 'eurad_ozone' +elseif map_choice == 5 + picked_map = 'lotoseuros_ozone' +elseif map_choice == 6 + picked_map = 'match_ozone' +elseif map_choice == 7 + picked_map = 'mocage_ozone' +elseif map_choice == 8 + picked_map = 'silam_ozone' +end + +%%Extract key data from file to be able to process and display map +lon = ncread(ncfile,'lon'); +lat = ncread(ncfile,'lat'); +time = ncread(ncfile,'hour'); +chosen_ozone = ncread(ncfile,picked_map); +[X,Y] = meshgrid(lon,lat); + +%%Create GUI figure to hold map +figure('name','Ensemble Ozone Figure','NumberTitle','off'); +clf; + +%%Choose colours of the map +disp('Type 1 for YES and 0 for NO') +user_map_colour = input('Do you have trouble seeing colour?') +if user_map_colour == 0 + colormap default; +elseif user_map_colour == 1 + colormap bone; +else + colormap default; +end + +%%Loop runs over all the maps in the file and displays them +for k = 1 : length(time) + clf; + map = pcolor(X,Y,chosen_ozone(:,:,k)'); + map.EdgeAlpha = 0; + map.FaceAlpha = 0.7; + c = colorbar; + c.Label.String = 'Ozone Levels'; + load coast + cities = shaperead('worldcities', 'UseGeoCoords', true); + geoshow(cities, 'Marker', '.', 'Color', 'black') + hold on; + plot(long,lat,'k') + title(sprintf('Map plotting ensemble data')) + pause(0.1) +end \ No newline at end of file