function fps = read_paroP_SeaState_2015(dfl,ddd,hhh)
%{
reads Paro 10Hz pressure sensor file specified by dfl and returns arrays
with the following columns:

1   jd_ref      10 Hz timestamp
2   Pmb         Atmospheric pressure, mb

input parameters: dfl = string path to mtx file
                  ddd = julian date
                  hhh = hour
%}

%% initialize
disp(['Reading fps file for hour ',int2str(hhh)]);
flist = fopen(dfl,'r');

st1 = [];               % data array
temp = {};              % cell array for textscan output

%% read son data
while feof(flist)==0,   % read entire file into cell array
    try
        % temp will be 1x7 cell array, cells will be ~72000x1 arrays
        temp = textscan(flist,'%2f%2f%3f %*6c %*21c %f %*[^\n]','delimiter',', ','headerlines',1,'emptyvalue',NaN);
        st1 = [st1 cell2mat(temp)'];  % 4x~36000 array
    catch
        for ii=1:4  % length of last cell reflects missing values from any/all fields
            if length(temp{1,ii})~=length(temp{1,4})
                temp{1,ii}(length(temp{1,4})+1) = [];  %truncate length of all cells to length(temp{1,8})
            end;
        end;
        if ~isempty(temp{1,1});
            st1 = [st1 cell2mat(temp)']; % append truncated cells to st1 and return for more
        end;
    end;
end;
fclose (flist);
tfps =  ddd + hhh/24 + st1(1,:)/1440 + (st1(2,:)+st1(3,:)/1000)/86400;
fp = st1(4,:);

%% adjust to exact 36000 pnt output array if necessary
start = (ddd+hhh/24);
delta = double(1.0/864000);
last = start + 35999*delta;
tref = start:delta:last;
npts = length(tfps);
if npts>36000
   fp = fp(1:36000)';
elseif npts<36000
   dn = 36000 - npts;
   fp = [fp';ones(dn,1).*fp(npts)]; % dup last point to fill
else
   fp = fp';
end;

fps = [tref' fp];
