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?
5011CEM/DisplayData.m
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
101 lines (80 sloc)
3.11 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
clc, clear, close all | |
%% Load data from csv file // looping | |
DataPath = '.\'; | |
AvailableFiles = dir((fullfile(DataPath, '*.csv'))); % list available data files | |
latitude_array = csvread('lat.csv'); | |
longitude_array = csvread('lon.csv'); | |
for idxFile = 1:24 | |
figure(1) | |
File2Read = AvailableFiles(idxFile).name; | |
ozone_array = csvread(File2Read); | |
hPlot = subplot(4,6,idxFile); | |
lat= latitude_array(1,:); | |
lon = longitude_array(:,1)'; | |
hPlot = hPlot.Position + [-0.02 -0.02 +0.02 +0.02]; | |
mesh(lat, lon, ozone_array); | |
colormap(jet) | |
sgtitle('Display of the raw data located in Europe over a mesh plot'); | |
end | |
%% 2 | |
for idxFile = 1:24 | |
figure(2) | |
File2Read = AvailableFiles(idxFile).name; | |
ozone_array = csvread(File2Read); | |
hPlot = subplot(4,6,idxFile); | |
hPlot = hPlot.Position + [-10 -10 +20 +20]; | |
[X,Y] = meshgrid(lat,lon); | |
% Create the map | |
worldmap('Europe'); % set the part of the earth to show | |
load coastlines | |
plotm(coastlat,coastlon) | |
land = shaperead('landareas', 'UseGeoCoords', true); | |
geoshow(gca, land, 'FaceColor', [0.5 0.7 0.5]) | |
lakes = shaperead('worldlakes', 'UseGeoCoords', true); | |
geoshow(lakes, 'FaceColor', 'blue') | |
rivers = shaperead('worldrivers', 'UseGeoCoords', true); | |
geoshow(rivers, 'Color', 'blue') | |
cities = shaperead('worldcities', 'UseGeoCoords', true); | |
geoshow(cities, 'Marker', '.', 'Color', 'red') | |
contourcbar | |
% Plot the data | |
surfm(lon, lat, ozone_array, 'EdgeColor', 'none',... | |
'FaceAlpha', 0.5) % edge colour outlines the edges, 'FaceAlpha', sets the transparency | |
colormap(jet) | |
sgtitle('Display the data located in Europe over a surface plot') | |
end | |
%% 3 | |
for idxFile = 1:24 | |
figure(3) | |
File2Read = AvailableFiles(idxFile).name; | |
ozone_array = csvread(File2Read); | |
hPlot = subplot(4,6,idxFile); | |
% create the map | |
worldmap('Europe'); % set the part of the earth to show | |
load coastlines | |
plotm(coastlat,coastlon,'k') | |
% zdatam(handlem('allline'),1000) | |
tightmap | |
land = shaperead('landareas', 'UseGeoCoords', true); | |
geoshow(gca, land, 'FaceColor', [0.5 0.7 0.5]) | |
lakes = shaperead('worldlakes', 'UseGeoCoords', true); | |
geoshow(lakes, 'FaceColor', 'blue') | |
rivers = shaperead('worldrivers', 'UseGeoCoords', true); | |
geoshow(rivers, 'Color', 'blue') | |
cities = shaperead('worldcities', 'UseGeoCoords', true); | |
geoshow(cities, 'Marker', '.', 'Color', 'red') | |
contourcbar | |
lat_figure3 = latitude_array(1, 1:5:698); | |
lon_figure3 = longitude_array(1:5:398, 1); | |
oz_figure3 = ozone_array(1:5:398, 1:5:698); | |
% display the data | |
NumContours = 10; | |
hPlot = hPlot.Position + [-10 -10 +20 +20]; | |
contourfm(lon_figure3, lat_figure3, oz_figure3, NumContours) | |
% This is a bit advanced, sets the visibility of the various parts of the | |
% plot so the land, cities etc shows through. | |
Plots = findobj(gca,'Type','Axes'); | |
Plots.SortMethod = 'depth'; | |
colormap(jet) | |
sgtitle('Display the data located in Europe over a contour plot') | |
end |