Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
5011BigData/FinalCode.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
73 lines (68 sloc)
2.21 KB
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
%%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 |