


Extract an elevation time series from a location using Xtide
function [time,zeta] = gen_zeta_xtide(Xtide_Location,tbeg,tend)
DESCRIPTION:
Extract time and an elevation series from a location using xtide
INPUT:
Xtide_Location = Location in Xtide Database
tbeg = begin time in modified Julian days UTC
tend = end time in modified Julian days UTC
OUTPUT:
time = time sequence for elevation series in modified Julian days, UTC
zeta = elevation series in meters
EXAMPLE USAGE
[time,zeta] = get_zeta_xtide('Sandy Point, Whidbey Island',54191,54466)
Author(s):
Geoff Cowles (University of Massachusetts Dartmouth)
Revision history
==============================================================================

0001 function [times,zeta] = get_zeta_xtide(Xtide_Location,tbeg,tend) 0002 0003 % Extract an elevation time series from a location using Xtide 0004 % 0005 % function [time,zeta] = gen_zeta_xtide(Xtide_Location,tbeg,tend) 0006 % 0007 % DESCRIPTION: 0008 % Extract time and an elevation series from a location using xtide 0009 % 0010 % INPUT: 0011 % Xtide_Location = Location in Xtide Database 0012 % tbeg = begin time in modified Julian days UTC 0013 % tend = end time in modified Julian days UTC 0014 % 0015 % OUTPUT: 0016 % time = time sequence for elevation series in modified Julian days, UTC 0017 % zeta = elevation series in meters 0018 % 0019 % EXAMPLE USAGE 0020 % [time,zeta] = get_zeta_xtide('Sandy Point, Whidbey Island',54191,54466) 0021 % 0022 % Author(s): 0023 % Geoff Cowles (University of Massachusetts Dartmouth) 0024 % 0025 % Revision history 0026 % 0027 %============================================================================== 0028 0029 0030 % conversions for dates and lengths 0031 unixstart = greg2mjulian(1970,1,1,0,0,0); %xtide is based on days from this date 0032 meters2feet = 3.2808399; 0033 0034 % paths to executable 0035 setpath = ' export HFILE_PATH=~gcowles/Packages/xtide/harmonics_files; '; 0036 ttide = ' /usr/local/bin/tide -b "2005-01-01 00:00" -e "2012-01-01 00:00" -l '; 0037 opts = ' -s "00:06" -m r -z > '; 0038 0039 %---------------------------------------------------------------------------------- 0040 % extract time series from xtide at station 0041 %---------------------------------------------------------------------------------- 0042 cmd = [setpath ttide '"' char(Xtide_Location) '"' opts '"tidefile"']; 0043 system(cmd); 0044 [times,zeta] = textread('tidefile','%f %f\n'); 0045 system('\rm tidefile'); 0046 0047 %------------------------------------------------------------- 0048 % process xtide data 0049 % - convert to meters 0050 % - shift to MSL 0051 % - shift to Julian Day, UTC 0052 %------------------------------------------------------------- 0053 0054 % convert feet => meters 0055 zeta = zeta/meters2feet; 0056 0057 % shift the vertical datum to center around mean 0058 zeta = zeta - mean(zeta); 0059 0060 % convert the time from unix time to modified Julian day UTC 0061 times = unixstart + times/(3600.*24.); 0062 0063 % determine begin/end frames 0064 [mbeg,ibeg] = min(abs(times-tbeg)); 0065 [mbeg,iend] = min(abs(times-tend)); 0066 0067 times = times(ibeg:iend); 0068 zeta = zeta(ibeg:iend); 0069 0070 0071