0001 function A = parseSonTekVMT(fullName)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 load (fullName)
0017
0018 if strcmpi(Setup.velocityReference, 'System')
0019 errordlg({'VMT does not support Beam Coordinates.';
0020 '';
0021 'Re-export mat-file in RiverSurveyorLive';
0022 'using BT, GGA, or VTG velocity reference'},'Velocity Reference Error');
0023 error('parseSonTekVMT: VMT does not support Beam Coordinates.')
0024 end
0025
0026
0027
0028
0029 is_in_eng_units = isfield(Summary,'Depth_ft');
0030 is_in_si_units = isfield(Summary,'Depth_m');
0031 if is_in_eng_units || is_in_si_units
0032 [...
0033 BottomTrack,...
0034 GPS,...
0035 Processing,...
0036 RawGPSData,...
0037 Setup,...
0038 Summary,...
0039 System,...
0040 Transformation_Matrices,...
0041 WaterTrack,...
0042 ] = fixOldMatFiles(...
0043 BottomTrack,...
0044 GPS,...
0045 Processing,...
0046 RawGPSData,...
0047 Setup,...
0048 Summary,...
0049 System,...
0050 Transformation_Matrices,...
0051 WaterTrack);
0052 end
0053
0054
0055
0056 [Sup,Wat,Nav,Sensor,Q] = initStructures(...
0057 BottomTrack,...
0058 GPS,...
0059 Processing,...
0060 RawGPSData,...
0061 Setup,...
0062 Summary,...
0063 System,...
0064 Transformation_Matrices,...
0065 WaterTrack);
0066
0067
0068
0069
0070
0071
0072
0073 if strcmpi(Summary.Units.Depth,'ft')
0074 cf = 1./3.281;
0075 System.Temperature = (System.Temperature-32)*5/9;
0076 else
0077 cf = 1;
0078 cf2 = 1;
0079 end
0080
0081
0082 idx = find(System.Step==3);
0083
0084
0085 Sup.nBins = size(WaterTrack.Velocity,1);
0086 Sup.binSize_cm = repmat(System.Cell_Size(idx)'.*100.*cf,Sup.nBins,1);
0087 Sup.bins = repmat(Sup.nBins,size(idx));
0088 Sup.blank_cm = Setup.screeningDistance.*100.*cf;
0089 Sup.draft_cm = Setup.sensorDepth.*100.*cf;
0090 Sup.noe = length(idx);
0091 switch Setup.velocityReference
0092 case 0
0093 Sup.vRef = 'System';
0094 case 1
0095 Sup.vRef = 'BT';
0096 case 2
0097 Sup.vRef = 'GGA';
0098 case 3
0099 Sup.vRef = 'VTG';
0100 end
0101 Sup.units = repmat('cm',Sup.noe,1);
0102 Sup.timeElapsed_sec = [0; cumsum(diff(System.Time(idx)))];
0103 Sup.ensNo = idx;
0104
0105
0106
0107 top_of_cells = System.Cell_Start(idx).*cf.*100;
0108 Wat.binDepth =...
0109 ((repmat((1:Sup.nBins)',1,Sup.noe)-0.5).*...
0110 Sup.binSize_cm+repmat(top_of_cells',Sup.nBins,1))/100;
0111 Wat.vEast =...
0112 squeeze(WaterTrack.Velocity(:,1,idx)).*cf.*100;
0113 Wat.vNorth =...
0114 squeeze(WaterTrack.Velocity(:,2,idx)).*cf.*100;
0115 Wat.vVert =...
0116 squeeze(WaterTrack.Velocity(:,3,idx)).*cf.*100;
0117 Wat.vError =...
0118 squeeze(WaterTrack.Vel_StdDev(:,4,idx)).*cf.*100;
0119 Wat.vMag =...
0120 sqrt(Wat.vEast.^2 + Wat.vNorth.^2 + Wat.vVert.^2).*100;
0121 Wat.vDir =...
0122 ari2geodeg(atan2(Wat.vNorth,Wat.vEast).*180/pi);
0123
0124
0125 Nav.bvEast = Summary.Boat_Vel(idx,1).*cf.*100;
0126 Nav.bvNorth = Summary.Boat_Vel(idx,2).*cf.*100;
0127 Nav.bvVert = Summary.Boat_Vel(idx,3).*cf.*100;
0128 Nav.depth = BottomTrack.BT_Beam_Depth(idx,:).*cf;
0129 Nav.dsDepth = BottomTrack.VB_Depth(idx).*cf;
0130 Nav.altitude = GPS.Altitude(idx).*cf;
0131 Nav.altitudeChng = [0; diff(Nav.altitude)];
0132 Nav.lat_deg = GPS.Latitude(idx);
0133 Nav.long_deg = GPS.Longitude(idx);
0134 Nav.nSats = GPS.Satellites(idx);
0135 Nav.hdop = GPS.HDOP(idx);
0136 Nav.totDistEast = Summary.Track(idx,1).*cf;
0137 Nav.totDistNorth = Summary.Track(idx,2).*cf;
0138 Nav.length = ...
0139 hypot(...
0140 Nav.totDistNorth-Nav.totDistNorth(1),...
0141 Nav.totDistEast-Nav.totDistEast(1));
0142
0143
0144
0145
0146 if exist('Compas','var')
0147 Sensor.pitch_deg = Compas.Pitch(idx);
0148 Sensor.roll_deg = Compas.Roll(idx);
0149 Sensor.heading_deg = System.Heading(idx);
0150 Sensor.temp_degC = System.Temperature(idx);
0151 else
0152 Sensor.pitch_deg = System.Pitch(idx);
0153 Sensor.roll_deg = System.Roll(idx);
0154 Sensor.heading_deg = System.Heading(idx);
0155 Sensor.temp_degC = System.Temperature(idx);
0156 end
0157
0158 Q.startDist = repmat(Setup.Edges_0__DistanceToBank.*cf,Sup.noe,1);
0159 Q.endDist = repmat(Setup.Edges_1__DistanceToBank.*cf,Sup.noe,1);
0160 Q.bot = Summary.Bottom_Q(idx).*cf.^3;
0161 Q.top = Summary.Top_Q(idx).*cf.^3;
0162 switch Setup.startEdge
0163 case 0
0164 Q.start = Summary.Left_Q.*cf.^3;
0165 Q.end = Summary.Right_Q.*cf.^3;
0166 case 1
0167 Q.start = Summary.Right_Q.*cf.^3;
0168 Q.end = Summary.Left_Q.*cf.^3;
0169 end
0170 Q.meas = Summary.Middle_Q.*cf.^3;
0171
0172
0173 A.Sup = Sup;
0174 A.Wat = Wat;
0175 A.Nav = Nav;
0176 A.Sensor = Sensor;
0177 A.Q = Q;
0178
0179
0180
0181
0182
0183 function varargout = fixOldMatFiles(varargin)
0184 disp('fixOldMatFiles is not implemented yet, use RSL v1.5 or greater.')
0185
0186
0187
0188
0189
0190
0191
0192 function [Sup,Wat,Nav,Sensor,Q] = initStructures(varargin)
0193 BottomTrack = varargin{1};
0194 GPS = varargin{2};
0195 Processing = varargin{3};
0196 RawGPSData = varargin{4};
0197 Setup = varargin{5};
0198 Summary = varargin{6};
0199 System = varargin{7};
0200 Transformation_Matrices = varargin{8};
0201 WaterTrack = varargin{9};
0202
0203 idx = find(System.Step==3);
0204 noe = length(idx);
0205 bins = size(WaterTrack.Velocity,1);
0206
0207
0208 Sup=struct( 'absorption_dbpm',nan(noe,1),...
0209 'bins',repmat(bins,noe,1),...
0210 'binSize_cm',nan(noe,1),...
0211 'nBins',nan(1),...
0212 'blank_cm',nan(1),...
0213 'draft_cm',nan(1),...
0214 'ensNo',nan(noe,1),...
0215 'nPings',nan(1),...
0216 'noEnsInSeg',nan(noe,1),...
0217 'noe',nan(1),...
0218 'note1',blanks(80),...
0219 'note2',blanks(80),...
0220 'intScaleFact_dbpcnt',nan(noe,1),...
0221 'intUnits',repmat(blanks(5),noe,1),...
0222 'vRef',repmat(blanks(4),noe,1),...
0223 'wm',nan(1),...
0224 'units',repmat(blanks(2),noe,1),...
0225 'year',nan(noe,1),...
0226 'month',nan(noe,1),...
0227 'day',nan(noe,1),...
0228 'hour',nan(noe,1),...
0229 'minute',nan(noe,1),...
0230 'second',nan(noe,1),...
0231 'sec100',nan(noe,1),...
0232 'timeElapsed_sec',nan(noe,1),...
0233 'timeDelta_sec100',nan(1));
0234
0235 Wat=struct( 'binDepth',nan(bins,noe),...
0236 'backscatter',nan(bins,noe,4),...
0237 'vDir',nan(bins,noe),...
0238 'vMag',nan(bins,noe),...
0239 'vEast',nan(bins,noe),...
0240 'vError',nan(bins,noe),...
0241 'vNorth',nan(bins,noe),...
0242 'vVert',nan(bins,noe),...
0243 'percentGood',nan(bins,noe));
0244
0245 Nav=struct( 'bvEast',nan(noe,1),...
0246 'bvError',nan(noe,1),...
0247 'bvNorth',nan(noe,1),...
0248 'bvVert',nan(noe,1),...
0249 'depth',nan(noe,4),...
0250 'dsDepth',nan(noe,1),...
0251 'dmg',nan(noe,1),...
0252 'length',nan(noe,1),...
0253 'totDistEast',nan(noe,1),...
0254 'totDistNorth',nan(noe,1),...
0255 'altitude',nan(noe,1),...
0256 'altitudeChng',nan(noe,1),...
0257 'gpsTotDist',nan(noe,1),...
0258 'gpsVariable',nan(noe,1),...
0259 'gpsVeast',nan(noe,1),...
0260 'gpsVnorth',nan(noe,1),...
0261 'lat_deg',nan(noe,1),...
0262 'long_deg',nan(noe,1),...
0263 'nSats',nan(noe,1),...
0264 'hdop',nan(noe,1));
0265
0266 Sensor=struct( 'pitch_deg',nan(noe,1),...
0267 'roll_deg',nan(noe,1),...
0268 'heading_deg',nan(noe,1),...
0269 'temp_degC',nan(noe,1));
0270
0271 Q=struct( 'endDepth',nan(noe,1),...
0272 'endDist',nan(noe,1),...
0273 'bot',nan(noe,1),...
0274 'end',nan(noe,1),...
0275 'meas',nan(noe,1),...
0276 'start',nan(noe,1),...
0277 'top',nan(noe,1),...
0278 'unit',nan(bins,noe),...
0279 'startDepth',nan(noe,1),...
0280 'startDist',nan(noe,1));
0281
0282 Sup.noe = noe;
0283
0284
0285
0286
0287
0288
0289
0290
0291
0292
0293
0294
0295
0296
0297
0298
0299
0300
0301
0302
0303
0304
0305
0306
0307
0308
0309
0310
0311
0312
0313
0314
0315
0316
0317
0318
0319
0320
0321
0322
0323
0324
0325
0326
0327
0328
0329
0330
0331
0332
0333
0334
0335
0336
0337
0338
0339
0340
0341
0342
0343
0344
0345
0346
0347
0348
0349
0350
0351