% 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

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

% Common input arguments
strInPath = fullfile('..', 'raw');
strOutPath = fullfile('..', 'netcdf');

% List of files to process

% vFiles = dir([strInPath,'*.txt']);
cInFile = {'Waves_AKZGB1_19930220_19930222.txt'; ...
           'Waves_AKZGB1_19931114_19931115.txt'; ...
           'Waves_AKZGB1_19940127_19940129.txt'; ...
           'Waves_AKZGB1_19941231T120000_19950103T120000.txt'; ...
           'Waves_AKZGB1_19960828_19960830.txt'; ...
           'Waves_AKZGB1_19961028_19961030.txt'; ...
           'Waves_AKZGB1_20070317T18000_20070319T060000.txt'; ...
           'Waves_AKZGB1_20071108T1800000_20071110T180000.txt'; ...
           'Waves_AKZGB1_20071125_20071126.txt'; ...
           'Waves_DELO_19931114_19931115.txt'; ...
           'Waves_SCHB_19931114_19931115.txt'; ...
           'Waves_WHIDB1_19941231T120000_19950103T120000.txt'; ...
           'Waves_WHIDB1_19960828_19960830.txt'; ...
           'Waves_WHIDB1_19961028_19961030.txt'; ...
           'Waves_WHIGB1_19900225_19900301.txt'; ...
           'Waves_WHIGB1_19930220_19930222.txt'; ...
           'Waves_WHISTB_19941231T120000_19950103T120000.txt'; ...
           'Waves_WHISTB_19960828_19960830.txt'; ...
           'Waves_WHISTB_19961028_19961030.txt'};
       
cOutFile = {'Waves_AKZGB1_19930220_19930222.nc'; ...
            'Waves_AKZGB1_19931114_19931115.nc'; ...
            'Waves_AKZGB1_19940127_19940129.nc'; ...
            'Waves_AKZGB1_19941231T120000_19950103T120000.nc'; ...
            'Waves_AKZGB1_19960828_19960830.nc'; ...
            'Waves_AKZGB1_19961028_19961030.nc'; ...
            'Waves_AKZGB1_20070317T18000_20070319T060000.nc'; ...
            'Waves_AKZGB1_20071108T1800000_20071110T180000.nc'; ...
            'Waves_AKZGB1_20071125_20071126.nc'; ...
            'Waves_DELO_19931114_19931115.nc'; ...
            'Waves_SCHB_19931114_19931115.nc'; ...
            'Waves_WHIDB1_19941231T120000_19950103T120000.nc'; ...
            'Waves_WHIDB1_19960828_19960830.nc'; ...
            'Waves_WHIDB1_19961028_19961030.nc'; ...
            'Waves_WHIGB1_19900225_19900301.nc'; ...
            'Waves_WHIGB1_19930220_19930222.nc'; ...
            'Waves_WHISTB_19941231T120000_19950103T120000.nc'; ...
            'Waves_WHISTB_19960828_19960830.nc'; ...
            'Waves_WHISTB_19961028_19961030.nc'};
       
vCols = [5; 6; 6; 6; 6; 6; 5; 5; 5; 5; 5; 4; 6; 6; 6; 6; 6; 6; 6];

% Make the job
for i=1:size(cInFile,1)
    strInFile = cInFile{i};
    strOutFile = cOutFile{i};
    nCols = vCols(i);
    bOK = wave2netcdf(strInPath, strInFile, strOutPath, strOutFile, nCols);
end
