Commit 47c77104385204cf1265b8e4cb1999db1ac25235

Authored by Jean-Luc Shaw
1 parent 172e16b4
Exists in master

Started documentation file. Fixed but_delete_Callback.m, was not deleting S.z data

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 10-Apr-2018 12:40:42
  25 +% Last Modified by GUIDE v2.5 11-Apr-2018 13:27:51
26 26  
27 27 % Begin initialization code - DO NOT EDIT
28 28 gui_Singleton = 1;
... ... @@ -277,3 +277,26 @@ function edit_aux_ymin_CreateFcn(hObject, eventdata, handles)
277 277 if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
278 278 set(hObject,'BackgroundColor','white');
279 279 end
  280 +
  281 +
  282 +% --- Executes on selection change in menu_tide_files.
  283 +function menu_tide_files_Callback(hObject, eventdata, handles)
  284 +% hObject handle to menu_tide_files (see GCBO)
  285 +% eventdata reserved - to be defined in a future version of MATLAB
  286 +% handles structure with handles and user data (see GUIDATA)
  287 +
  288 +% Hints: contents = cellstr(get(hObject,'String')) returns menu_tide_files contents as cell array
  289 +% contents{get(hObject,'Value')} returns selected item from menu_tide_files
  290 +
  291 +
  292 +% --- Executes during object creation, after setting all properties.
  293 +function menu_tide_files_CreateFcn(hObject, eventdata, handles)
  294 +% hObject handle to menu_tide_files (see GCBO)
  295 +% eventdata reserved - to be defined in a future version of MATLAB
  296 +% handles empty - handles not created until after all CreateFcns called
  297 +
  298 +% Hint: popupmenu controls usually have a white background on Windows.
  299 +% See ISPC and COMPUTER.
  300 +if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
  301 + set(hObject,'BackgroundColor','white');
  302 +end
... ...
documentation.txt 0 → 100644
... ... @@ -0,0 +1,99 @@
  1 +======================================================================
  2 +===== DOCUMENTATION for coastal drifter quality control tool ======
  3 +======================================================================
  4 +
  5 +Oceanographic drifter GPS data collected from coastal areas can be
  6 +messy, and heterogenous. The purpose of this tool is to efficiently
  7 +process drifter tracks which may contain several instances of beaching,
  8 +missing pings, irregular pings and inland data, using an interactive
  9 +GUI based approach so you can see what you are doing while you work.
  10 +
  11 +Upon output, several useful parameters are also calculated. The cleaned
  12 +.mat files are contain u, v, normed speed, heading, depth bellow, sea
  13 +level and time after high tide. The latter two are only calculated if
  14 +bathymetric and tidal have been provided.
  15 +
  16 +Other than the very useful m_lldist.m function which is from Rich
  17 +Pawlowicz's m_map package and which he owns, all software is written
  18 +by Jean-Luc Shaw in 2018. You can freely use and distribute but you can
  19 +not sell it.
  20 +
  21 +Feel free to contact me if you have any questions.
  22 +
  23 +Jean-Luc Shaw, M Sc student in physical oceanography
  24 +jean-luc.shaw@uqar.ca
  25 +
  26 +===== WORKFLOW =====
  27 +
  28 +First, your directory tree should be set up as follows:
  29 +
  30 +-GUI_drifter_cleanup
  31 +--data
  32 +---bathy
  33 +---gps
  34 +----clean
  35 +----raw
  36 +--lib
  37 +--log
  38 +--tools
  39 +
  40 +Next copy your unprocessed gps drifter tracks to the 'raw' folder.
  41 +Your raw files need to be structures stored in '.mat' files. The
  42 +structure needs to be named 'data' and have the following fields:
  43 +
  44 +data.lon : longitude vector
  45 +data.lat : latitude vector
  46 +data.timeM : time in matlab format (fraction of day)
  47 +
  48 +Obviously they all need to be of same length. You can now copy
  49 +bathymetric data and tide data respectively to the bathy and tide
  50 +folders. While this is optionnal certain functions of the software
  51 +will require them to run.
  52 + The bathymetry file should be a scatteredInterpolant or
  53 +triscatteredInterp object stored in a '.mat' file and built using
  54 +depth positive towards the sea floor and a geographical grid in
  55 +latitude and longitude coordinates.
  56 + The tide file should be a matlab structure stored in a '.mat'
  57 +file and contain the following fields:
  58 +
  59 +T.dnum : time in matlab format ( fraction of day )
  60 +T.nm : local sea level (m)
  61 +T.time_AHT : time after high tide (h)
  62 +
  63 +
  64 +Now all the required files are in place and you may launch the utility
  65 +by running GUI_drifter_cleanup.m . You may then use the following
  66 +sequence of operations as guidelines to quality control of your data.
  67 +
  68 +1 - Select a drifter file from the popup menu
  69 +2 - Select a bathymetry file from the popup menu (optionnal)
  70 +3 - Select a tide file from the popup menu (optionnal)
  71 +4 - Adjust the indexes I0 and If to browse through the file
  72 +5 - Toggle the auxilliary data view to spot bad data
  73 +6 - Delete bad data
  74 +7 - Find a good looking section of the track
  75 +8 - Filter inland data (optionnal)
  76 +9 - Get the track time step
  77 +10 - Reinterpolate on a regular time grid
  78 +11 - Punch this cleaned section out to a mat file
  79 +12 - Repeat from step 4 until all good data has been exported
  80 +13 - Do science ... !
  81 +
  82 +
  83 +===== FUNCTION DESCRIPTION =====
  84 +
  85 +RANGE (I0 and If) :
  86 +
  87 +DELETE :
  88 +
  89 +UNDO :
  90 +
  91 +FILTER z < X :
  92 +
  93 +GET TIME STEP :
  94 +
  95 +INTERPOLATE :
  96 +
  97 +PUNCH OUT :
  98 +
  99 +OPERATION LOG :
0 100 \ No newline at end of file
... ...
lib/but_bathy_filter_Callback.m
... ... @@ -4,8 +4,6 @@ global S
4 4  
5 5 if isfield(S,'z')
6 6 zmin = str2num(handles.edit_zmin.String) ;
7   - numel(S.z)
8   - numel(S.lon)
9 7 I = find(S.z < zmin) ;
10 8 S.lon(I) = [] ;
11 9 S.lat(I) = [] ;
... ...
lib/but_delete_Callback.m
... ... @@ -9,6 +9,7 @@ If = str2num(handles.edit_If.String);
9 9 S.lon(I0:If) = [];
10 10 S.lat(I0:If) = [];
11 11 S.dnum(I0:If) = [];
  12 +if isfield(S,'z') ; S.z(I0:If) = []; end
12 13  
13 14 % write to logfile
14 15 newN = numel(S.dnum) ; % track size
... ...
lib/menu_bathy_files_Callback.m
... ... @@ -6,9 +6,9 @@ global bathy S
6 6 liste = get(hObject,'String') ;
7 7 I = get(hObject,'Value') ;
8 8 file = liste{I} ;
9   -fpath = ['data/bathy/' file] ;
10   -load(['data/bathy/' file]) ;
11   -bathy = F_BSI ; % inelegant but simple
  9 +A = load(['data/bathy/' file]) ;
  10 +B = fieldnames(A);
  11 +bathy = getfield(A,B{1}) ; % inelegant but simple
12 12  
13 13 if isstruct(S)
14 14 S.z = bathy(S.lon,S.lat) ;
... ...