-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathSignature_RawData_ENU.m
132 lines (105 loc) · 3.55 KB
/
Signature_RawData_ENU.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
% Maricarmen Guerra Paris
% Open .mat files created with MIDAS Software from Nortek Signature 5 beam
% Transforms to ENU and XYZ velocities
% Save new files containing beam, ENU and XYZ velocities.
% % Save as: '/SS04_Sig_May2015_ENU_00000_' int2str(fnumber) '.mat'];
% Repeat for all MIDAS files
% Plots raw data
% May 30 2018 Note:
% Check if you have the new format
% ENU transformation might not work, because some variables from Data and
% Config structures are not available anymore
% Juluy 2019
% Info missing on Config is related to beam angles:
% Config.BeamCfg1_theta=25;
% Config.BeamCfg2_theta=25;
% Config.BeamCfg3_theta=25;
% Config.BeamCfg4_theta=25;
%
%
% Config.BeamCfg1_phi=0;
% Config.BeamCfg2_phi=-90;
% Config.BeamCfg3_phi=180;
% Config.BeamCfg4_phi=90;
%
% Config.BeamCfg5_theta=0;
% Config.BeamCfg5_phi=0;
% If you use Deployment software to create .mat files, ENU velocities might
% already be available, thus there is no need to convert them.
% Alternatively, you can create your own Beam to ENU script, using the
% rotation matrix information on .mat files.
% Note this ENU transformation does not include magnetic declination
% Hence, ENU velocities are with respect to magnetic north
clear all, close all, clc
% Raw data files:
fpath = '/Users/Maru/Documents/PhD_UW/AdmiraltyInlet/SignatureMay2015'; % File location
fnumber=2; %Number of files
fname = ['SS04_Sig_May2015.ad2cp.133.15.AD2CPRaw.00000_' int2str(fnumber) '.mat']; %Sequential name
% Save Files
prefix = ['SS04_Sig_May2015_ENU_00000_']; %where to save the files
savepath = ['/Users/Maru/Documents/PhD_UW/5BeamCodes/RawData']; %Sequential name of files
%% Raw Data
load([ fpath '/' fname ])
% figure(1), clf
%
% for i = 1:4,
%
% ax(i) = subplot(5,1,i);
% set(gca,'FontSize',16)
% pcolor(Data.Burst_MatlabTimeStamp-datenum(2015,0,0), double(Data.Burst_Range), double(eval(['Data.Burst_VelBeam' num2str(i)]))' ),
% shading flat,
% datetick
% set(gca,'YDir','reverse')
% ylabel(['Vel Beam ' num2str(i)])
% caxis([-2 2])
% colorbar,
%
%
% end
%
% ax(5) = subplot(5,1,5);
% set(gca,'FontSize',16)
% pcolor(Data.IBurst_MatlabTimeStamp-datenum(2015,0,0), double(Data.IBurst_Range), double(Data.IBurst_VelBeam5)' ),
% shading flat,
% datetick
% set(gca,'YDir','reverse')
% ylabel(['Vel Beam 5'])
% caxis([-2 2])
% colorbar,
%
% linkaxes(ax,'x')
%% Convert to ENU coordinates
[ Data2, Config2, T_beam2xyz ]=signatureAD2CP_beam2xyz_enu(Data,Config,'burst')
% Save data with ENU coordinates
savefile=[savepath '/' prefix int2str(fnumber) '.mat'];
save(savefile, '-mat', 'Data2');
%% ENU Data
figure(2), clf
ax(1) = subplot(3,1,1);
pcolor(Data2.Burst_MatlabTimeStamp-datenum(2014,0,0), double(Data2.Burst_Range), double(Data2.Burst_VelX)' ),
shading flat,
datetick
set(gca,'YDir','reverse')
ylabel(['Vel X'])
caxis([-3 3])
colorbar,
ax(2) = subplot(3,1,2);
pcolor(Data2.Burst_MatlabTimeStamp-datenum(2014,0,0), double(Data2.Burst_Range), double(Data2.Burst_VelY)' ),
shading flat,
datetick
set(gca,'YDir','reverse')
ylabel(['Vel Y'])
caxis([-3 3])
colorbar,
ax(3) = subplot(3,1,3);
pcolor(Data2.Burst_MatlabTimeStamp-datenum(2014,0,0), double(Data2.Burst_Range), double(Data2.Burst_VelZ)' ),
shading flat,
datetick
set(gca,'YDir','reverse')
ylabel(['Vel Z'])
caxis([-2 2])
colorbar,
linkaxes(ax,'x')
%% Battery life
figure(3)
plot(Data.Burst_MatlabTimeStamp-datenum(2014,0,0),Data.Burst_Battery)