0001 function varargout = VMT_GraphicsControl(varargin)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 gui_Singleton = 1;
0016 gui_State = struct('gui_Name', mfilename, ...
0017 'gui_Singleton', gui_Singleton, ...
0018 'gui_OpeningFcn', @VMT_GraphicsControl_OpeningFcn, ...
0019 'gui_OutputFcn', @VMT_GraphicsControl_OutputFcn, ...
0020 'gui_LayoutFcn', [] , ...
0021 'gui_Callback', []);
0022 if nargin && ischar(varargin{1})
0023 gui_State.gui_Callback = str2func(varargin{1});
0024 end
0025
0026 if nargout
0027 [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
0028 else
0029 gui_mainfcn(gui_State, varargin{:});
0030 end
0031
0032
0033
0034
0035 function VMT_GraphicsControl_OpeningFcn(hObject, eventdata, handles, varargin)
0036
0037
0038
0039
0040
0041
0042
0043 handles.output = hObject;
0044
0045
0046 guidata(hObject, handles);
0047
0048
0049
0050 guiparams = createGUIparams;
0051
0052
0053
0054 setappdata(handles.figure1,'guiparams',guiparams)
0055
0056
0057
0058 load_prefs(handles.figure1)
0059
0060
0061
0062 initGUI(handles)
0063
0064
0065
0066
0067
0068
0069
0070
0071
0072 function varargout = VMT_GraphicsControl_OutputFcn(hObject, eventdata, handles)
0073
0074
0075
0076
0077
0078
0079 varargout{1} = handles.output;
0080
0081
0082
0083 function UseDataLimitsPlanview_Callback(hObject, eventdata, handles)
0084
0085
0086
0087 guiparams = getappdata(handles.figure1,'guiparams');
0088
0089
0090
0091 guiparams.use_data_limits_planview = logical(get(hObject,'Value'));
0092
0093 if ~guiparams.use_data_limits_planview
0094
0095
0096 set_enable(handles,'setplanviewon')
0097 else
0098
0099
0100
0101 PVdata = guiparams.gp_vmt.iric_anv_planview_data.outmat';
0102 PVdata(:,4:5) = PVdata(:,4:5).*100;
0103 vr = sqrt(PVdata(:,4).^2+PVdata(:,5).^2);
0104 guiparams.min_velocity_planview = nanmin(vr);
0105 guiparams.max_velocity_planview = nanmax(vr);
0106
0107
0108 if ~guiparams.gp_vmt.english_units
0109
0110 else
0111 guiparams.min_velocity_planview = guiparams.min_velocity_planview*0.03281;
0112 guiparams.max_velocity_planview = guiparams.max_velocity_planview*0.03281;
0113
0114
0115 end
0116 set(handles.MinVelocityPlanview, 'String', guiparams.min_velocity_planview);
0117 set(handles.MaxVelocityPlanview, 'String', guiparams.max_velocity_planview);
0118
0119
0120
0121 set_enable(handles,'setplanviewoff')
0122 end
0123
0124
0125
0126 setappdata(handles.figure1,'guiparams',guiparams)
0127
0128
0129
0130
0131
0132
0133
0134 function MinVelocityPlanview_Callback(hObject, eventdata, handles)
0135
0136
0137 guiparams = getappdata(handles.figure1,'guiparams');
0138
0139
0140
0141 new_value = str2double(get(hObject,'String'));
0142 is_a_number = ~isnan(new_value);
0143
0144
0145
0146 if is_a_number
0147 guiparams.min_velocity_planview = new_value;
0148
0149
0150
0151 setappdata(handles.figure1,'guiparams',guiparams)
0152
0153 else
0154 set(hObject,'String',guiparams.min_velocity_planview)
0155 end
0156
0157
0158
0159
0160
0161
0162 function MaxVelocityPlanview_Callback(hObject, eventdata, handles)
0163
0164
0165 guiparams = getappdata(handles.figure1,'guiparams');
0166
0167
0168
0169 new_value = str2double(get(hObject,'String'));
0170 is_a_number = ~isnan(new_value);
0171
0172
0173
0174 if is_a_number
0175 guiparams.max_velocity_planview = new_value;
0176
0177
0178
0179 setappdata(handles.figure1,'guiparams',guiparams)
0180
0181 else
0182 set(hObject,'String',guiparams.max_velocity_planview)
0183 end
0184
0185
0186
0187
0188
0189 function ColormapPlanview_Callback(hObject, eventdata, handles)
0190
0191
0192 guiparams = getappdata(handles.figure1,'guiparams');
0193 guiprefs = getappdata(handles.figure1,'guiprefs');
0194
0195
0196
0197 idx_variable = get(hObject,'Value');
0198 guiparams.idx_colormap_planview = idx_variable;
0199 guiparams.colormap_planview = guiparams.colormaps_planview(idx_variable).string;
0200
0201 if strcmpi('Browse for more (cpt)...',guiparams.colormap_planview)
0202 [FileName,PathName] = uigetfile('*.cpt','Select the cpt colormap file',...
0203 fullfile(guiprefs.cpt_path,guiprefs.cpt_file));
0204 guiparams.cpt_planview = fullfile(PathName,FileName);
0205
0206
0207
0208 guiprefs.cpt_path = PathName;
0209 guiprefs.cpt_file = FileName;
0210 setappdata(handles.figure1,'guiprefs',guiprefs)
0211 store_prefs(handles.figure1,'cptplanview')
0212 end
0213
0214
0215
0216 setappdata(handles.figure1,'guiparams',guiparams)
0217
0218
0219
0220
0221
0222
0223 function UseDataLimitsMCS_Callback(hObject, eventdata, handles)
0224
0225
0226 guiparams = getappdata(handles.figure1,'guiparams');
0227
0228
0229
0230 guiparams.use_data_limits_mcs = logical(get(hObject,'Value'));
0231
0232 if ~guiparams.use_data_limits_mcs
0233
0234
0235 set_enable(handles,'setmcson')
0236 else
0237
0238
0239
0240 switch guiparams.gp_vmt.contour
0241 case 'streamwise'
0242 vmin = nanmin(guiparams.gp_vmt.V.uSmooth(:));
0243 vmax = nanmax(guiparams.gp_vmt.V.uSmooth(:));
0244 case 'transverse'
0245 vmin = nanmin(guiparams.gp_vmt.V.vSmooth(:));
0246 vmax = nanmax(guiparams.gp_vmt.V.vSmooth(:));
0247 case 'vertical'
0248 vmin = nanmin(guiparams.gp_vmt.V.wSmooth(:));
0249 vmax = nanmax(guiparams.gp_vmt.V.wSmooth(:));
0250 case 'mag'
0251 vmin = nanmin(guiparams.gp_vmt.V.mcsMagSmooth(:));
0252 vmax = nanmax(guiparams.gp_vmt.V.mcsMagSmooth(:));
0253 case 'east'
0254 vmin = nanmin(guiparams.gp_vmt.V.mcsMagSmooth(:));
0255 vmax = nanmax(guiparams.gp_vmt.V.mcsMagSmooth(:));
0256 case 'north'
0257 vmin = nanmin(guiparams.gp_vmt.V.mcsEastSmooth(:));
0258 vmax = nanmax(guiparams.gp_vmt.V.mcsNorthSmooth(:));
0259 case 'primary_zsd'
0260 vmin = nanmin(guiparams.gp_vmt.V.vpSmooth(:));
0261 vmax = nanmax(guiparams.gp_vmt.V.vpSmooth(:));
0262 case 'secondary_zsd'
0263 vmin = nanmin(guiparams.gp_vmt.V.vsSmooth(:));
0264 vmax = nanmax(guiparams.gp_vmt.V.vsSmooth(:));
0265 case 'primary_roz'
0266 vmin = nanmin(guiparams.gp_vmt.V.Roz.upSmooth(:));
0267 vmax = nanmax(guiparams.gp_vmt.V.Roz.upSmooth(:));
0268 case 'secondary_roz'
0269 vmin = nanmin(guiparams.gp_vmt.V.Roz.usSmooth(:));
0270 vmax = nanmax(guiparams.gp_vmt.V.Roz.usSmooth(:));
0271 case 'primary_roz_x'
0272 vmin = nanmin(guiparams.gp_vmt.V.Roz.upxSmooth(:));
0273 vmax = nanmax(guiparams.gp_vmt.V.Roz.upxSmooth(:));
0274 case 'primary_roz_y'
0275 vmin = nanmin(guiparams.gp_vmt.V.Roz.upySmooth(:));
0276 vmax = nanmax(guiparams.gp_vmt.V.Roz.upySmooth(:));
0277 case 'secondary_roz_x'
0278 vmin = nanmin(guiparams.gp_vmt.V.Roz.usxSmooth(:));
0279 vmax = nanmax(guiparams.gp_vmt.V.Roz.usxSmooth(:));
0280 case 'secondary_roz_y'
0281 vmin = nanmin(guiparams.gp_vmt.V.Roz.usySmooth(:));
0282 vmax = nanmax(guiparams.gp_vmt.V.Roz.usySmooth(:));
0283 case 'backscatter'
0284 vmin = nanmin(guiparams.gp_vmt.V.mcsBackSmooth(:));
0285 vmax = nanmax(guiparams.gp_vmt.V.mcsBackSmooth(:));
0286 case 'flowangle'
0287 vmin = nanmin(guiparams.gp_vmt.V.mcsDirSmooth(:));
0288 vmax = nanmax(guiparams.gp_vmt.V.mcsDirSmooth(:));
0289 end
0290 guiparams.min_velocity_mcs = vmin;
0291 guiparams.max_velocity_mcs = vmax;
0292
0293
0294 if ~guiparams.gp_vmt.english_units
0295
0296 else
0297
0298
0299 guiparams.min_velocity_mcs = guiparams.min_velocity_mcs*0.03281;
0300 guiparams.max_velocity_mcs = guiparams.max_velocity_mcs*0.03281;
0301 end
0302 set(handles.MinVelocityMCS, 'String', guiparams.min_velocity_mcs);
0303 set(handles.MaxVelocityMCS, 'String', guiparams.max_velocity_mcs);
0304
0305
0306
0307 set_enable(handles,'setmcsoff')
0308 end
0309
0310
0311
0312 setappdata(handles.figure1,'guiparams',guiparams)
0313
0314
0315
0316
0317 function MinVelocityMCS_Callback(hObject, eventdata, handles)
0318
0319
0320 guiparams = getappdata(handles.figure1,'guiparams');
0321
0322
0323
0324 new_value = str2double(get(hObject,'String'));
0325 is_a_number = ~isnan(new_value);
0326
0327
0328
0329 if is_a_number
0330 guiparams.min_velocity_mcs = new_value;
0331
0332
0333
0334 setappdata(handles.figure1,'guiparams',guiparams)
0335
0336 else
0337 set(hObject,'String',guiparams.min_velocity_mcs)
0338 end
0339
0340
0341
0342
0343
0344 function MaxVelocityMCS_Callback(hObject, eventdata, handles)
0345
0346
0347 guiparams = getappdata(handles.figure1,'guiparams');
0348
0349
0350
0351 new_value = str2double(get(hObject,'String'));
0352 is_a_number = ~isnan(new_value);
0353
0354
0355
0356 if is_a_number
0357 guiparams.max_velocity_mcs = new_value;
0358
0359
0360
0361 setappdata(handles.figure1,'guiparams',guiparams)
0362
0363 else
0364 set(hObject,'String',guiparams.max_velocity_mcs)
0365 end
0366
0367
0368
0369
0370
0371 function ColormapMCS_Callback(hObject, eventdata, handles)
0372
0373
0374 guiparams = getappdata(handles.figure1,'guiparams');
0375 guiprefs = getappdata(handles.figure1,'guiprefs');
0376
0377
0378
0379 idx_variable = get(hObject,'Value');
0380 guiparams.idx_colormap_mcs = idx_variable;
0381 guiparams.colormap_mcs = guiparams.colormaps_mcs(idx_variable).string;
0382
0383 if strcmpi('Browse for more (cpt)...',guiparams.colormap_mcs)
0384 [FileName,PathName] = uigetfile('*.cpt','Select the cpt colormap file',...
0385 fullfile(guiprefs.cpt_path,guiprefs.cpt_file));
0386 guiparams.cpt_mcs = fullfile(PathName,FileName);
0387
0388
0389
0390 guiprefs.cpt_path = PathName;
0391 guiprefs.cpt_file = FileName;
0392 setappdata(handles.figure1,'guiprefs',guiprefs)
0393 store_prefs(handles.figure1,'cptmcs')
0394 end
0395
0396
0397
0398 setappdata(handles.figure1,'guiparams',guiparams)
0399
0400
0401
0402
0403
0404 function ReferenceVelocity_Callback(hObject, eventdata, handles)
0405
0406
0407 guiparams = getappdata(handles.figure1,'guiparams');
0408
0409
0410
0411 new_value = str2double(get(hObject,'String'));
0412 is_a_number = ~isnan(new_value);
0413 is_positive = new_value>=0;
0414
0415
0416
0417 if is_a_number && is_positive
0418 guiparams.reference_velocity = new_value;
0419
0420
0421
0422 setappdata(handles.figure1,'guiparams',guiparams)
0423
0424 else
0425 set(hObject,'String',guiparams.reference_velocity)
0426 end
0427
0428
0429
0430
0431
0432
0433 function UseDefaults_Callback(hObject, eventdata, handles)
0434
0435
0436 guiparams = getappdata(handles.figure1,'guiparams');
0437
0438
0439
0440 guiparams.use_defaults = logical(get(hObject,'Value'));
0441
0442 if ~guiparams.use_defaults
0443
0444
0445 set_enable(handles,'setrefon')
0446 else
0447 [~,J] = ind2sub(size(guiparams.gp_vmt.V.vp(1,:)),find(~isnan(guiparams.gp_vmt.V.vp(1,:))==1));
0448 et = J(1):guiparams.gp_vmt.horizontal_vector_spacing:J(end);
0449 [r, ~]=size(guiparams.gp_vmt.V.vp);
0450 bi = 1:guiparams.gp_vmt.vertical_vector_spacing:r;
0451 switch guiparams.gp_vmt.secondary_flow_vector_variable
0452 case 'transverse'
0453 reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.vSmooth(bi,et)))));
0454 case 'secondary_zsd'
0455 reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.vsSmooth(bi,et)))));
0456 case 'secondary_roz'
0457 reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.Roz.usSmooth(bi,et)))));
0458 case 'secondary_roz_y'
0459 reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.Roz.usySmooth(bi,et)))));
0460 case 'primary_roz_y'
0461 reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.Roz.upySmooth(bi,et)))));
0462 end
0463
0464 distance = 0.06*max(guiparams.gp_vmt.V.mcsDist(:));
0465 depth = 0.95*max(guiparams.gp_vmt.V.mcsBed(:));
0466 if guiparams.gp_vmt.english_units
0467 reference_velocity = reference_velocity*0.03281;
0468 distance = distance*3.281;
0469 depth = depth*3.281;
0470 end
0471
0472
0473 set(handles.ReferenceVelocity, 'String', num2str(reference_velocity))
0474 set(handles.Distance, 'String', num2str(distance))
0475 set(handles.Depth, 'String', num2str(depth))
0476
0477
0478
0479 guiparams.reference_velocity = reference_velocity;
0480 guiparams.distance = distance;
0481 guiparams.depth = depth;
0482 setappdata(handles.figure1,'guiparams',guiparams)
0483
0484
0485
0486 set_enable(handles,'setrefoff')
0487 end
0488
0489
0490
0491
0492
0493 function Distance_Callback(hObject, eventdata, handles)
0494
0495
0496 guiparams = getappdata(handles.figure1,'guiparams');
0497
0498
0499
0500 new_value = str2double(get(hObject,'String'));
0501 is_a_number = ~isnan(new_value);
0502 is_positive = new_value>=0;
0503
0504
0505
0506 if is_a_number && is_positive
0507 guiparams.distance = new_value;
0508
0509
0510
0511 setappdata(handles.figure1,'guiparams',guiparams)
0512
0513 else
0514 set(hObject,'String',guiparams.distance)
0515 end
0516
0517
0518
0519
0520
0521
0522 function Depth_Callback(hObject, eventdata, handles)
0523
0524
0525 guiparams = getappdata(handles.figure1,'guiparams');
0526
0527
0528
0529 new_value = str2double(get(hObject,'String'));
0530 is_a_number = ~isnan(new_value);
0531 is_positive = new_value>=0;
0532
0533
0534
0535 if is_a_number && is_positive
0536 guiparams.depth = new_value;
0537
0538
0539
0540 setappdata(handles.figure1,'guiparams',guiparams)
0541
0542 else
0543 set(hObject,'String',guiparams.depth)
0544 end
0545
0546
0547
0548
0549
0550
0551 function ApplyChanges_Callback(hObject, eventdata, handles)
0552
0553
0554 guiparams = getappdata(handles.figure1,'guiparams');
0555 guiprefs = getappdata(handles.figure1,'guiprefs');
0556 z = guiparams.gp_vmt.z;
0557 A = guiparams.gp_vmt.A;
0558 V = guiparams.gp_vmt.V;
0559 Map = guiparams.gp_vmt.Map;
0560
0561
0562 fig_planview_handle = findobj(0,'name','Plan View Map');
0563
0564
0565 if ~isempty(fig_planview_handle) && ishandle(fig_planview_handle)
0566 figure(fig_planview_handle);
0567
0568
0569
0570 depth_range = [guiparams.gp_vmt.depth_range_min guiparams.gp_vmt.depth_range_max];
0571
0572 minrng = guiparams.min_velocity_planview;
0573 maxrng = guiparams.max_velocity_planview;
0574 usecolormap = guiparams.colormap_planview;
0575 cptfullfile = guiparams.cpt_planview;
0576 [~,~,~] = VMT_PlotPlanViewQuivers(z,A,V,Map, ...
0577 depth_range, ...
0578 guiparams.gp_vmt.vector_scale_plan_view, ...
0579 guiparams.gp_vmt.vector_spacing_plan_view, ...
0580 guiparams.gp_vmt.smoothing_window_size, ...
0581 guiparams.gp_vmt.display_shoreline, ...
0582 guiparams.gp_vmt.english_units,...
0583 guiparams.gp_vmt.mat_file, ...
0584 guiparams.gp_vmt.mat_path,...
0585 minrng,...
0586 maxrng,...
0587 usecolormap,...
0588 cptfullfile);
0589
0590
0591 if guiparams.gp_vmt.display_shoreline
0592
0593 if ischar(guiprefs.shoreline_file)
0594 mapdata = dlmread(fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file));
0595 Map.UTMe = mapdata(:,1);
0596 Map.UTMn = mapdata(:,2);
0597 Map.infile = fullfile(guiprefs.shoreline_path,guiprefs.shoreline_file);
0598
0599 else
0600 Map = [];
0601 end
0602 VMT_PlotShoreline(Map)
0603 end
0604
0605
0606 if guiparams.gp_vmt.add_background
0607 [~,~] = VMT_OverlayDOQQ(guiprefs,true);
0608 end
0609 end
0610
0611
0612 fig_contour_handle = findobj(0,'name','Mean Cross Section Contour');
0613
0614
0615 if ~isempty(fig_contour_handle) && ishandle(fig_contour_handle)
0616 figure(fig_contour_handle);
0617
0618
0619 if guiparams.gp_vmt.plot_secondary_flow_vectors
0620 if ~guiparams.gp_vmt.english_units
0621 [~,A,V,plot_cont_log_text] = VMT_PlotXSContQuiver(z,A,V, ...
0622 guiparams.gp_vmt.contour, ...
0623 guiparams.gp_vmt.vector_scale_cross_section, ...
0624 guiparams.gp_vmt.vertical_exaggeration, ...
0625 guiparams.gp_vmt.horizontal_vector_spacing, ...
0626 guiparams.gp_vmt.vertical_vector_spacing, ...
0627 guiparams.gp_vmt.secondary_flow_vector_variable, ...
0628 guiparams.gp_vmt.include_vertical_velocity, ...
0629 guiparams.gp_vmt.english_units,...
0630 guiparams.reference_velocity,...
0631 guiparams.distance,...
0632 guiparams.depth);
0633 else
0634 [~,A,V,plot_cont_log_text] = VMT_PlotXSContQuiver(z,A,V, ...
0635 guiparams.gp_vmt.contour, ...
0636 guiparams.gp_vmt.vector_scale_cross_section, ...
0637 guiparams.gp_vmt.vertical_exaggeration, ...
0638 guiparams.gp_vmt.horizontal_vector_spacing, ...
0639 guiparams.gp_vmt.vertical_vector_spacing, ...
0640 guiparams.gp_vmt.secondary_flow_vector_variable, ...
0641 guiparams.gp_vmt.include_vertical_velocity, ...
0642 guiparams.gp_vmt.english_units,...
0643 guiparams.reference_velocity.*30.48,...
0644 guiparams.distance.*0.3048,...
0645 guiparams.depth.*0.3048);
0646 end
0647 end
0648
0649
0650 caxis([
0651 guiparams.min_velocity_mcs
0652 guiparams.max_velocity_mcs])
0653
0654
0655 if ~strcmpi('Browse for more (cpt)...',guiparams.colormap_mcs)
0656 colormap(guiparams.colormap_mcs)
0657 else
0658 cptcmap(guiparams.cpt_mcs)
0659 end
0660 end
0661
0662
0663
0664 if guiparams.gp_vmt.presentation
0665 UpdatePlotStyle(hObject, eventdata, handles)
0666 else
0667 UpdatePlotStyle(hObject, eventdata, handles)
0668 end
0669
0670
0671
0672
0673 function Close_Callback(hObject, eventdata, handles)
0674
0675 close(handles.figure1)
0676
0677
0678
0679
0680 function initGUI(handles)
0681
0682
0683 guiparams = getappdata(handles.figure1,'guiparams');
0684
0685
0686 set(handles.UseDataLimitsPlanview, 'Value', guiparams.use_data_limits_planview);
0687 set(handles.MinVelocityPlanview, 'String', guiparams.min_velocity_planview);
0688 set(handles.MinVelocityPlanviewUnits, 'String', guiparams.min_velocity_planview_units);
0689 set(handles.MaxVelocityPlanview, 'String', guiparams.max_velocity_planview);
0690 set(handles.MaxVelocityPlanviewUnits, 'String', guiparams.max_velocity_planview_units);
0691 set(handles.ColormapPlanview, 'String',{guiparams.colormaps_planview.string}, ...
0692 'Value', guiparams.idx_colormap_planview)
0693
0694
0695 set(handles.UseDataLimitsMCS, 'Value', guiparams.use_data_limits_mcs);
0696 set(handles.MinVelocityMCS, 'String', guiparams.min_velocity_mcs);
0697 set(handles.MinVelocityMCSUnits, 'String', guiparams.min_velocity_mcs_units);
0698 set(handles.MaxVelocityMCS, 'String', guiparams.max_velocity_mcs);
0699 set(handles.MaxVelocityMCSUnits, 'String', guiparams.max_velocity_mcs_units);
0700 set(handles.UseDefaults, 'Value', guiparams.use_defaults);
0701 set(handles.ReferenceVelocity, 'String', guiparams.reference_velocity);
0702 set(handles.ReferenceVelocityUnits, 'String', guiparams.reference_velocity_units);
0703 set(handles.Distance, 'String', guiparams.distance);
0704 set(handles.DistanceUnits, 'String', guiparams.distance_units);
0705 set(handles.Depth, 'String', guiparams.depth);
0706 set(handles.DepthUnits, 'String', guiparams.depth_units);
0707 set(handles.ColormapMCS, 'String',{guiparams.colormaps_mcs.string}, ...
0708 'Value', guiparams.idx_colormap_mcs);
0709
0710
0711
0712 if iscell(guiparams.gp_vmt.mat_file)
0713 set_enable(handles,'initmultiple')
0714 else
0715 set_enable(handles,'init')
0716 end
0717
0718
0719 function [guiparams] = createGUIparams
0720
0721
0722
0723 hVMTgui = getappdata(0,'hVMTgui');
0724 guiparams_vmt = getappdata(hVMTgui,'guiparams');
0725 guiparams.gp_vmt = guiparams_vmt;
0726
0727
0728
0729 fig_planview_handle = findobj(0,'name','Plan View Map');
0730 fig_mcs_handle = findobj(0,'name','Mean Cross Section Contour');
0731
0732
0733
0734
0735
0736
0737
0738
0739
0740
0741 guiparams.use_data_limits_planview = 1;
0742
0743 if ~isempty(fig_planview_handle) && ishandle(fig_planview_handle)
0744
0745 PVdata = guiparams.gp_vmt.iric_anv_planview_data.outmat';
0746 PVdata(:,4:5) = PVdata(:,4:5).*100;
0747 vr = sqrt(PVdata(:,4).^2+PVdata(:,5).^2);
0748 guiparams.min_velocity_planview = nanmin(vr);
0749 guiparams.max_velocity_planview = nanmax(vr);
0750 else
0751 guiparams.min_velocity_planview = 0;
0752 guiparams.max_velocity_planview = 0;
0753 end
0754
0755
0756 guiparams.idx_colormap_planview = 1;
0757 idx = 1;
0758 guiparams.colormaps_planview(idx).string = 'Jet';
0759 idx = idx + 1;
0760 guiparams.colormaps_planview(idx).string = 'HSV';
0761 idx = idx + 1;
0762 guiparams.colormaps_planview(idx).string = 'Hot';
0763 idx = idx + 1;
0764 guiparams.colormaps_planview(idx).string = 'Cool';
0765 idx = idx + 1;
0766 guiparams.colormaps_planview(idx).string = 'Spring';
0767 idx = idx + 1;
0768 guiparams.colormaps_planview(idx).string = 'Summer';
0769 idx = idx + 1;
0770 guiparams.colormaps_planview(idx).string = 'Autumn';
0771 idx = idx + 1;
0772 guiparams.colormaps_planview(idx).string = 'Winter';
0773 idx = idx + 1;
0774 guiparams.colormaps_planview(idx).string = 'Gray';
0775 idx = idx + 1;
0776 guiparams.colormaps_planview(idx).string = 'Bone';
0777 idx = idx + 1;
0778 guiparams.colormaps_planview(idx).string = 'Copper';
0779 idx = idx + 1;
0780 guiparams.colormaps_planview(idx).string = 'Pink';
0781 idx = idx + 1;
0782 guiparams.colormaps_planview(idx).string = 'Browse for more (cpt)...';
0783 guiparams.colormap_planview = ...
0784 guiparams.colormaps_planview(guiparams.idx_colormap_planview).string;
0785 guiparams.cpt_planview = [];
0786
0787
0788
0789
0790 guiparams.use_data_limits_mcs = 1;
0791 guiparams.use_defaults = 1;
0792
0793 if ~isempty(fig_mcs_handle) && ishandle(fig_mcs_handle)
0794 if iscell(guiparams.gp_vmt.mat_file)
0795 guiparams.min_velocity_mcs = 0;
0796 guiparams.max_velocity_mcs = 0;
0797 guiparams.distance = 0;
0798 guiparams.depth = 0;
0799 guiparams.reference_velocity = 0;
0800 else
0801
0802
0803 switch guiparams.gp_vmt.contour
0804 case 'streamwise'
0805 vmin = nanmin(guiparams.gp_vmt.V.uSmooth(:));
0806 vmax = nanmax(guiparams.gp_vmt.V.uSmooth(:));
0807 case 'transverse'
0808 vmin = nanmin(guiparams.gp_vmt.V.vSmooth(:));
0809 vmax = nanmax(guiparams.gp_vmt.V.vSmooth(:));
0810 case 'vertical'
0811 vmin = nanmin(guiparams.gp_vmt.V.wSmooth(:));
0812 vmax = nanmax(guiparams.gp_vmt.V.wSmooth(:));
0813 case 'mag'
0814 vmin = nanmin(guiparams.gp_vmt.V.mcsMagSmooth(:));
0815 vmax = nanmax(guiparams.gp_vmt.V.mcsMagSmooth(:));
0816 case 'east'
0817 vmin = nanmin(guiparams.gp_vmt.V.mcsMagSmooth(:));
0818 vmax = nanmax(guiparams.gp_vmt.V.mcsMagSmooth(:));
0819 case 'north'
0820 vmin = nanmin(guiparams.gp_vmt.V.mcsEastSmooth(:));
0821 vmax = nanmax(guiparams.gp_vmt.V.mcsNorthSmooth(:));
0822 case 'primary_zsd'
0823 vmin = nanmin(guiparams.gp_vmt.V.vpSmooth(:));
0824 vmax = nanmax(guiparams.gp_vmt.V.vpSmooth(:));
0825 case 'secondary_zsd'
0826 vmin = nanmin(guiparams.gp_vmt.V.vsSmooth(:));
0827 vmax = nanmax(guiparams.gp_vmt.V.vsSmooth(:));
0828 case 'primary_roz'
0829 vmin = nanmin(guiparams.gp_vmt.V.Roz.upSmooth(:));
0830 vmax = nanmax(guiparams.gp_vmt.V.Roz.upSmooth(:));
0831 case 'secondary_roz'
0832 vmin = nanmin(guiparams.gp_vmt.V.Roz.usSmooth(:));
0833 vmax = nanmax(guiparams.gp_vmt.V.Roz.usSmooth(:));
0834 case 'primary_roz_x'
0835 vmin = nanmin(guiparams.gp_vmt.V.Roz.upxSmooth(:));
0836 vmax = nanmax(guiparams.gp_vmt.V.Roz.upxSmooth(:));
0837 case 'primary_roz_y'
0838 vmin = nanmin(guiparams.gp_vmt.V.Roz.upySmooth(:));
0839 vmax = nanmax(guiparams.gp_vmt.V.Roz.upySmooth(:));
0840 case 'secondary_roz_x'
0841 vmin = nanmin(guiparams.gp_vmt.V.Roz.usxSmooth(:));
0842 vmax = nanmax(guiparams.gp_vmt.V.Roz.usxSmooth(:));
0843 case 'secondary_roz_y'
0844 vmin = nanmin(guiparams.gp_vmt.V.Roz.usySmooth(:));
0845 vmax = nanmax(guiparams.gp_vmt.V.Roz.usySmooth(:));
0846 case 'backscatter'
0847 vmin = nanmin(guiparams.gp_vmt.V.mcsBackSmooth(:));
0848 vmax = nanmax(guiparams.gp_vmt.V.mcsBackSmooth(:));
0849 case 'flowangle'
0850 vmin = nanmin(guiparams.gp_vmt.V.mcsDirSmooth(:));
0851 vmax = nanmax(guiparams.gp_vmt.V.mcsDirSmooth(:));
0852 end
0853 guiparams.min_velocity_mcs = vmin;
0854 guiparams.max_velocity_mcs = vmax;
0855
0856
0857 [~,J] = ind2sub(size(guiparams.gp_vmt.V.vp(1,:)),find(~isnan(guiparams.gp_vmt.V.vp(1,:))==1));
0858 et = J(1):guiparams.gp_vmt.horizontal_vector_spacing:J(end);
0859 [r, ~]=size(guiparams.gp_vmt.V.vp);
0860 bi = 1:guiparams.gp_vmt.vertical_vector_spacing:r;
0861 switch guiparams.gp_vmt.secondary_flow_vector_variable
0862 case 'transverse'
0863 guiparams.reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.vSmooth(bi,et)))));
0864 case 'secondary_zsd'
0865 guiparams.reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.vsSmooth(bi,et)))));
0866 case 'secondary_roz'
0867 guiparams.reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.Roz.usSmooth(bi,et)))));
0868 case 'secondary_roz_y'
0869 guiparams.reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.Roz.usySmooth(bi,et)))));
0870 case 'primary_roz_y'
0871 guiparams.reference_velocity = ceil(max(max(abs(guiparams.gp_vmt.V.Roz.upySmooth(bi,et)))));
0872 end
0873
0874 guiparams.distance = 0.06*max(guiparams.gp_vmt.V.mcsDist(:));
0875 guiparams.depth = 0.95*max(guiparams.gp_vmt.V.mcsBed(:));
0876 if guiparams.gp_vmt.english_units
0877 guiparams.reference_velocity = guiparams.reference_velocity*0.03281;
0878 guiparams.distance = guiparams.distance*3.281;
0879 guiparams.depth = guiparams.depth*3.281;
0880 end
0881 end
0882 else
0883 guiparams.min_velocity_mcs = 0;
0884 guiparams.max_velocity_mcs = 0;
0885 guiparams.distance = 0;
0886 guiparams.depth = 0;
0887 guiparams.reference_velocity = 0;
0888 end
0889
0890 guiparams.idx_colormap_mcs = 1;
0891
0892
0893 idx = 1;
0894 guiparams.colormaps_mcs(idx).string = 'Jet';
0895 idx = idx + 1;
0896 guiparams.colormaps_mcs(idx).string = 'HSV';
0897 idx = idx + 1;
0898 guiparams.colormaps_mcs(idx).string = 'Hot';
0899 idx = idx + 1;
0900 guiparams.colormaps_mcs(idx).string = 'Cool';
0901 idx = idx + 1;
0902 guiparams.colormaps_mcs(idx).string = 'Spring';
0903 idx = idx + 1;
0904 guiparams.colormaps_mcs(idx).string = 'Summer';
0905 idx = idx + 1;
0906 guiparams.colormaps_mcs(idx).string = 'Autumn';
0907 idx = idx + 1;
0908 guiparams.colormaps_mcs(idx).string = 'Winter';
0909 idx = idx + 1;
0910 guiparams.colormaps_mcs(idx).string = 'Gray';
0911 idx = idx + 1;
0912 guiparams.colormaps_mcs(idx).string = 'Bone';
0913 idx = idx + 1;
0914 guiparams.colormaps_mcs(idx).string = 'Copper';
0915 idx = idx + 1;
0916 guiparams.colormaps_mcs(idx).string = 'Pink';
0917 idx = idx + 1;
0918 guiparams.colormaps_mcs(idx).string = 'Browse for more (cpt)...';
0919 guiparams.colormap_mcs = ...
0920 guiparams.colormaps_mcs(guiparams.idx_colormap_mcs).string;
0921 guiparams.cpt_mcs = [];
0922
0923
0924 switch guiparams.gp_vmt.contour
0925 case 'backscatter'
0926 guiparams.min_velocity_mcs_units = 'dB';
0927 guiparams.max_velocity_mcs_units = 'dB';
0928 if ~guiparams.gp_vmt.english_units
0929 guiparams.min_velocity_planview_units = 'cm/s';
0930 guiparams.max_velocity_planview_units = 'cm/s';
0931
0932
0933 guiparams.reference_velocity_units = 'cm/s';
0934 guiparams.distance_units = 'm';
0935 guiparams.depth_units = 'm';
0936 else
0937 guiparams.min_velocity_planview_units = 'ft/s';
0938 guiparams.max_velocity_planview_units = 'ft/s';
0939
0940
0941 guiparams.reference_velocity_units = 'ft/s';
0942 guiparams.distance_units = 'ft';
0943 guiparams.depth_units = 'ft';
0944 end
0945 case 'flowangle'
0946 guiparams.min_velocity_mcs_units = 'deg';
0947 guiparams.max_velocity_mcs_units = 'deg';
0948 if ~guiparams.gp_vmt.english_units
0949 guiparams.min_velocity_planview_units = 'cm/s';
0950 guiparams.max_velocity_planview_units = 'cm/s';
0951
0952
0953 guiparams.reference_velocity_units = 'cm/s';
0954 guiparams.distance_units = 'm';
0955 guiparams.depth_units = 'm';
0956 else
0957 guiparams.min_velocity_planview_units = 'ft/s';
0958 guiparams.max_velocity_planview_units = 'ft/s';
0959
0960
0961 guiparams.reference_velocity_units = 'ft/s';
0962 guiparams.distance_units = 'ft';
0963 guiparams.depth_units = 'ft';
0964 end
0965 otherwise
0966 if ~guiparams.gp_vmt.english_units
0967 guiparams.min_velocity_planview_units = 'cm/s';
0968 guiparams.max_velocity_planview_units = 'cm/s';
0969
0970 guiparams.min_velocity_mcs_units = 'cm/s';
0971 guiparams.max_velocity_mcs_units = 'cm/s';
0972 guiparams.reference_velocity_units = 'cm/s';
0973 guiparams.distance_units = 'm';
0974 guiparams.depth_units = 'm';
0975 else
0976 guiparams.min_velocity_planview_units = 'ft/s';
0977 guiparams.max_velocity_planview_units = 'ft/s';
0978
0979 guiparams.min_velocity_mcs_units = 'ft/s';
0980 guiparams.max_velocity_mcs_units = 'ft/s';
0981 guiparams.reference_velocity_units = 'ft/s';
0982 guiparams.distance_units = 'ft';
0983 guiparams.depth_units = 'ft';
0984
0985 guiparams.min_velocity_planview = guiparams.min_velocity_planview*0.03281;
0986 guiparams.max_velocity_planview = guiparams.max_velocity_planview*0.03281;
0987 guiparams.min_velocity_mcs = guiparams.min_velocity_mcs*0.03281;
0988 guiparams.max_velocity_mcs = guiparams.max_velocity_mcs*0.03281;
0989 end
0990 end
0991
0992
0993
0994 function set_enable(handles,enable_state)
0995
0996 guiparams = getappdata(handles.figure1,'guiparams');
0997
0998 switch enable_state
0999 case 'init'
1000
1001 set([handles.UseDataLimitsPlanview
1002 handles.ColormapPlanview],'Enable', 'on');
1003 set([handles.MinVelocityPlanview
1004 handles.MinVelocityPlanviewUnits
1005 handles.MaxVelocityPlanview
1006 handles.MaxVelocityPlanviewUnits], 'Enable', 'off');
1007
1008
1009 set([handles.UseDataLimitsMCS
1010 handles.UseDefaults
1011 handles.ColormapMCS],'Enable', 'on');
1012 set([handles.MinVelocityMCS
1013 handles.MinVelocityMCSUnits
1014 handles.MaxVelocityMCS
1015 handles.MaxVelocityMCSUnits
1016 handles.ReferenceVelocity
1017 handles.ReferenceVelocityUnits
1018 handles.Distance
1019 handles.DistanceUnits
1020 handles.Depth
1021 handles.DepthUnits], 'Enable', 'off');
1022 case 'initmultiple'
1023
1024 set([handles.UseDataLimitsPlanview
1025 handles.ColormapPlanview],'Enable', 'on');
1026 set([handles.MinVelocityPlanview
1027 handles.MinVelocityPlanviewUnits
1028 handles.MaxVelocityPlanview
1029 handles.MaxVelocityPlanviewUnits], 'Enable', 'off');
1030
1031
1032 set([handles.UseDataLimitsMCS
1033 handles.UseDefaults
1034 handles.ColormapMCS],'Enable', 'off');
1035 set([handles.MinVelocityMCS
1036 handles.MinVelocityMCSUnits
1037 handles.MaxVelocityMCS
1038 handles.MaxVelocityMCSUnits
1039 handles.ReferenceVelocity
1040 handles.ReferenceVelocityUnits
1041 handles.Distance
1042 handles.DistanceUnits
1043 handles.Depth
1044 handles.DepthUnits], 'Enable', 'off');
1045 case 'setplanviewon'
1046
1047 set([handles.UseDataLimitsPlanview
1048 handles.ColormapPlanview],'Enable', 'on');
1049 set([handles.MinVelocityPlanview
1050 handles.MinVelocityPlanviewUnits
1051 handles.MaxVelocityPlanview
1052 handles.MaxVelocityPlanviewUnits], 'Enable', 'on');
1053 case 'setplanviewoff'
1054
1055 set([handles.UseDataLimitsPlanview
1056 handles.ColormapPlanview],'Enable', 'on');
1057 set([handles.MinVelocityPlanview
1058 handles.MinVelocityPlanviewUnits
1059 handles.MaxVelocityPlanview
1060 handles.MaxVelocityPlanviewUnits], 'Enable', 'off');
1061 case 'setmcson'
1062
1063 set([handles.UseDataLimitsMCS
1064 handles.ColormapMCS],'Enable', 'on');
1065 set([handles.MinVelocityMCS
1066 handles.MinVelocityMCSUnits
1067 handles.MaxVelocityMCS
1068 handles.MaxVelocityMCSUnits
1069 ], 'Enable', 'on');
1070 case 'setmcsoff'
1071
1072 set([handles.UseDataLimitsMCS
1073 handles.ColormapMCS],'Enable', 'on');
1074 set([handles.MinVelocityMCS
1075 handles.MinVelocityMCSUnits
1076 handles.MaxVelocityMCS
1077 handles.MaxVelocityMCSUnits
1078 ], 'Enable', 'off');
1079 case 'setrefon'
1080 set([handles.ReferenceVelocity
1081 handles.ReferenceVelocityUnits
1082 handles.Distance
1083 handles.DistanceUnits
1084 handles.Depth
1085 handles.DepthUnits], 'Enable', 'on');
1086 case 'setrefoff'
1087 set([handles.ReferenceVelocity
1088 handles.ReferenceVelocityUnits
1089 handles.Distance
1090 handles.DistanceUnits
1091 handles.Depth
1092 handles.DepthUnits], 'Enable', 'off');
1093 otherwise
1094 end
1095
1096
1097
1098 function UpdatePlotStyle(hObject, eventdata, handles)
1099
1100
1101 guiparams = getappdata(handles.figure1,'guiparams');
1102
1103
1104
1105
1106 hf = findobj('type','figure');
1107 valid_names = {'Plan View Map'; 'Mean Cross Section Contour'};
1108
1109 if guiparams.gp_vmt.presentation
1110
1111 BkgdColor = 'black';
1112 AxColor = 'white';
1113 FigColor = 'black';
1114 FntSize = 14;
1115 else
1116
1117 BkgdColor = 'white';
1118 AxColor = 'black';
1119 FigColor = 'white';
1120 FntSize = 14;
1121 end
1122
1123
1124 if ~isempty(hf) && any(ishandle(hf))
1125
1126 for i = 1:length(valid_names)
1127 switch valid_names{i}
1128 case 'Plan View Map'
1129
1130 hff = findobj('name','Plan View Map');
1131 if ~isempty(hff) && ishandle(hff)
1132 figure(hff)
1133
1134
1135 set(gcf,'Color',BkgdColor);
1136 set(gca,'FontSize',FntSize)
1137 set(get(gca,'Title'),'FontSize',FntSize)
1138 set(gca,'Color',FigColor)
1139 set(gca,'XColor',AxColor)
1140 set(gca,'YColor',AxColor)
1141 set(gca,'ZColor',AxColor)
1142 set(findobj(gcf,'tag','Colorbar'),'FontSize',FntSize,'XColor',AxColor,'YColor',AxColor);
1143 set(get(gca,'Title'),'FontSize',FntSize,'Color',AxColor)
1144 set(get(gca,'xLabel'),'FontSize',FntSize,'Color',AxColor)
1145 set(get(gca,'yLabel'),'FontSize',FntSize,'Color',AxColor)
1146 end
1147 case 'Mean Cross Section Contour'
1148
1149 hff = findobj('name','Mean Cross Section Contour');
1150 if ~isempty(hff) && ishandle(hff)
1151 figure(hff)
1152
1153
1154 set(gcf,'Color',BkgdColor);
1155 set(gca,'FontSize',FntSize)
1156 set(get(gca,'Title'),'FontSize',FntSize)
1157 set(gca,'Color',[0.3 0.3 0.3])
1158 set(gca,'XColor',AxColor)
1159 set(gca,'YColor',AxColor)
1160 set(gca,'ZColor',AxColor)
1161 set(findobj(gcf,'tag','Colorbar'),'FontSize',FntSize,'XColor',AxColor,'YColor',AxColor);
1162 set(get(gca,'Title'),'FontSize',FntSize,'Color',AxColor)
1163 set(get(gca,'xLabel'),'FontSize',FntSize,'Color',AxColor)
1164 set(get(gca,'yLabel'),'FontSize',FntSize,'Color',AxColor)
1165 set(findobj(gca,'tag','PlotBedElevation') ,'color' ,AxColor)
1166 set(findobj(gca,'tag','ReferenceVectorText'),'color' ,AxColor)
1167 end
1168 otherwise
1169 end
1170 end
1171
1172
1173 end
1174
1175
1176
1177
1178
1179 function load_prefs(hfigure)
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189 if ispref('VMT','cptplanview')
1190 cptplanview = getpref('VMT','cptplanview');
1191 if exist(cptplanview.path,'dir')
1192 guiprefs.cpt_path = cptplanview.path;
1193 else
1194 guiprefs.cpt_path = pwd;
1195 end
1196
1197 if exist(fullfile(cptplanview.path,cptplanview.file),'file')
1198 guiprefs.cpt_file = cptplanview.file;
1199 else
1200 guiprefs.cpt_file = [];
1201 end
1202
1203 else
1204 guiprefs.cpt_path = pwd;
1205 guiprefs.cpt_file = [];
1206
1207 cptplanview.path = pwd;
1208 cptplanview.file = [];
1209 setpref('VMT','cptplanview',cptplanview)
1210 end
1211
1212 if ispref('VMT','cptmcs')
1213 cptmcs = getpref('VMT','cptmcs');
1214 if exist(cptmcs.path,'dir')
1215 guiprefs.cpt_path = cptmcs.path;
1216 else
1217 guiprefs.cpt_path = pwd;
1218 end
1219
1220 if exist(fullfile(cptmcs.path,cptmcs.file),'file')
1221 guiprefs.cpt_file = cptmcs.file;
1222 else
1223 guiprefs.cpt_file = [];
1224 end
1225
1226 else
1227 guiprefs.cpt_path = pwd;
1228 guiprefs.cpt_file = [];
1229
1230 cptmcs.path = pwd;
1231 cptmcs.file = [];
1232 setpref('VMT','cptplanview',cptplanview)
1233 end
1234 if ispref('VMT','shoreline')
1235 shoreline = getpref('VMT','shoreline');
1236 if exist(shoreline.path,'dir')
1237 guiprefs.shoreline_path = shoreline.path;
1238 else
1239 guiprefs.shoreline_path = pwd;
1240 end
1241
1242 if exist(fullfile(shoreline.path,shoreline.file),'file')
1243 guiprefs.shoreline_file = shoreline.file;
1244 else
1245 guiprefs.shoreline_file = [];
1246 end
1247 end
1248 if ispref('VMT','aerial')
1249 aerial = getpref('VMT','aerial');
1250 if exist(aerial.path,'dir')
1251 guiprefs.aerial_path = aerial.path;
1252 else
1253 guiprefs.aerial_path = pwd;
1254 end
1255 if iscell(aerial.file)
1256 if exist(fullfile(aerial.path,aerial.file{1}),'file')
1257 guiprefs.aerial_file = aerial.file;
1258 else
1259 guiprefs.aerial_file = [];
1260 end
1261 else
1262 if exist(fullfile(aerial.path,aerial.file),'file')
1263 guiprefs.aerial_file = aerial.file;
1264 else
1265 guiprefs.aerial_file = [];
1266 end
1267 end
1268 end
1269
1270
1271
1272 setappdata(hfigure,'guiprefs',guiprefs)
1273
1274 function store_prefs(hfigure,pref)
1275
1276
1277
1278
1279
1280
1281
1282 guiprefs = getappdata(hfigure,'guiprefs');
1283
1284 switch pref
1285 case 'cptplanview'
1286 cptplanview.path = guiprefs.cpt_path;
1287 cptplanview.file = guiprefs.cpt_file;
1288 setpref('VMT','cptplanview',cptplanview)
1289 case 'cptmcs'
1290 cptmcs.path = guiprefs.cpt_path;
1291 cptmcs.file = guiprefs.cpt_file;
1292 setpref('VMT','cptmcs',cptmcs)
1293 otherwise
1294 end
1295
1296