function outputFiles = WaveTransformationTable(startDay,startTime,stopDay,stopTime,lon,lat,varargin)
%WAVETRANSFORMATIONTABLE  wrapper function for Transform
%
%   THis calls Transform which uses waveRose. WaveRose is not a public
%   function and therefore not part of this repos. To compile the code
%   successfully one should add the waveRose function to the search path
%   when compiling.
%
%   Syntax:
%   outputPng = WaveTransformationTable(startTime,stopTime,lon,lat,varargin)
%
%   Input:
%   startTime = the start time as a string in the form "11/10/1980"
%   endTime   = the end time as a string in the form "11/10/1980"
%   lon / lat = a double with the longitude or latitude
%   varargin  = can contain a directory name that is used to publish the
%               result files
%
%   Output:
%   outputPng = path of the output file(s)
%
%   Example
%   WaveTransformationTable
%
%   See also Transform

%% Copyright notice
%   --------------------------------------------------------------------
%   Copyright (C) 2011 Deltares
%       Pieter van Geer
%
%       pieter.vangeer@deltares.nl
%
%       Rotterdamseweg 185
%       2629 HD Delft
%       P.O. 177
%       2600 MH Delft
%
%   This library is free software: you can redistribute it and/or
%   modify it under the terms of the GNU Lesser General Public
%   License as published by the Free Software Foundation, either
%   version 2.1 of the License, or (at your option) any later version.
%
%   This library is distributed in the hope that it will be useful,
%   but WITHOUT ANY WARRANTY; without even the implied warranty of
%   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
%   Lesser General Public License for more details.
%
%   You should have received a copy of the GNU Lesser General Public
%   License along with this library. If not, see <http://www.gnu.org/licenses/>.
%   --------------------------------------------------------------------

% This tool is part of <a href="http://OpenEarth.nl">OpenEarthTools</a>.
% OpenEarthTools is an online collaboration to share and manage data and
% programming tools in an open source, version controlled environment.
% Sign up to recieve regular updates of this function, and to contribute
% your own tools.

%% Version <http://svnbook.red-bean.com/en/1.5/svn.advanced.props.special.keywords.html>
% Created: 10 Mar 2011
% Created with Matlab version: 7.11.0.584 (R2010b)

% $Id$
% $Date$
% $Author$
% $Revision$
% $HeadURL$
% $Keywords: $

%% Generate output name
[outputPath outputFileBase] = fileparts(generateoutputpngname(varargin{:}));
outputFile = fullfile(outputPath,[outputFileBase,'.txt']);

rdOut=geo2rd([lon lat]);

xRD = rdOut(1);
yRD = rdOut(2);

%% parameters
s.StartDate         = datenum([startDay ' ' startTime],'dd/mm/yyyy HH:MM:SS');
s.EndDate           = datenum([stopDay ' ' stopTime],'dd/mm/yyyy HH:MM:SS');
s.Loc.X             = xRD;             % x-coordinates RD >> make sure it is in the model domain
s.Loc.Y             = yRD;             % y-coordinates RD >> make sure it is in the model domain
s.OutputFile        = outputFile;          % name of outputfile

%% run
Transform(s);

outputFiles = {...
    fullfile(outputPath,[outputFileBase,'.txt']),...
    fullfile(outputPath,[outputFileBase,'_waverose.pdf']),...
    fullfile(outputPath,[outputFileBase,'_timeseries.pdf'])};