% Converts ASCII files with water level 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 = {'Waterlevels_OSTVL1_19961028_19961030.txt'; ...
           'Waterlevel_CADZ_19931114_19931115.txt'; ...
           'Waterlevel_NPTVL1_19931114_19931115.txt'; ...
           'Waterlevel_OSTVL1_19900225_19900301.txt'; ...
           'Waterlevel_OSTVL1_19930220_19930222.txt'; ...
           'Waterlevel_OSTVL1_19931114_19931115.txt'; ...
           'Waterlevel_OSTVL1_20071108T1800000_20071110T180000.txt'; ...
           'Waterlevel_OSTVL1_20071125_20071126.txt'; ...
           'Waterlevel_VR_WL_19931114_19931115.txt'; ...
           'Waterlevel_ZLDVL1_19931114_19931115.txt'};
cOutFile = {'Waterlevels_OSTVL1_19961028_19961030.nc'; ...
           'Waterlevel_CADZ_19931114_19931115.nc'; ...
           'Waterlevel_NPTVL1_19931114_19931115.nc'; ...
           'Waterlevel_OSTVL1_19900225_19900301.nc'; ...
           'Waterlevel_OSTVL1_19930220_19930222.nc'; ...
           'Waterlevel_OSTVL1_19931114_19931115.nc'; ...
           'Waterlevel_OSTVL1_20071108T1800000_20071110T180000.nc'; ...
           'Waterlevel_OSTVL_20071125_20071126.nc'; ...
           'Waterlevel_VR_WL_19931114_19931115.nc'; ...
           'Waterlevel_ZLDVL1_19931114_19931115.nc'};
cZRef = {'TAW'; ...
         'NAP'; ...
         'TAW'; ...
         'TAW'; ...
         'TAW'; ...
         'TAW'; ...
         'TAW'; ...
         'TAW'; ...
         'NAP'; ...
         'TAW'};

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