% Converts ASCII files with wind 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 = {'Wind_MP0WI1_19900225_19900301.txt'; ...
           'Wind_MP0WI1_19940127_19940129.txt'; ...
           'Wind_MP0WI1_19961028_19961030.txt'; ...
           'Wind_MP0WI1_20071108T1800000_20071110T180000.txt'; ...
           'Wind_MP0WI1_20071125_20071126.txt'; ...
           'Wind_MP0WI2_20071108T1800000_20071110T180000.txt'; ...
           'Wind_MP7WI1_19941231T120000_19950103T120000.txt'; ...
           'Wind_MP7WI1_19960828_19960830.txt'; ...
           'Wind_MP7WI1_19961028_19961030.txt'; ...
           'Wind_MP7WI1_20070317T18000_20070319T060000.txt'; ...
           'Wind_MP7WI1_20071108T1800000_20071110T180000.txt'; ...
           'Wind_MP7WI1_20071125_20071126.txt'; ...
           'Wind_VR_WI_19931114_19931115.txt'; ...
           'Wind_ZBR_19931114_19931115.txt'};
    
cOutFile = {'Wind_MP0WI1_19900225_19900301.nc'; ...
           'Wind_MP0WI1_19940127_19940129.nc'; ...
           'Wind_MP0WI1_19961028_19961030.nc'; ...
           'Wind_MP0WI1_20071108T1800000_20071110T180000.nc'; ...
           'Wind_MP0WI1_20071125_20071126.nc'; ...
           'Wind_MP0WI2_20071108T1800000_20071110T180000.nc'; ...
           'Wind_MP7WI1_19941231T120000_19950103T120000.nc'; ...
           'Wind_MP7WI1_19960828_19960830.nc'; ...
           'Wind_MP7WI1_19961028_19961030.nc'; ...
           'Wind_MP7WI1_20070317T18000_20070319T060000.nc'; ...
           'Wind_MP7WI1_20071108T1800000_20071110T180000.nc'; ...
           'Wind_MP7WI1_20071125_20071126.nc'; ...
           'Wind_VR_WI_19931114_19931115.nc'; ...
           'Wind_ZBR_19931114_19931115.nc'};
       
vCols = [3; 4; 3; 4; 4; 4; 3; 3; 3; 4; 4; 4; 4; 3];

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