Due to the lapse in federal government funding, NASA is not updating this website. We sincerely regret this inconvenience.
NASA Logo
Ocean Color Science Software

ocssw V2022
triad.py
Go to the documentation of this file.
1 def triad(b1,b2,r1,r2):
2  # Program to perform Triad algorithm
3  # input: b1,b2,r1,r2
4  # output: rbmat
5  # Ported from triad.pro by Fred Patt
6  # Liang Hong, 2/18/2020
7 
8  import numpy as np
9 
10  xb = np.zeros((3,3))
11  xr = np.zeros((3,3))
12 
13  xb[0,:] = b1
14  tb = np.cross(b1,b2)
15  xb[2,:] = tb/np.sqrt(np.sum(tb*tb))
16  xb[1,:] = np.cross(xb[2,:],xb[0,:])
17 
18  xr[0,:] = r1
19  tr = np.cross(r1,r2)
20  xr[2,:] = tr/np.sqrt(np.sum(tr*tr))
21  xr[1,:] = np.cross(xr[2,:],xr[0,:])
22 
23 
24  rbmat = np.dot(np.linalg.inv(xr),xb)
25 
26  return rbmat
27 
def triad(b1, b2, r1, r2)
Definition: triad.py:1