MATLAB version 7.5.0.342 (R2007b) was used to process the tide stations and bathymetry. The commands issued in MATLAB rely on MATLAB m files written by the USGS in Woods Hole, MA. The series of scripts used are: julian.m, linterp.m, gregorian.m, s2hms.m, and hms2h.m. There are actually two separate bathymetry files (both called bathy.dat) in separate folders that are being processed. One is the HYPACK data plus the CRP bathymetry data from Julian day 102. The other bathy.dat file represents the bathymetry extracted from Julian day 105 when the HYPACK system was not recording. So this series of commands is actually run twice - in the two separate folders. The following MATLAB commands were issued to process the data including comments explaining some of the processes. The comment lines are prefaced with the "%".
%Step 1. Outside of Matlab, format the ASCII tide gauge data.
%Load the tide data.
load ir_tides.dat
load rd_tides.dat
greg_ir=ir_tides(:,3:7); %year month day hour minute needs to be in columns 3,4,5,6,7
greg_ir(:,6)=zeros(length(greg_ir(:,1)),1); %adding secs bc the tide file doesn't have any
greg_rd=rd_tides(:,3:7);
greg_rd(:,6)=zeros(length(greg_rd(:,1)),1);
%then establish the julian timebase for the observed tide data
jd_ir=julian(greg_ir);
jd_rd=julian(greg_rd);
h_ir=ir_tides(:,8); %observed tide in meters (in this case above NGVD29)
h_rd=rd_tides(:,8);
%Step 2: outside of Matlab I reformatted my bathy data. The original data was exported
%from a shapefile using XTools and then needed to be reformatted for my needs here
load bathy.dat %there are 2 bathy.dat file in 2 separate folders
jd0=julian([2010 1 1 0 0 0]); %starting point for yearday
%setting the julian time base for the ship stuff
%this assumes column 1=jd, 2=hour, 3=min, 4=sec
jdtrack=jd0+bathy(:,1)-1+(bathy(:,2)+bathy(:,3)/60+bathy(:,4)/3600)/24;
x=bathy(:,5); %longitude in decimal degrees in column 5
y=bathy(:,6); %latitude in decimal degrees in column 6
htrack=bathy(:,7);
%Step 3: interpolate observed tide data onto the ship track timebase using a linear
%interpolation. Splining the tide data could result in overshoots
tidetrack_ir=linterp(jd_ir,h_ir,jdtrack);
tidetrack_rd=linterp(jd_rd,h_rd,jdtrack);
h_corrected_ir=htrack-tidetrack_ir;
h_corrected_rd=htrack-tidetrack_rd;
%Step 4: output the information I want into a text file. I decided I basically want my
%original bathymetry data, plus the tide value and the corrected value
%I have to use the ' to get the columns flipped so the append thing works
alltidestuff=[bathy'; tidetrack_ir'; h_corrected_ir';tidetrack_rd';h_corrected_rd'];
outfile=['veetest'];
fid=fopen(outfile,'w');
fprintf(fid,'%03d:%02d:%02d:%02d, %9.6f, %9.6f, %3.1f, %3.1f, %3.1f, %3.1f, %3.1f \n',alltidestuff);
fclose(fid);
The result is a comma-delimited text file with 8 columns of information: jdtime, longitude, latitude, depth_m, ir_tide, ir_cor, rd_tide, rd_cor
The definition of this header information is as follows:
jdtime: julian day and time from the GPS
longitude: longitude from the GPS
latitude: latitude from the GPS
depth_m: depth in meters of the fathometer (as recorded by the GPS)
ir_tide: interpolated tide values at the GPS time from the Indian River Inlet tide station
ir_cor: the corrected depth in meters of the fathometer based on the Indian River tide value (depth_m - ir_tide)
rd_tide: interpolated tide values at the GPS time from the Rosedale Beach tide station
rd_cor: the corrected depth in meters of the fathometer based on the Rosedale tide value (depth_m - rd_tide)
The header line was added to the veetest file and saved under a new file name: hypbathytides.csv and jd105_moredepths.csv