Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
71
Untitled3.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |