-
Notifications
You must be signed in to change notification settings - Fork 2
/
dg_SODA_data_compare.m
142 lines (124 loc) · 5.27 KB
/
dg_SODA_data_compare.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
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
133
134
135
136
137
138
139
140
141
142
% DG 2018-04-07
% this script compares the time series data for SODAcasts vs NEFSC CTD casts.
loadflag = 1
plotflag = 2
yind = [4:39];
if loadflag == 1
sodaflag = 0
dg_setup_MABclimate_dir
load([workdir 'MABclimate2DaSODA_nobiasDG']);
cccsoda = ccc;
load([workdir 'MABclimate2Da_nobiasDG']);
end %if
if plotflag == 1
for si = 1:3
for ri = 1:9
[si ri]
gtempind = find(~isnan(ccc.temp_nobias(yind,si,ri)));
gsaltind = find(~isnan(ccc.salt_nobias(yind,si,ri)));
rtemp = corrcoef(ccc.temp_nobias(yind(gtempind),si,ri),cccsoda.temp_nobias(yind(gtempind),si,ri));
rsalt = corrcoef(ccc.salt_nobias(yind(gsaltind),si,ri),cccsoda.salt_nobias(yind(gsaltind),si,ri));
f1 = figure;
set(gcf,'visible','off')
subplot(2,1,1)
hold on
plot(ccc.yyyy,ccc.temp_nobias(:,si,ri),'k');
plot(cccsoda.yyyy,cccsoda.temp_nobias(:,si,ri),'b-');
hold off
legend('CTD','SODA','location','southeast')
ht1 = title([region(ri).label ' Temperature for ' season(si).label ' R=' num2str(round(rtemp(1,2),2))]);
set(gca,'xgrid','on','ygrid','on')
subplot(2,1,2)
hold on
plot(ccc.yyyy,ccc.salt_nobias(:,si,ri),'k');
plot(cccsoda.yyyy,cccsoda.salt_nobias(:,si,ri),'b-');
hold off
legend('CTD','SODA','location','southeast')
ht2 = title([region(ri).label ' Salinity for ' season(si).label ' R=' num2str(round(rsalt(1,2),2))]);
set(gca,'xgrid','on','ygrid','on')
eval(['print -depsc -r200 ' figoutdir 'tempsaltSODAcompare_' region(ri).label '_' season(si).name '.eps']);
close(f1)
end %for ri
end %for si
elseif plotflag == 2
for ri = 1:9
rtemp = [];
rsalt = [];
for si = 1:3
gtempind = find(~isnan(ccc.temp_nobias(yind,si,ri)));
gsaltind = find(~isnan(ccc.salt_nobias(yind,si,ri)));
rtemp{si} = corrcoef(ccc.temp_nobias(yind(gtempind),si,ri),cccsoda.temp_nobias(yind(gtempind),si,ri));
rsalt{si} = corrcoef(ccc.salt_nobias(yind(gsaltind),si,ri),cccsoda.salt_nobias(yind(gsaltind),si,ri));
end %for
f1 = figure;
set(gcf,'visible','off')
subplot(3,2,1)
hold on
hp1 = plot(ccc.yyyy,ccc.temp_nobias(:,1,ri),'k');
hp2 = plot(cccsoda.yyyy,cccsoda.temp_nobias(:,1,ri),'k--');
set(hp1,'linewidth',1)
set(hp2,'linewidth',1)
hold off
set(gca,'box','on')
%legend('CTD','SODA','location','southeast')
ht1 = title([region(ri).label ' Temperature for ' season(1).label ' R=' num2str(round(rtemp{1}(1,2),2))]);
set(gca,'xgrid','on','ygrid','on')
subplot(3,2,2)
hold on
hp1 = plot(ccc.yyyy,ccc.salt_nobias(:,1,ri),'k');
hp2 = plot(cccsoda.yyyy,cccsoda.salt_nobias(:,1,ri),'k--');
set(hp1,'linewidth',1)
set(hp2,'linewidth',1)
hold off
set(gca,'box','on')
legend('CTD','SODA','location','southeast')
ht2 = title([region(ri).label ' Salinity for ' season(1).label ' R=' num2str(round(rsalt{1}(1,2),2))]);
set(gca,'xgrid','on','ygrid','on')
subplot(3,2,3)
hold on
hp1 = plot(ccc.yyyy,ccc.temp_nobias(:,2,ri),'k');
hp2 = plot(cccsoda.yyyy,cccsoda.temp_nobias(:,2,ri),'k--');
set(hp1,'linewidth',1)
set(hp2,'linewidth',1)
hold off
set(gca,'box','on')
%legend('CTD','SODA','location','southeast')
ht1 = title([region(ri).label ' Temperature for ' season(2).label ' R=' num2str(round(rtemp{2}(1,2),2))]);
set(gca,'xgrid','on','ygrid','on')
subplot(3,2,4)
hold on
hp1 = plot(ccc.yyyy,ccc.salt_nobias(:,2,ri),'k');
hp2 = plot(cccsoda.yyyy,cccsoda.salt_nobias(:,2,ri),'k--');
set(hp1,'linewidth',1)
set(hp2,'linewidth',1)
hold off
set(gca,'box','on')
%legend('CTD','SODA','location','southeast')
ht2 = title([region(ri).label ' Salinity for ' season(2).label ' R=' num2str(round(rsalt{2}(1,2),2))]);
set(gca,'xgrid','on','ygrid','on')
subplot(3,2,5)
hold on
hp1 = plot(ccc.yyyy,ccc.temp_nobias(:,3,ri),'k');
hp2 = plot(cccsoda.yyyy,cccsoda.temp_nobias(:,3,ri),'k--');
set(hp1,'linewidth',1)
set(hp2,'linewidth',1)
hold off
set(gca,'box','on')
%legend('CTD','SODA','location','southeast')
ht1 = title([region(ri).label ' Temperature for ' season(3).label ' R=' num2str(round(rtemp{3}(1,2),2))]);
set(gca,'xgrid','on','ygrid','on')
subplot(3,2,6)
hold on
hp1 = plot(ccc.yyyy,ccc.salt_nobias(:,3,ri),'k');
hp2 = plot(cccsoda.yyyy,cccsoda.salt_nobias(:,3,ri),'k--');
set(hp1,'linewidth',1)
set(hp2,'linewidth',1)
hold off
set(gca,'box','on')
%legend('CTD','SODA','location','southeast')
ht2 = title([region(ri).label ' Salinity for ' season(3).label ' R=' num2str(round(rsalt{3}(1,2),2))]);
set(gca,'xgrid','on','ygrid','on')
eval(['print -depsc -r300 ' figoutdir 'tempsaltSODAcompare6_' region(ri).label '.eps']);
close(f1)
end %for
end %if plotflag