function [Vrm,scale,ee,ud,vd,wd]=vor_pair(isc,sca,ss1,ss2,core1,core2,x0,z0,Sep,theta,xd,yd,zd,az,el,Vreff,thetaprime)

%rotate data coordinates to C17 frame system

x=cosd(thetaprime)*xd-sind(thetaprime)*yd;
z=zd;

%rotate coordinates to vortex pair frame
xp=(x-x0)*cosd(theta)-(z-z0)*sind(theta);
zp=(z-z0)*cosd(theta)+(x-x0)*sind(theta);


j=complex(0,1);
rl=(xp-Sep/2*ones(size(xp))+j*zp);
rlmag=sqrt(rl.*conj(rl));
rr=(xp+Sep/2*ones(size(xp))+j*zp);
rrmag=sqrt(rr.*conj(rr));
Q=(ss1/2/pi./rl).*(ones(size(x))-exp(-1.26*abs(rlmag/core1).^2)) - ...
    (ss2/2/pi./rr).*(ones(size(x))-exp(-1.26*abs(rrmag/core2).^2));

%rotate back to C17 frame
u=imag(Q)*cosd(theta)+real(Q)*sind(theta);
w=real(Q)*cosd(theta)-imag(Q)*sind(theta);

%rotate back to lidar frame (data)
ud=cosd(thetaprime)*u;
vd=sind(thetaprime)*u;
wd=w;

Vrm=sind(az).*cosd(el).*ud+cosd(az).*cosd(el).*vd+sind(el).*wd;

% compare to data

in=find(~isnan(Vreff));
if isc==0
scale=mean(abs(Vreff(in))./abs(Vrm(in)));
%scale=std(Vreff(in))/std(Vrm(in));
ee=pcorr(Vreff(in),Vrm(in));
else
    scale=sca;
    ee=sqrt(sum((Vreff(in)-Vrm(in)*scale).^2)/length(Vrm(in)));
    ee=1/ee;

end

end