function b=getBaseline(in1,in2); Calculate baseline number between in1 and in2. Or given the baseline, it returns the corresponding 2 antennas NOTE: ALL RETURNS ARE SZA NUMBERING SYSTEM + 1. Therefore ant=0 becomes ant=1 and baseline 1 becomes 2. Inputs: in1 - if by itself it represents the baseline number. If with in2, it represents one of the antennas in2 - second antenna. NOTE: ALL INPUTS IN SZA NUMBERING SYSTEM Output: b - b = SZA baseline number [1:28] OR b(1) = ant1 [1:8] b(2) = ant2 Author: Michael Loh
0001 function b=getBaseline(in1,in2) 0002 0003 %function b=getBaseline(in1,in2); 0004 % 0005 %Calculate baseline number between in1 and in2. Or given the 0006 %baseline, it returns the corresponding 2 antennas 0007 % 0008 %NOTE: ALL RETURNS ARE SZA NUMBERING SYSTEM + 1. Therefore 0009 % ant=0 becomes ant=1 and baseline 1 becomes 2. 0010 % 0011 %Inputs: 0012 % in1 - if by itself it represents the baseline number. If 0013 % with in2, it represents one of the antennas 0014 % in2 - second antenna. 0015 % 0016 %NOTE: ALL INPUTS IN SZA NUMBERING SYSTEM 0017 % 0018 %Output: 0019 % b - b = SZA baseline number [1:28] 0020 % OR 0021 % b(1) = ant1 [1:8] 0022 % b(2) = ant2 0023 % 0024 % 0025 %Author: Michael Loh 0026 0027 %setup baseline matrix. There is probably an easier way 0028 %of doing this but the brute force method will also work. 0029 0030 bl=[NaN 0 1 2 3 4 5 6; 0031 0 NaN 7 8 9 10 11 12; 0032 1 7 NaN 13 14 15 16 17; 0033 2 8 13 NaN 18 19 20 21; 0034 3 9 14 18 NaN 22 23 24; 0035 4 10 15 19 22 NaN 25 26; 0036 5 11 16 20 23 25 NaN 27; 0037 6 12 17 21 24 26 27 NaN]; 0038 0039 0040 if (nargin==2) 0041 in1=in1+1; 0042 in2=in2+1; 0043 b=bl(in1,in2)+1; 0044 f=find(isnan(b)); 0045 b(f)=[]; 0046 elseif (nargin==1) 0047 if (in1>27) 0048 disp('getBaseline: Error - Invalid baseline'); 0049 b(1)=1; 0050 b(2)=2; 0051 return; 0052 end; 0053 [b,c]=find(bl==in1); 0054 else 0055 disp('getBaseline: Error - improper antOrBase asignment'); 0056 b=1; 0057 return; 0058 end; 0059