The tidal data is a CSV file generated by saving Willis’ spreadsheet in CSV format. It is to large to attach to this post but you can create it easily by simply opening Willis’ spreadsheet in Excel and then saving it as a CSV file called “All Tide Data.csv”.
The scripts below were run in Matlab to generate the graphics images, but should also run in freemat. They are attached below in the text, you will need to save each script to a separate .m file for use.
Graphs are shown for 13 different locations which have at least 100 years of uninterrupted tidal data.
Each graph shows two periodograms:
1. The original data is graphed using a solid blue line.
2. The data augmented with fake solar signal is graphed using red circles (no lines between points).
This makes it easier to see where the two sets of data are different.
There are graphs for all tidal locations with at least 100 years of uninterrupted data.
I could not find 60 years of uninterrupted data for the location Brest (there was only 56 years there that I could find uninterrupted).
The periodogram used is a modified windowed periodogram using a Hanning window of the same length as the data. Other modifications to the periodogram such as the Welch method were not tried.
cr=find(c == 13);
lf=find(c == 10);
if (numel(cr)+numel(lf)) > 0
% returns a “fake” solar signal with a peak amplitude equal to
% “magnitude”, a period in years of “periodYears” and with an
% initial phase of “phaseDegrees” at the first sample.
% The returned array will contain “length” points with an assumed
% time sample interval of 1/12 year.
% tides is an n-by-m array containing tide data for “n” different
% dates and “m” different locations.
% for each location (column) in the tides array, finds the longest
% contiguous string of non-zero data. the length of longest contiguous
% data for each location is returned in the m-by-1 lengths array.
% the beginning and end indices of the longest data runs are returned
% in the columns of the m-by-2 ranges array.
% ranges(k,1) is the start index of longest run for the k’th location
% ranges(k,2) is the end index for the k’th location
% For example, tides(ranges(k,1):ranges(k,2),k) returns the longes
% contiguous run of data for the k’th location.
% initialize return value arrays
% find all missing data points (where tides array is zero)
missing=find(tides(:,loc) == 0);
% add points before and after last points to make the computation below
% compute the amount of non-zero data between each successive pair of
% missing data points
% from this, calculate the maximum un-interrupted span of data and get
% its beginning and ending indices
% loads tidal data from CSV file
% year is n-by-1 array containing the year and fractional year of each entry
% locations is a m-by-1 cell array containing strings from the column headers
% tides is an n-by-m array containing tide data for each location columns.
% missing tide data is represented by zeros
% read header line as a string
% extract station names by breaking at comma characters
% this script loads tidal data if not already loaded, then
% generates two FFT’s of the data for one of the locations
% in the tidal data array (determined by variable “loc”).
% A “fake” solar signal with period of “solarPeriod” years is added
% to the tidal data before generating the second FFT.
freemat=exist(‘periodogram’,’file’) == 0;
[year,locations,tides]=loadAllTideData(‘All Tide Data.csv’);
goodLocs=find(contiguousLengths >= (requiredLengthYears*12));
% loop through each tidal location which has an adequately long
% string of uninterrupted data, and plot two periodograms for that
% 1) Periodogram of the raw tide data
% 2) Periodogram of raw data plus the fake solar signal
% The raw data is plotted with a blue solid line and the augmented
% periodogram is plotted with red circles on top of the blue line
% this makes it easy to see places where the two sets of data are
loc=goodLocs(locIdx); % set this to the index of a tide gauge location to be analyzed
% extract the data subset for this location
% create time axis in years starting at zero; there are 12 points per
% before computing the periodogram the following steps are taken:
% 1) Remove any linear trend by performing a straight line fit and
% subtracting the resulting fit from the data.
% 2) Offset the data so that it has zero mean.
% create the fake solar signal with amplitude of 2.5mm as specified
% in Dr. Shaviv’s published article. Period in years and phase offset
% may be adjusted to examine effects.
solarMag=2.5; % mm
solarPeriod=11.5; % years
solarPhase=0.0; % degrees
% compute the periodogram
% freemat does not have the periodogram function
% so we synthesize if from an FFT instead
% remove zero frequency data point so when we compute period,
% there is no divide by zero error
% compute frequency in years from radian frequency based on
% a sample rate of 12 times per year.
% scale periodograms to be relative to peak value in percent
% compute period in years
% plot the data
ylabel(‘Amplitude, percent of peak’);
legend(‘Original Data’,’Data plus 11-year Signal’);
title(sprintf(‘Periodogram for %1.0f years of Tide Data at %s’,…
% can print to file in freemat too but not sure what cmd format
% this pause feature may not work so well in freemat.
% consider removing it and just plotting one location at a time
% by putting a break here or removing the containing loop
% uncomment next line to save graph images