FSTD.m
3.9 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
function FSTD
evalin('base','clear all')
evalin('base','close all')
[filename,filepath]= uigetfile('*.*','All files');
path=[filepath,'/',filename];
x=ncread(path,'x_axis');
t=ncread(path,'time');
om=ncread(path,'omega');
spectre=ncread(path,'Spectrum');
Dave=ncread(path,'Dave');
FSD=ncread(path,'Floe size distribution');
Fsize=ncread(path,'floe size');
thick=ncread(path,'Ice thickness');
conc=ncread(path,'Ice concentration');
Hs=ncread(path,'significant height');
IDT=ncread(path,'Ice Thickness Distribution');
hcat=ncread(path,'thickness categories');
dx=(x(2)-x(1))*1000;
assignin('base','x',x)
assignin('base','FSD',FSD)
assignin('base','IDT',IDT)
assignin('base','Fsize',Fsize)
assignin('base','hcat',hcat)
assignin('base','dx',dx)
fig=figure('Name','Floe size and Thickness distribution','position',[200 200 1200 1000],'Numbertitle','off');
set(fig,'color',[0.2 0.2 0.2])
cmap=coolcolor;
assignin('base','cmap',cmap)
plot1=subplot(2,2,3:4);
[hAx,hLine1,hLine2] =plotyy(x,thick,x,Dave);
set(hAx,'color','none')
set(hAx(1),'ycolor','b')
set(hAx(2),'ycolor','g')
set(hLine1,'linewidth',2,'color','b')
set(hLine2,'linewidth',2,'color','g')
h2=gca;
assignin('base','h2',h2)
axesPosition=get(h2,'Position');
ylabel(hAx(2),'Mean Floe size [m]','interpreter','latex');
ylabel(hAx(1),'Mean Ice thickness [m]','interpreter','latex');
xlabel('Distance [km]','interpreter','latex');
hold on
xLimit = [min(x) max(x)];
yWidth = 0.05;
xOffset = -yWidth*diff(xLimit)/axesPosition(3);
h1 = axes('Position',axesPosition+yWidth.*[-1 0 1 0],...
'Color','none','XColor','k','YColor','r',...
'XLim',xLimit+[xOffset 0],...
'XTick',[],'XTickLabel',[],'NextPlot','add');
plot(h1,x,Hs(find(Hs>0)),'r','linewidth',2);
assignin('base','h1',h1)
ylabel('Significant height [m]','interpreter','latex');
hold on
curs=datacursormode(fig);
set(curs,'enable','on');
set(curs,'UpdateFcn', @plotother)
function txt = plotother(~,event)
x=evalin('base','x');
dx=evalin('base','dx');
h1=evalin('base','h1');
IDT=evalin('base','IDT');
FSD=evalin('base','FSD');
Fsize=evalin('base','Fsize');
hcat=evalin('base','hcat');
cmap=evalin('base','cmap');
pos = get(event,'Position');
txt = {['',num2str(pos(1))]};
[~,posx]=min(abs(x-pos(1)));
if (gca==h1)
ise = evalin( 'base', 'exist(''linex'') == 1' );
if ise
evalin('base', 'set(linex,''visible'',''off'')')
end
FSD1=reshape(FSD(posx,posx,:,:),length(Fsize),length(hcat));
IDT1=IDT(posx,:);
for i=1:length(hcat)
FSD1(:,i)=FSD1(:,i)*IDT1(i);
nfloe(:,i)=((FSD1(:,i)*(dx)^2)./Fsize.^2) ;
end
nfloe=nfloe/sum(sum(nfloe));
subplot(2,2,1)
title('FSTD')
colormap(cmap)
pcolor(hcat,Fsize,nfloe);
shading interp
c=colorbar;
xlabel('Floe thickness [m]','interpreter','latex')
ylabel('Floe size','interpreter','latex')
ylabel(c,'normalized number of floes','interpreter','latex')
subplot(2,2,2)
title('FSD')
FSD2(posx,:)=sum(FSD1,2);
nfloe2=((sum(FSD1,2)*dx^2)./Fsize.^2)/sum((sum(FSD1,2)*dx^2)./Fsize.^2);
plot(Fsize,nfloe2,'linewidth',2,'color','m')
set(gca,'color','none')
xlabel('Floe size [m]','interpreter','latex')
ylabel('normalized number of floes','interpreter','latex')
grid on
get(h1,'ylim')
linex=plot(h1,[pos(1) pos(1)],get(h1,'ylim'),'linewidth',1.5,'color',[0.2 0.2 0.6],'linestyle','--');
assignin('base','linex',linex)
end
end
end