function bOK = wave2netcdf2Col(strOutPath, strOutFile, vDate, vH33, vGTZ);
% function bOK = wave2netcdf4Col(strOutPath, strOutFile, vDate, vH33, vGTZ);
%
% Converts ASCII files with wave time series data into netCDF
% format. The ASCII files with raw data format contains significant 
% storms in the Belgiam coast. The data has been prepared for the MICORE 
% project: www.micore.eu
%
% #INPUTS:  -strInPath: string with the dictory path where the raw data is
%            saved. Relative paths are allowed, e.g. '../raw/19931115/'.
%            Include the / sign at the end of the string.
%           -strInFile: string with the name of the input ASCII file
%           -strOutPath: string with the dictory path where the output file
%            will be saved. Relative paths are allowed, e.g. '../raw/19931115/'.
%           -strOutFile: string with the name of the output file in format
%            netCDF
%
% #OUTPUTS: -bOK: Boolean with the result of the conversion from ASCII to netCDF
%
% #REMARKS: * The format of the raw data ASCII file is:
%             - Lines of comments starting with % sign
%             - 1st column date: YYYYMMDD.HHmmSS
%             - 3rd column: H33: Significant wave height of the 1/3 of the highest waves in [m]
%             - 4th column: GTZ: Average wave period in [sec]
%             Nodata values are -999.00
%           * This function calls functions from the OpenEarth Matlab
%             library
%

% International Marine and Dredging Consultants, IMDC
% www.imdc.be
% Antwerp, Belgium
%
% Written by: Fernando Toro, Piet Haerens
%             fto@imdc.be
% Date: July 2009
% Modified: April 2011
% Date:

% Create output netCDF file
strPathOut = fullfile(strOutPath, strOutFile);
nc_create_empty(strPathOut);
nc_add_dimension(strPathOut, 'time', length(vDate));

% Add variables
timeVariable = struct(...
    'Name', 'Time', ...
    'Nctype', 'double', ...
    'Dimension', {{'time'}}, ...
    'Attribute', struct('Name', 'unit', 'Value', 'days') ...
    );
nc_addvar(strPathOut, timeVariable);
vH33Variable = struct(...
    'Name', 'H33', ...
    'Nctype', 'float', ...
    'Dimension', {{'time'}}, ...
    'Attribute', struct('Name', 'unit', 'Value', 'metre') ...
    );
nc_addvar(strPathOut, vH33Variable);
vGTZVariable = struct(...
    'Name', 'GTZ', ...
    'Nctype', 'float', ...
    'Dimension', {{'time'}}, ...
    'Attribute', struct('Name', 'unit', 'Value', 'sec') ...
    );
nc_addvar(strPathOut, vGTZVariable);

% Put variables
nc_varput(strPathOut, 'Time', vDate);
nc_varput(strPathOut, 'H33', vH33);
nc_varput(strPathOut, 'GTZ', vGTZ);
nc_dump(strPathOut);
bOK = 1;
