-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathICONverterData.m
executable file
·42 lines (29 loc) · 994 Bytes
/
ICONverterData.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
function ICONverterData(dataSelected)
clc;
disp(dataSelected);
disp('Finding data index for cells from ICON grid:');
Data= ncread('icon_ocean.nc',dataSelected);
Data = mean(Data,2);
Data = getNormalizedData(Data);
for m = 1: 10
disp([' - data is being identified for diamond ',num2str(m)]);
theIndex = importdata(['cells/triangleCellsOfDiamond',num2str(m),'.mat']);
theData = getData(theIndex, Data);
save(['data/dataOneOfDiamond',num2str(m),'.mat'],'theData');
end
end
function theData = getData(theIndex, Data)
theData = [];
for i = 1:length(theIndex)
ind = theIndex(i);
tempData = Data(ind);
theData = [theData, tempData];
end
end
function normalizedData = getNormalizedData(Data)
A = max(Data);
B = min(Data);
a = 0;
b = 1;
normalizedData = a+((Data - A).*(b-a))./(B - A);
end