function OPT = grid_orth_getTimeInfoInPolygon(OPT)
%GRID_ORTH_GETTIMEINFOINPOLYGON Gets all individual times from netcdf tiles in polygon.

%% Copyright notice
%   --------------------------------------------------------------------
%   Copyright (C) 2009 Delft University of Technology
%       Mark van Koningsveld
%
%       m.vankoningsveld@tudelft.nl
%
%       Hydraulic Engineering Section
%       Faculty of Civil Engineering and Geosciences
%       Stevinweg 1
%       2628CN Delft
%       The Netherlands
%
%   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 tools is part of <a href="http://OpenEarth.Deltares.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.

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

maps = grid_orth_identifyWhichMapsAreInPolygon(OPT, OPT.polygon);
OPT.inputtimes     = [];
if ~isempty(maps)
    varinfo_t = nc_varfind(maps{1},'attributename', 'standard_name', 'attributevalue', 'time');
    for i = 1:length(maps)
        OPT.inputtimes = unique([OPT.inputtimes; nc_cf_time(maps{i}, varinfo_t)]);
    end
end