% function openvuf.m
% loads doodson numbers, and satellite and shallow water 
% constituent information.

% NOTE THIS ONLY NEEDS TO BE DONE ONCE UNLESS THE 
% CONSTITUENTS CHANGE.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1/11/99
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% load doodson numbers
fid=fopen('doodson.dat','r');
A=fread(fid,[34,Inf]);
A=setstr(A');
kon=A(:,1:5);
ii=sscanf(A(:,6:8)','%i');
jj=sscanf(A(:,9:11)','%i');
kk=sscanf(A(:,12:14)','%i');
ll=sscanf(A(:,15:17)','%i');
mm=sscanf(A(:,18:20)','%i');
nn=sscanf(A(:,21:23)','%i');
semi=sscanf(A(:,25:29)','%f');
doodson=[ii,jj,kk,ll,mm,nn];
nj=sscanf(A(:,30:33)','%i');
fclose(fid);

% load satellite constituent information
load satellite.dat;
ldel=satellite(:,1);
mdel=satellite(:,2);
ndel=satellite(:,3);
ph=satellite(:,4);
ee=satellite(:,5);
ir=satellite(:,6);
del=[ldel,mdel,ndel];

%load shallow water constituent information
fid=fopen('shallow.dat','r');
A=fread(fid,[56,Inf]);
A=setstr(A');
konsh=A(:,1:5);
njsh=sscanf(A(:,7:7)','%i');
coef(:,1)=sscanf(A(:,9:13)','%f');
coef(:,2)=sscanf(A(:,21:25)','%f');
coef(:,3)=sscanf(A(:,33:37)','%f');
coef(:,4)=sscanf(A(:,45:49)','%f');
konco=[A(:,15:19),A(:,27:31),A(:,39:43),A(:,51:55)];

ntidal=length(kon);
ntotal=length(kon)+length(konsh);
fclose(fid);

clear ii jj kk ll mm nn ldel mdel ndel satellite A

