6 datain = np.flip(datain,1)
7 dataout = struct.unpack(
'<%df'%(np.size(datain)/4),np.ascontiguousarray(datain))
8 dataout = np.flip(np.reshape(dataout,(-1,2)),1)
25 from functools
import reduce
26 from hawknav.get_ncdf_object
import get_ncdf_object
28 group =
'navigation_data'
34 kq = np.where(atime >= 0)
35 kp = np.where(ptime >= 0)
36 ks = np.where(stime >= 0)
37 ind_valid_ts = reduce(np.intersect1d, (kq,kp,ks))
38 if np.size(ind_valid_ts)==0:
40 print(
"No valid navigation time tags.")
41 return [],[],[],[],[],[],[],[],[],[],[]
45 atime = atime[ind_valid_ts]
46 quat = np.squeeze(quat[ind_valid_ts,:])
54 ptime = np.squeeze(ptime[ind_valid_ts])
55 sunv = np.squeeze(sunv[ind_valid_ts,:])
56 mag2 = np.squeeze(mag2[ind_valid_ts,:])
57 gyro = np.squeeze(gyro[ind_valid_ts,:])
58 rw = np.squeeze(rw[ind_valid_ts,:])
62 stime = stime[ind_valid_ts]
63 sensor = np.squeeze(sensor[ind_valid_ts,:])
66 nks = np.size(ind_valid_ts)
70 fsserr = sensor[:,[8,17,26]]
73 sunxp = np.zeros((nks,3))
74 tana = np.tan(np.deg2rad(fssxp[:,0]))
75 tanb = np.tan(np.deg2rad(fssxp[:,1]))
76 sunxp[:,0] = 1/np.sqrt(tana**2 + tanb**2 + 1.0)
77 sunxp[:,1] = -tanb*sunxp[:,0]
78 sunxp[:,2] = tana*sunxp[:,0]
80 sunzp = np.zeros((nks,3))
81 if len(np.argwhere(np.diff(fsszp[:,0])==0))/nks<0.5:
83 tana = np.tan(np.deg2rad(fsszp[:,0]))
84 tanb = np.tan(np.deg2rad(fsszp[:,1]))
85 sunzp[:,2] = 1/np.sqrt(tana**2 + tanb**2 + 1.0)
86 sunzp[:,1] = tanb*sunzp[:,2]
87 sunzp[:,0] = tana*sunzp[:,2]
89 sunzn = np.zeros((nks,3))
90 if len(np.argwhere(np.diff(fsszn[:,0])==0))/nks<0.5:
92 tana = np.tan(np.deg2rad(fsszn[:,0]))
93 tanb = np.tan(np.deg2rad(fsszn[:,1]))
94 sunzn[:,2] = 1/np.sqrt(tana**2 + tanb**2 + 1.0)
95 sunzn[:,1] = (tana-tanb)*sunzn[:,2]/np.sqrt(2)
96 sunzn[:,0] = (tana+tanb)*sunzn[:,2]/np.sqrt(2)
97 sunzn[:,2] = -sunzn[:,2]
99 return ptime,sunv,mag2,gyro,rw,stime,sunxp,sunzp,sunzn,atime,quat