function [vDate, vLevel] = readtide(strPath, strInFile);
% function [vDate, vLevel] = readtide(strPath, strInFile);
%
% Reads raw data with tide time series in the Belgiam coast.
% The data has been prepared for the MICORE project: www.micore.eu
% Raw data is in ASCII files and this function is called by another
% functions to convert these raw data files into netCDF format.
%
% #INPUTS:  -strPath: string with the directory 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
%
% #OUTPUTS: -vDate: vector (n rowsx 1 col) with the dates in Serial Date Number Format 
%           -vLevel: vector (n rowsx 1 col) with the water levels in meters 
%           and in TAW
%
% #REMARKS: The format of the raw data ASCII file is:
%             - One line of comments
%             - First column date: dd/mm/yyyy
%             - Second column time: hh:mm 
%             - Third column level: tide in meters with respect to TAW. 
%               Nodata values are -999.00
%

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

% Read values from file
path = fullfile(strPath, strInFile);
NumLines = 1;
strDelimiter = '/:|';
[B(:,1) B(:,2) B(:,3) B(:,4) B(:,5) vLevel] = textread(path, ...
    '%d %d %d %d %d %f', 'headerlines', NumLines, 'delimiter',strDelimiter);
vDate = datenum(B(:,3), B(:,2), B(:,1), B(:,4), B(:,5), 0);
