Commit 270601b5c3b66f2b8ab9f10683dfe9eb509dd2ba

Authored by Jean-Luc Shaw
1 parent 10a1a7f2
Exists in master

Empty strings in menu now clear the file loaded before. The bathymetric and tida…

…l files are also remembered when the gps file is changed and the documentation is updated.
GUI_drifter_cleanup.m
... ... @@ -22,7 +22,7 @@ function varargout = GUI_drifter_cleanup(varargin)
22 22  
23 23 % Edit the above text to modify the response to help GUI_drifter_cleanup
24 24  
25   -% Last Modified by GUIDE v2.5 12-Apr-2018 10:49:43
  25 +% Last Modified by GUIDE v2.5 12-Apr-2018 13:39:35
26 26  
27 27 % Begin initialization code - DO NOT EDIT
28 28 gui_Singleton = 1;
... ... @@ -60,17 +60,17 @@ addpath(genpath('lib')) ;
60 60  
61 61 % Get available input spot files
62 62 info = dir('data/gps/raw/*.mat');
63   -list = {info.name}';
  63 +list = [{''} ; {info.name}'];
64 64 set(handles.menu_files,'String',list) ;
65 65  
66 66 % Get available input bathy files
67 67 info = dir('data/bathy/*.mat');
68   -list = {info.name}';
  68 +list = [{''} ; {info.name}'];
69 69 set(handles.menu_bathy_files,'String',list) ;
70 70  
71 71 % Get available input bathy files
72 72 info = dir('data/tide/*.mat');
73   -list = {info.name}';
  73 +list = [{''} ; {info.name}'];
74 74 set(handles.menu_tide_files,'String',list) ;
75 75  
76 76 % Update handles structure
... ... @@ -80,15 +80,9 @@ guidata(hObject, handles);
80 80 % uiwait(handles.figure1);
81 81  
82 82  
83   -% --- Outputs from this function are returned to the command line.
84   -function varargout = GUI_drifter_cleanup_OutputFcn(hObject, eventdata, handles)
85   -% varargout cell array for returning output args (see VARARGOUT);
86   -% hObject handle to figure
87   -% eventdata reserved - to be defined in a future version of MATLAB
88   -% handles structure with handles and user data (see GUIDATA)
89 83  
  84 +function varargout = GUI_drifter_cleanup_OutputFcn(hObject, eventdata, handles)
90 85  
91   -% Get default command line output from handles structure
92 86 varargout{1} = handles.output;
93 87  
94 88  
... ... @@ -312,3 +306,11 @@ function rad_flag_end_Callback(hObject, eventdata, handles)
312 306 % handles structure with handles and user data (see GUIDATA)
313 307  
314 308 % Hint: get(hObject,'Value') returns toggle state of rad_flag_end
  309 +
  310 +
  311 +% --- Executes when the window is closed by the user
  312 +function figure1_CloseRequestFcn(hObject, eventdata, handles)
  313 +
  314 +clear global;
  315 +
  316 +delete(hObject);
... ...
documentation.txt
... ... @@ -92,6 +92,16 @@ sequence of operations as guidelines to quality control of your data.
92 92 13 - Do science ... !
93 93  
94 94  
  95 +NOTE !! : If you have loaded bathymetry and tide files, they are still
  96 + active when you load a new gps file! Depths are recalculated auto-
  97 + matically for the new gps data, and tide will be updated as well,
  98 + but if the bathymetry or tide file does not have a value for the
  99 + new coordinates or time values, you need to load appropriate bathy-
  100 + metric or tidal data or else you will run into issues! You can also
  101 + clear the bathymetry or tide file by selecting the empty string from
  102 + the file menu.
  103 +
  104 +
95 105 ===== FUNCTION DESCRIPTION =====
96 106  
97 107 RANGE (I0 and If) :
... ...
lib/menu_bathy_files_Callback.m
... ... @@ -6,16 +6,20 @@ global bathy S
6 6 liste = get(hObject,'String') ;
7 7 I = get(hObject,'Value') ;
8 8 file = liste{I} ;
9   -A = load(['data/bathy/' file]) ;
10   -B = fieldnames(A);
11   -bathy = getfield(A,B{1}) ;
12   -
13   -if isstruct(S)
14   - S.z = bathy(S.lon,S.lat) ;
  9 +if strcmp(file,'')
  10 + clearvars -global bathy;
15 11 else
16   - msgbox('WARNING! load GPS file first and then reload bathymetry. No Z computed !') ;
17   -end
  12 + A = load(['data/bathy/' file]) ;
  13 + B = fieldnames(A);
  14 + bathy = getfield(A,B{1}) ;
18 15  
  16 + if isstruct(S)
  17 + S.z = bathy(S.lon,S.lat) ;
  18 + else
  19 + msgbox('WARNING! load GPS file first and then reload bathymetry. No Z computed !') ;
  20 + end
  21 +
  22 +end
19 23 % Update handles structure
20 24 guidata(hObject, handles);
21 25  
... ...
lib/menu_files_Callback.m
1 1 function menu_files_Callback(hObject, eventdata, handles)
2 2  
3   -global S cnt
  3 +global S bathy cnt
4 4  
5 5 %% Put the list of mat files in the file list menu
6 6 liste = get(hObject,'String') ;
... ... @@ -16,6 +16,12 @@ handles.edit_If.String = num2str(N) ;
16 16 S = struct('lon',data.lon,'lat',data.lat,'dnum',data.timeM) ;
17 17 cnt = 0 ; % reset output punch counter
18 18  
  19 +% If bathymetry is loaded, find depth of track
  20 +if isobject(bathy)
  21 + S.z = bathy(S.lon,S.lat) ;
  22 +end
  23 +
  24 +% Plot full track
19 25 axes(handles.ax_track) ;
20 26 plot(S.lon,S.lat,'b',S.lon,S.lat,'ko')
21 27  
... ...
lib/menu_tide_files_Callback.m
... ... @@ -5,9 +5,13 @@ global tide
5 5 liste = get(hObject,'String') ;
6 6 I = get(hObject,'Value') ;
7 7 file = liste{I} ;
8   -A = load(['data/tide/' file]) ;
9   -B = fieldnames(A) ;
10   -C = getfield(A,B{1}) ;
11   -tide = struct('dnum',C.dnum,'time_AHT',C.time_AHT,'nm',C.nm) ;
  8 +if strcmp(file,'')
  9 + clearvars -global tide;
  10 +else
  11 + A = load(['data/tide/' file]) ;
  12 + B = fieldnames(A) ;
  13 + C = getfield(A,B{1}) ;
  14 + tide = struct('dnum',C.dnum,'time_AHT',C.time_AHT,'nm',C.nm) ;
  15 +end
12 16  
13 17 end
... ...