function mod_ge_output_tslider(filename,output,pltparams, varargin)
%
% % Please use the link below to view the documentation.
% % If you don't see the link which is automatically inserted by MATLAB,
% % try removing the line break above, so that this help block is merged
% % with the previous one.
% % Reference page in help browser: ge_output
%
% etm mods lines 36-44 to define a style to NOT get directions in the
% balloons
% added plt_params to bracket starting ans ending years and hopfully force
% the time slider to start open.
% pltparams is a cell with 3 elements : start year, end year and the
% position of the last instrument read.
AuthorizedOptions = authoptions('ge_output' );
% Assign default values to parameters:
name = filename;
msgToScreen = false;
parsepairs %script that parses Parameter/value pairs.
if msgToScreen
disp(['Running ' mfilename '...'])
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
fileoutput = filename( (end-2):end );
if strcmp(fileoutput,'kml')
fid = fopen(filename, 'wt');
if (isempty(pltparams))
styr='1975-01-01';
enyr='2010-12-31';
posn='-71,41,0';
else
% extract some stuff from yr_dur in varargin
styr=[char(pltparams{1}) '-01-10'];
enyr=[char(pltparams{2}) '-12-31'];
posn=char(pltparams{3});
% do some math to offset the info placemark
%idx=findstr(char(pltparams{3}),',');
% p1=str2num(char(pltparams{3}(1:idx(1)-1)))-1;
% p2=str2num(char(pltparams{3}(idx(1)+1:idx(2)-1)))+1;
% posn2=[num2str(p1) ',' num2str(p2) ',2000'];
end
% header includes style definitions for use by the icons & baloons,
% and the USGS overlay, and a helpful note about using the time-slider
header = ['',10,...
'',10,...
'',10,...
'',10,name,10,'',10,...
'',10,...
'',10,...
'Nothing but ocean?',10,...
' ',10,...
'',10,...
' http://stellwagen.er.usgs.gov/images/helptxt.png ',10,...
' ',10,...
'',10,...
'',10,...
'',10,...
'',10,...
'',10,...
' USGS Logo',10,...
' white background ',10,...
' B0FFFFFF',10,...
' 0 ',10,...
' ',10,...
' ',10,...
' http://stellwagen.er.usgs.gov/images/c_168_USGS.gif',10,...
' ',10,...
' ',10,...
' ',10,...
' ',10,...
'',10,...
'',10,...
'USGS Logo',10,...
' Created by the USGS Coastal Marine Geology Progrm',10,...
' 1 ',10,...
' ',10,...
' http://stellwagen.er.usgs.gov/images/c_168_USGS.gif',10,...
' ',10,...
' ',10,...
' ',10,...
' ',10,...
'',10,...
'',10,...
'inst_id',10,...
' 1' ];
footer = [10, '',10,...
'',10,...
''];
fprintf(fid,'%s',header);
fprintf(fid,'%s',output);
fprintf(fid,'%s',footer);
fclose(fid);
elseif strcmp(fileoutput,'kmz')
newfilename = filename(1:(end-4));
newfilename = strcat(newfilename,'.kml');
fid = fopen( newfilename, 'wt');
header = ['',10,...
'',10,...
'',10,...
'',10,name,10,'',10];
footer = [10,'',10,...
'',10];
fprintf(fid,'%s',header);
fprintf(fid,'%s',output);
fprintf(fid,'%s',footer);
fclose(fid);
zip(filename,newfilename);
if ispc
eval(['!del ',newfilename] );
eval(['!move ',filename, '.zip ', filename])
else
eval(['!rm -f ',newfilename]);
eval(['!mv ',filename, '.zip ', filename])
end
else
error('unsupported file extension used in ge_output');
end
if msgToScreen
disp(['Running ' mfilename '...Done'])
end