0001 function [A,V,log_text] = VMT_CompMeanXS(z,A,V)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 switch V.probeType
0017
0018
0019
0020 case 'M9'
0021
0022 x = [];
0023 y = [];
0024 East = [];
0025 North = [];
0026 Vert = [];
0027 Error = [];
0028 for zi = 1: z
0029
0030 Dir(:,:,zi) = A(zi).Comp.mcsDir(:,:);
0031 Bed(:,:,zi) = A(zi).Comp.mcsBed(:,:);
0032
0033 xx = meshgrid(A(zi).Comp.dl,A(zi).Wat.binDepth(:,1));
0034 x = [x; xx(:)];
0035 y = [y; A(zi).Wat.binDepth(:)];
0036 East = [East; A(zi).Wat.vEast(:)];
0037 North = [North; A(zi).Wat.vNorth(:)];
0038 Vert = [Vert; A(zi).Wat.vVert(:)];
0039 Error = [Error; A(zi).Wat.vError(:)];
0040 end
0041
0042
0043
0044 V.mcsEast = griddata(x,y,East,V.mcsDist,V.mcsDepth);
0045 V.mcsNorth = griddata(x,y,North,V.mcsDist,V.mcsDepth);
0046 V.mcsVert = griddata(x,y,Vert,V.mcsDist,V.mcsDepth);
0047 V.mcsError = griddata(x,y,Error,V.mcsDist,V.mcsDepth);
0048
0049 otherwise
0050 for zi = 1 : z
0051
0052 Back(:,:,zi) = A(zi).Comp.mcsBack(:,:);
0053 Dir(:,:,zi) = A(zi).Comp.mcsDir(:,:);
0054 Mag(:,:,zi) = A(zi).Comp.mcsMag(:,:);
0055 East(:,:,zi) = A(zi).Comp.mcsEast(:,:);
0056 North(:,:,zi) = A(zi).Comp.mcsNorth(:,:);
0057 Vert(:,:,zi) = A(zi).Comp.mcsVert(:,:);
0058 Error(:,:,zi) = A(zi).Comp.mcsError(:,:);
0059 Bed(:,:,zi) = A(zi).Comp.mcsBed(:,:);
0060
0061 end
0062
0063 numavg = nansum(~isnan(Mag),3);
0064 numavg(numavg==0) = NaN;
0065 enscnt = nanmean(numavg,1);
0066 [I,J] = ind2sub(size(enscnt),find(enscnt>=1));
0067
0068
0069 Backone= Back;
0070 Backone(~isnan(Back))=1;
0071 V.countBack = nansum(Backone,3);
0072 V.countBack(V.countBack==0)=NaN;
0073 V.mcsBack = nanmean(Back,3);
0074
0075
0076 Magone = Mag;
0077 Vertone = Vert;
0078 Bedone = Bed;
0079
0080
0081 Magone(~isnan(Mag))=1;
0082 Vertone(~isnan(Vert))=1;
0083 Bedone(~isnan(Bed))=1;
0084
0085
0086 V.countMag = nansum(Magone,3);
0087 V.countVert = nansum(Vertone,3);
0088 V.countBed = nansum(Bedone,3);
0089
0090 V.countMag(V.countMag==0)=NaN;
0091 V.countVert(V.countVert==0)=NaN;
0092 V.countBed(V.countBed==0)=NaN;
0093
0094
0095
0096
0097
0098
0099 V.mcsEast = nanmean(East,3);
0100 V.mcsNorth = nanmean(North,3);
0101 V.mcsVert = nanmean(Vert,3);
0102 V.mcsError = nanmean(Error,3);
0103
0104
0105
0106 end
0107
0108
0109 V.mcsMag = sqrt(V.mcsEast.^2 + V.mcsNorth.^2 + V.mcsVert.^2);
0110
0111
0112 V.mcsDir = ari2geodeg((atan2(V.mcsNorth, V.mcsEast))*180/pi);
0113
0114
0115
0116
0117
0118
0119 V.mcsBed = nanmean(Bed,3);
0120
0121
0122
0123
0124 log_text = [' WSE in meters) = ' num2str(mean(A(1).wse))];
0125 V.mcsBedElev = mean(A(1).wse) - V.mcsBed;
0126
0127
0128
0129 return
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160