%TIDE_COEF_INTERP Example script to interpolate ADCIRC tidal results to specified locations % load all ADCIRC tidal coefficients load adcirc_enpac2003_tide.mat %West coast %load adcirc_ec2001v2e_fix %East coast % specify the points we want to find coefficients for lonlat=[ -118.45 33.7653 -118.416 33.7328 -118.416 33.7328 -118.371 33.7165 -118.367 33.7233 -118.367 33.7233 -118.334 33.696 -118.334 33.696 -118.299 33.6697 -118.299 33.6697 -118.292 33.691 -118.292 33.691 -118.261 33.6255 -118.266 33.6663 -118.205 33.5822 -118.207 33.6337 -118.141 33.5827 -118.141 33.5827 -118.148 33.633 ]; loni=lonlat(:,1); lati=lonlat(:,2); constituent='m2' % find index of contituent we want: icon=strmatch(upper(constituent),names); % triterp needs everything double lon=double(lon); lat=double(lat); tri=double(tri); depth=double(depth); elev=double(elev); u=double(u); v=double(v); % linear interpolation of complex tidal coefs on triangles di=triterp(tri,lon,lat,depth,loni,lati); %depth zi=triterp(tri,lon,lat,elev(:,icon),loni,lati); % elevation ui=triterp(tri,lon,lat,u(:,icon),loni,lati); % u vi=triterp(tri,lon,lat,v(:,icon),loni,lati); % v % extract amplitude and Greenwich phase from complex coefficients zamp=abs(zi); zpha=angle(zi)*180/pi; uamp=abs(ui); upha=angle(ui)*180/pi; vamp=abs(vi); vpha=angle(vi)*180/pi;