function [] = ProcessDive(gliderID,vbd,path,DN,volmax,outputPath)
%Standalone Glider file.

close all
clc


seagliderID=gliderID;
vbdBias=vbd;
pathname=path;
diveNumber = DN;
volMax = volmax;
PlotSelect=[1 1 0 1 0 1 1 0 1 0 1 0 0 0 0 0 0 0];
autoSave=1;
autoClose=1;
autoTile=1;
OutPath=outputPath;
seaGliderID=seagliderID;

settings=struct('seagliderID',seagliderID,'vbdBias',vbdBias,'pathname',pathname,...
    'diveNumber',diveNumber,'volMax',50925,'plotSelectionState',PlotSelect,...
    'autosavePlots',autoSave,'autoclosePlots',autoClose,'autoTilePlots',autoTile,'seaGliderID',seagliderID);

[filenames] = buildFilenames(settings.pathname,settings.seagliderID,diveNumber);

diveplot_func(settings.pathname, settings.pathname, diveNumber, settings.vbdBias, settings, filenames, []);

cd(outputPath)

i=7;

OutputName=['fig','_sg',num2str(seagliderID),'_',num2str(diveNumber),'.ps'];

if exist(OutputName,'file')
delete(OutputName);
end

while(0~=i)
h = gcf;
eval(['print -dpsc -append ',OutputName])
close(h);
i=i-1;
end



system(['/usr/local/bin/ps2pdf ',OutputName,' ',num2str(gliderID),'_',num2str(DN),'_','OutputFile.pdf']);

disp "DONE"
quit
end
