function T = TRAJ3Dstruct( DIM )
% TRAJ3STRUCT  Creates an empty default TRAJ3 structure for saving
% trajectories information
%
% Usage: TRAJ3 = TRAJ3struct ( DIM )
%
% This function should be used *every* time one wants to generate any type
% of Lagrangian trajectories as this will assure they have the same
% format.
%
% Inputs
% ------
%
% DIM: Size of trajectory matrices. A two element vector
% with [ NGridPts, NTimeStamps ].  Defaults to [ 0 0 ].
%
% Outputs
% -------
%
% TRAJ3: is the empty structure to use for recording trajectories data.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% 	$Id: TRAJ3struct.m 1 2014-11-17 13:32:29Z efredj $	
%
% Based on TRAJstruct from David M. Kaplan
% Copyright (C) 2014 Erick Fredj
% Licence: GPL
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if ~exist( 'DIM' , 'var' )
  DIM = [0 0];
end

% General
T.Type = 'Lagrangian_Trajectories3d';
T.TrajectoryDomain = '';
T.CreationInfo = '';

% Time
T.TimeStamp = repmat(NaN,[1,DIM(2)]);
T.TimeZone = 'GMT';

T.CreateTimeStamp = now;
T.CreateTimeZone = 'GMT';

T.TrajectoryDuration = repmat(NaN,[DIM(1),1]);

% Space
T.InitialLonLatDepth = repmat( NaN, [DIM(1),3] );
T.FinalLonLatDepth = repmat( NaN, [DIM(1),3] );

[T.Lon,T.Lat,T.Depth] = deal( repmat( NaN, DIM ) );

% Some units
T.LonLatUnits = { 'Decimal Degrees', 'Decimal Degrees' };
T.DepthUnits = 'm';

% Other
T.OtherMatrixVars = []; % Should eventually be a structure.
T.OtherSpatialVars = []; % Should eventually be a structure.
T.OtherTemporalVars = []; % Should eventually be a structure.
T.OtherMetadata = []; % Should eventually be a structure.

T.ProcessingSteps = {};
T.TRAJ3_struct_version = 'SVN $Rev: 1 $ $Date: 2014-11-17 13:35:29 +0000 (Mon, 17 Nov 2014) $';
