function fig = tsview(insite) % This is the machine-generated representation of a Handle Graphics object % and its children. Note that handle values may change when these objects % are re-created. This may cause problems with any callbacks written to % depend on the value of the handle at the time the object was saved. % % To reopen this object, just type the name of the M-file at the MATLAB % prompt. The M-file and its associated MAT-file must be on your path. if nargin == 0 clear all end load tsview; % Generate the list of sites that are needed. d = dir ; % % Get the names of all files in the directory dnames = {d.name}; % get all file names with mb_ in the first three characters dnames = dnames(strncmp(dnames,'mb_',3)); % Now sort the names dnames = sort(dnames)'; % Reduce the names further by getting only the site names j = 0 ; sites = []; for i = 1:length(dnames) tname = cell2struct(dnames(i),'name'); if findstr(tname.name,'.dat1') j = j + 1; st = tname.name; sites = [sites;st(4:11)]; end end % See if an argument has been passed selsite = 0; if nargin == 1 % Name of site has been passed so pass this to GUI for i = 1:length(sites) if sites(i,:) == insite , selsite = i ; end end fprintf(1,'Site number %d selected\n',selsite) end % Set root units to pixels and get screen size set(0,'Units','pixels') ; scnsize = get(0,'ScreenSize'); % Set an effective Max screen Size if scnsize(3) > 1280 , scnsize(3) = 1280; end if scnsize(4) > 960 , scnsize(4) = 960; end % Compute the Figure size we want figsize = [(scnsize(3)-scnsize(1))*0.93 (scnsize(4)-scnsize(2))*0.90]; % Set the border widths of the figure shell bdwidth = figsize(2)*0.02; topbdwidth = figsize(2)*0.05; % Set the size of the axis and the space in brtween axisspace = figsize(2)*0.05; axiswt = figsize(1)*0.68; axisht = figsize(2)*0.25; % Compute and set the position and size of the figure shell pos = [4*bdwidth, bdwidth, figsize(1) figsize(2) ]; h0 = figure('Units','pixels', ... 'Color',[0.8 0.8 0.8], ... 'Colormap',mat0, ... 'Position',pos, ... 'Tag','Fig1', ... 'ResizeFcn','GPSResize;') ; % Compute and set the position and size axis 1 (N component) pos = [bdwidth + figsize(1)*0.28,... bdwidth + axisspace*3 + (axisht)*2,... axiswt, axisht]; h1 = axes('Parent',h0, ... 'Units','pixels', ... 'CameraUpVector',[0 1 0], ... 'Color',[1 1 1], ... 'ColorOrder',mat1, ... 'Position',pos, ... 'Tag','Axis1', ... 'XColor',[0 0 0], ... 'YColor',[0 0 0], ... 'ZColor',[0 0 0]); % Compute and set the position and size axis 2 (E component) pos = [bdwidth + figsize(1)*0.28,... bdwidth + axisspace*2 + axisht,... axiswt, axisht]; h2 = axes('Parent',h0, ... 'Units','pixels', ... 'CameraUpVector',[0 1 0], ... 'Color',[1 1 1], ... 'ColorOrder',mat1, ... 'Position',pos, ... 'Tag','Axis2', ... 'XColor',[0 0 0], ... 'YColor',[0 0 0], ... 'ZColor',[0 0 0]); % Compute and set the position and size axis 3 (U component) pos = [bdwidth + figsize(1)*0.28,... bdwidth + axisspace,... axiswt, axisht]; h3 = axes('Parent',h0, ... 'Units','pixels', ... 'CameraUpVector',[0 1 0], ... 'Color',[1 1 1], ... 'ColorOrder',mat1, ... 'Position',pos, ... 'Tag','Axis3', ... 'XColor',[0 0 0], ... 'YColor',[0 0 0], ... 'ZColor',[0 0 0]); % Compute and set the position and size of the site list box pos = [bdwidth*2,... axisht,... figsize(1)*0.1, figsize(2)-axisht-2*bdwidth]; hs = uicontrol('Parent',h0, ... 'Units','pixels', ... 'BackgroundColor',[1 1 1], ... 'Position',pos, ... 'String',sites, ... 'Style','listbox', ... 'Tag','ListboxSites', ... 'Value',1, ... 'UserData',sites) ; lbtop = axisht + figsize(2)-axisht-2*bdwidth; lbbot = axisht; % Compute and set the position and size of the gui buttons buttony = figsize(2)*0.045; buttonx = figsize(1)*0.09; buttonxpos = pos(1) + pos(3) + bdwidth; buttonypos = lbtop - buttony; buttonspace = figsize(2)*0.01; % Load button pos = [buttonxpos, buttonypos,... buttonx, buttony]; cbload = sprintf('gpsgui(''Load'',%d)',selsite); hl = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback',cbload, ... 'Position',pos, ... 'Value',selsite, ... 'String','Load', ... 'Tag','Pushbutton1', ... 'TooltipString','Load Selected Data'); % Append button pos = [buttonxpos,... (buttonypos - buttonspace - buttony),... buttonx,... buttony]; ha = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','gpsgui(''Append'')', ... 'Position',pos, ... 'String','Append', ... 'Tag','Pushbutton2', ... 'TooltipString','Append data to current'); % Detrend button pos = [buttonxpos,... (buttonypos - buttonspace*2 - buttony*2),... buttonx,... buttony]; hd = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'Callback','gpsgui(''Detrend'')', ... 'String','Detrend', ... 'Tag','Pushbutton3', ... 'TooltipString','Show detrended data'); % Edit Button pos = [buttonxpos,... (buttonypos - buttonspace*3 - buttony*3),... buttonx,... buttony]; he = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','gpsgui(''Edit'')', ... 'Position',pos, ... 'String','Edit', ... 'Tag','Pushbutton4', ... 'TooltipString','Edit data, Right mouse button allows repeated selection'); % Block Edit button pos = [buttonxpos,... (buttonypos - buttonspace*4 - buttony*4),... buttonx,... buttony]; hb = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','gpsgui(''BlockEdit'')', ... 'Position',pos, ... 'String','Block Edit', ... 'Tag','Pushbutton6', ... 'TooltipString','Select region to edit'); % Break button pos = [buttonxpos,... (buttonypos - buttonspace*5 - buttony*5),... buttonx,... buttony]; hj = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','gpsgui(''Break'')', ... 'Position',pos, ... 'String','Break', ... 'Tag','Pushbutton5',... 'TooltipString','Insert breaks data, Right mouse button allows repeated selection'); % Zoom button pos = [buttonxpos,... buttonypos - buttonspace*6 - buttony*6,... buttonx,... buttony]; hz = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','zoom on', ... 'Position',pos, ... 'String','Zoom', ... 'Tag','ZoomButton', ... 'TooltipString','Turn Zoom on'); % Span button pos = [buttonxpos,... buttonypos - buttonspace*7 - buttony*7,... buttonx,... buttony]; hz = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','gpsgui(''Span'')', ... 'Position',pos, ... 'String','Span', ... 'Tag','Pushbutton7', ... 'TooltipString','Select region to span'); % Save button pos = [buttonxpos,... buttonypos - buttonspace*8 - buttony*8,... buttonx,... buttony]; %fprintf(1,' %10.1f %10.1f %3d %3d %s\n', pos,'save') hz = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Callback','gpsgui(''Save'')', ... 'Position',pos, ... 'String','Save', ... 'Tag','Pushbutton8', ... 'TooltipString','Save edit and break information to a file'); % Maximum size of outliers button pos = [buttonxpos,... buttonypos - buttonspace*9 - buttony*9,... buttonx,... buttony]; hk = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'String','Max Outliers (n sigma)', ... 'FontSize',9, ... 'Style','text', ... 'Tag','Text1'); % Button selector pos = [buttonxpos,... buttonypos - buttonspace*10 - buttony*9,... buttonx,... buttony*.75]; hl = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'String',['1 ';'2 ';'3 ';'4 ';'5 ';'all'], ... 'Style','popupmenu', ... 'Tag','Outlier', ... 'TooltipString','Select outlier editing criteria', ... 'Value',6); % Maximum sigma text box pos = [buttonxpos,... buttonypos - buttonspace*11 - buttony*10,... buttonx,... buttony]; hm = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'String','Max Sigma (mm)', ... 'FontSize',9, ... 'Style','text', ... 'Tag','Text2'); pos = [buttonxpos,... buttonypos - buttonspace*12 - buttony*10,... buttonx,... buttony*.75]; hn = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'HorizontalAlignment','left', ... 'Style','edit', ... 'Tag','SigmaCut', ... 'TooltipString','Enter sigma editing criteria'); set(hn,'String',sprintf('%6.1f',1000.0)); % Retain breaks button pos = [buttonxpos,... buttonypos - buttonspace*11.5 - buttony*11.5,... buttonx,... buttony]; % fprintf(1,' %10.1f %10.1f %3d %3d %s\n', pos,'Break') hz = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'String','Keep Breaks', ... 'FontSize',9, ... 'Style','checkbox', ... 'Tag','RetainBreaks', ... 'TooltipString','Check to retain breaks on Load'); % Add break on append pos = [buttonxpos,... buttonypos - buttonspace*12.5 - buttony*12.5,... buttonx,... buttony]; % fprintf(1,' %10.1f %10.1f %3d %3d %s\n', pos,'Break') hz = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'String','Brk on Append', ... 'FontSize',9, ... 'Style','checkbox', ... 'Tag','AppendBreaks', ... 'TooltipString','Check to automatically add break on append'); % Report Edits to MATLAB Main window pos = [buttonxpos,... buttonypos - buttonspace*13.5 - buttony*13.5,... buttonx,... buttony]; % fprintf(1,' %10.1f %10.1f %3d %3d %s\n', pos,'Break') hz = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'String','Report Edits', ... 'FontSize',9, ... 'Style','checkbox', ... 'Tag','ReportEdits', ... 'TooltipString','Check to report edited values to Matlab Command Window'); % Boxes to edit the breaks pos = [buttonxpos,... buttonypos - buttonspace*14.5 - buttony*14.5,... buttonx,... buttony]; hz = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'String','Delete Breaks', ... 'FontSize',10, ... 'Style','text', ... 'Tag','BreakList'); % Button selector pos = [buttonxpos,... buttonypos - buttonspace*15.5 - buttony*14.5,... buttonx,... buttony*.75]; ho = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'Callback','gpsgui(''DeleteBreak'')', ... 'String',['None'], ... 'Style','popupmenu', ... 'Tag','DeleteBreak', ... 'TooltipString','Select Break to be removed', ... 'Value',1); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % New options for file names % % Name of the edit file. pos = [bdwidth*2,... lbbot - buttony, ... figsize(1)*0.1, buttony*.75]; ho = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'String','Name of Edit File', ... 'HorizontalAlignment','left', ... 'FontSize',10, ... 'Style','text', ... 'Tag','EdFileHead'); pos = [bdwidth*2,... lbbot - buttony*1.5 , ... figsize(1)*0.1, buttony*0.75]; hp = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'HorizontalAlignment','left', ... 'Style','edit', ... 'String','tsview.renames', ... 'Tag','EditFile', ... 'TooltipString','Name of the file created that saves the edits and breaks'); % Name of the output ensum summary file. pos = [bdwidth*2,... lbbot - buttony*3.0 , ... figsize(1)*0.1, ... buttony*0.75]; ho = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'String','Name of ENS File', ... 'HorizontalAlignment','left', ... 'FontSize',10, ... 'Style','text', ... 'Tag','EnFileHead'); pos = [bdwidth*2,... lbbot - buttony*3.5, ... figsize(1)*0.1, ... buttony*0.75]; hp = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',pos, ... 'HorizontalAlignment','left', ... 'Style','edit', ... 'String','sutsview.ens', ... 'Tag','ENSFile', ... 'TooltipString','Name of the ensum summary file. Entries added on SAVE'); % If a station name has been passed, label window as such if selsite ~=0 outmes = sprintf('ONLY Site %s and related sites can be plotted',insite); hz = uicontrol('Parent',h0, ... 'Units','pixels', ... 'Position',[10 10 figsize(1)*0.40 20], ... 'String',outmes, ... 'FontSize',12, ... 'BackgroundColor',[1 1 0], ... 'ForegroundColor',[0.6 0 0], ... 'FontWeight','bold', ... 'Style','text', ... 'Tag','SelSite'); end %hx = uicontrol('Parent',h0, ... % 'Units','pixels', ... % 'Position',[13 16 69 21], ... % 'String',['North';'East ';'Up '], ... % 'Style','popupmenu', ... % 'Tag','PopupMenu1', ... % 'TooltipString','Select North. East or Up', ... % 'Value',1); if nargout > 0, fig = h0; end