%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% FORWARD AND INVERSE SOLUTION VELOCITY PLOTS
%
% Load .m3d, path2.dat, .s2c and grid data
%
[F5F,gridname,year,ncol,gmt]=read_obs('oc299_sea_soar.m3d');
load(['M2_oc299_path2.dat']);
FSVD=M2_oc299_path2;
[s2c,freq,gridname]=read_v2r('M2_oc299_zeta.s2c');
amp=s2c(:,2);
pha=s2c(:,3);
gridname=blank(gridname(1:length(gridname)-1));
[in,x,y,z,bnd]=loadgrid(gridname);
%
% Report statistics
%
V=F5F;
rms(V(:,4)+sqrt(-1.0)*V(:,5))
V=FSVD;
rms(V(:,4)+sqrt(-1.0)*V(:,5))
rms(V(:,6)+sqrt(-1.0)*V(:,7))
%
% Plot results
%
landscapefigure
whitebg('w')
%
%
subplot(2,2,1)
load_bank150
hold on
V=F5F;
hv=vecplot2(V(:,2),V(:,3),V(:,4),V(:,5),1.0,'m/s',175000.,-25000.);
set(hv,'color','blue')
title(['ADCP Observations: RMS = ',num2str(rms(V(:,4)+sqrt(-1.0)*V(:,5))),' m/s'])
%
%
subplot(2,2,2)
load_bank150
hold on
V=FSVD;
hv=vecplot2(V(:,1),V(:,2),V(:,4),V(:,5),1.0,'m/s',175000.,-25000.);
set(hv,'color','red')
title(['ADCP Inversion: RMS = ',num2str(rms(V(:,4)+sqrt(-1.0)*V(:,5))),' m/s'])
%
%
subplot(2,2,3)
load_bank150
hold on
V=FSVD;
hv=vecplot2(V(:,1),V(:,2),V(:,6),V(:,7),1.0,'m/s',175000.,-25000.);
set(hv,'color','g')
%
scalar=amp;
scrange(scalar)
ibw=input('Enter the contour interval: ');
smin=ibw*ceil(min(scalar)/ibw);
smax=ibw*floor(max(scalar)/ibw);
[smin,smax,ibw]=colorband_fe(in,x,y,bnd,scalar,smin,smax,ibw)
title(['Inverse Error/Elevation Amplitude'])
%
%
subplot(2,2,4)
load_bank150
hold on
V=FSVD;
hv=vecplot2(V(:,1),V(:,2),V(:,6),V(:,7),1.0,'m/s',175000.,-25000.);
set(hv,'color','g')
%
scalar=pha;
scrange(scalar)
ibw=input('Enter the contour interval: ');
smin=ibw*ceil(min(scalar)/ibw);
smax=ibw*floor(max(scalar)/ibw);
[smin,smax,ibw]=colorband_fe(in,x,y,bnd,scalar,smin,smax,ibw)
title(['Inverse Error/Elevation Phase'])
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
