function bOK = wave2netcdf4Col(strOutPath, strOutFile, vDate, vHmO, vGTZ, vRHF, vRLF);
% function bOK = wave2netcdf4Col(strOutPath, strOutFile, vDate, vHmO, vGTZ, vRHF, vRLF);
%
% 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: HmO Significant wave height from the spectrum
%             - 4th column: GTZ: Average wave period in [sec]
%             - 5th column: RHF: Direction of the waves of high frequency
%             - 6th column: RLF: Direction of the waves of low frequency
%             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);
vHmOVariable = struct(...
    'Name', 'HmO', ...
    'Nctype', 'float', ...
    'Dimension', {{'time'}}, ...
    'Attribute', struct('Name', 'unit', 'Value', 'metre') ...
    );
nc_addvar(strPathOut, vHmOVariable);
vGTZVariable = struct(...
    'Name', 'GTZ', ...
    'Nctype', 'float', ...
    'Dimension', {{'time'}}, ...
    'Attribute', struct('Name', 'unit', 'Value', 'sec') ...
    );
nc_addvar(strPathOut, vGTZVariable);
vRHFVariable = struct(...
    'Name', 'RHF', ...
    'Nctype', 'float', ...
    'Dimension', {{'time'}}, ...
    'Attribute', struct('Name', 'unit', 'Value', 'deg') ...
    );
nc_addvar(strPathOut, vRHFVariable);
vRLFVariable = struct(...
    'Name', 'RLF', ...
    'Nctype', 'float', ...
    'Dimension', {{'time'}}, ...
    'Attribute', struct('Name', 'unit', 'Value', 'deg') ...
    );
nc_addvar(strPathOut, vRLFVariable);

% Put variables
nc_varput(strPathOut, 'Time', vDate);
nc_varput(strPathOut, 'HmO', vHmO);
nc_varput(strPathOut, 'GTZ', vGTZ);
nc_varput(strPathOut, 'RHF', vRHF);
nc_varput(strPathOut, 'RLF', vRLF);
nc_dump(strPathOut);
bOK = 1;
