clear all; close all; clc;
cd ~jeff;startup;cd ~/Research/GEO_RWE

nz=800;
dz=pi/((nz-1));
oz=0.;

xi1=[5:175]/180*pi;
xi3=[0:0.1:3];

A=1000;

for ix=1:nx
    for iz=1:nz
      rays(iz,ix,1)= A*cos(xi1(ix))*cosh(xi3(iz)); % X Coordinate
      rays(iz,ix,2)= A*sin(xi1(ix))*sinh(xi3(iz)); % Z Coordinate
    end
end

dz=mean(mean(sqrt( ...
       ( rays(2:nz,:,1)-rays(1:nz-1,:,1) ).^2+...
       ( rays(2:nz,:,2)-rays(1:nz-1,:,2) ).^2)));

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % . . Coordinate system
  eval(['D1.history_file=''BPrays.HH'' '])
  D1.n=[nz nx 2];   D1.o=[oz ox 0];
  D1.d=[dz dx 1];   D1.esize=4;
  eval(['D1.in=''/net/koko/jeff/BPrays@'' ']);
  D1.data_format='xdr_float';
  D1.data=rays;
  eval(['sepwrite(D1,''BPrays.HH'') '])
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
