ocssw
V2022
|
cproc_hico.py
Go to the documentation of this file.
57 nut_data = astreduc.initReduc(filein)
60 yyyy = astrodate.year% 100
63 pmx,pmy,dut1,loda = astreduc.getEDFData(earth_orient_file,yyyy,astrodate.month,astrodate.day)
66 print("Earth Data File does not have year={},month={},day={}".format(astrodate.year,astrodate.month,astrodate.day))
70 # print("Date={}/{}/{} {}:{}:{}".format(astrodate.year,astrodate.month,astrodate.day,astrodate.hour,astrodate.minute,astrodate.second))
71 lsdat = astreduc.getLSData(leap_sec_file,astrodate.year,astrodate.month,astrodate.day)
74 print("Leap Sec File does not have year={},month={},day={}".format(astrodate.year,astrodate.month,astrodate.day))
80 r_hico_to_iss = np.zeros((3,3))
94 imult = 1
97 theta = np.zeros(nsamples)
100 frac = imult*(i-255.5)/255.5
103 theta = (theta + theta_stowed + float(quat_info['Theta (degrees from stowed position)']))*deg2Rad
110 svec = np.zeros((3,nsamples))
116 pm = astreduc.polarm(pmx,pmy)
120 r_iss = np.array((3),dtype=float)
121 q_iss = np.array((4),dtype=float)
128 hicoHeader = hicoLonLatHdr(filename=fheader, \
131 description='HICO geometry file, with calculated positions, and solar & view geometry, on the ground', \
136 hicoHeader.set_variable('wavelength units','{ degrees, degrees, degrees, degrees, degrees, degrees }')
137 hicoHeader.set_variable('band names','{ longitude, latitude, view zenith, view azimuth, sol zenith, sol azimuth }')
144 hicoHeader.set_variable('geometry_bore_sight_params','{ ' + ', '.join( str(v) for v in bs) + ' }')
156 r_iss = np.multiply([pvq_data['ISSPOSX'][i],pvq_data['ISSPOSY'][i],pvq_data['ISSPOSZ'][i] ],0.3048e0) # convert to meeters
158 rot_body = astreduc.quat_to_rot(q_iss)
160 hico_jdate = astreduc.UT2time(astrodate.year,astrodate.month,astrodate.day,astrodate.hour,astrodate.minute,astrodate.second,dut1,lsdat)
162 prec = astreduc.precession(hico_jdate.ttdb)
163 DeltaPsi, TrueEps, MeanEps, Omega, nut = astreduc.nutation(hico_jdate.ttdb,nut_data)
164 st,stdot,OmegaEarth = astreduc.sidereal(hico_jdate.jdut1,DeltaPsi,TrueEps,Omega,loda,2)
166 t_eci_to_ecef=np.dot(pm,np.dot(st,np.dot(nut,prec)))
168 t_hico_to_ecef=np.dot(t_eci_to_ecef,np.dot(rot_body,r_hico_to_iss))
170 r_ecef=np.dot(t_eci_to_ecef,r_iss)
173 v_ecef=np.dot(t_hico_to_ecef,svec)
174 llh,view_zen,view_az = astreduc.wgs84_intercept(r_ecef,v_ecef)
176 sol_zen_az=rad2Deg*astreduc.solar_geometry(astrodate.year,astrodate.month,astrodate.day,astrodate.hour,astrodate.minute,astrodate.second,llh[1,:],-llh[0,:])
198 hicoHeader.set_variable('date', '{ ' + str(astrodate.year)+','+str(astrodate.month)+','+str(astrodate.day) + ' }')
199 hicoHeader.set_variable('time', '{ ' + str(astrodate.hour)+','+str(astrodate.minute)+','+str(astrodate.second) + ' }')
200 hicoHeader.set_variable('image_center_long','{ ' + ', '.join( str(v) for v in frac2DegMinSec(np.abs(self.lon[i,254]),0.,0.)) + ' }')
201 hicoHeader.set_variable('image_center_lat', '{ ' + ', '.join( str(v) for v in frac2DegMinSec(np.abs(self.lat[i,254]),0.,0.)) + ' }')
204 hicoHeader.set_variable('image_center_zenith_ang','{ ' + ', '.join( str(v) for v in frac2DegMinSec((self.viewzen[i,254]+self.viewzen[i,255])/2,0.,0.)) + ' }')
205 hicoHeader.set_variable('image_center_azimuth_ang','{ ' + ', '.join( str(v) for v in frac2DegMinSec((self.viewaz[i,254]+self.viewaz[i,255])/2,0.,0.)) + ' }')
206 hicoHeader.set_variable('geometry_ISS_Z_direction',direction[(pvq_data['ISSVELZ'][i]>=0)]) #! a bit crude, based on ECI velocity
207 r_iss_new = np.tile(r_iss[np.newaxis],1).T
233 parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter, description='''\
237 parser.add_argument('-ifile', nargs=1, type=str, help=' iss*pos_vel_quat.csv input file (Must be a CSV file) ')
240 parser.add_argument('-boresight', nargs=3, type=float, default=([0, 0, 0]), help=('Process Bore Sight Parameters'))
def __init__(self, ifile, earth_orient_file, leap_sec_file, boresight)
Definition: cproc_hico.py:10
Definition: astreduc.py:1
Definition: astreduc.py:466
Definition: bore_sight.py:1
def write_geo_nc(self, nc_grp, calib_grp)
Definition: cproc_hico.py:219
Definition: cproc_hico.py:9
Definition: read_pos_vel_quat.py:1
Definition: hicoLonLatHdr.py:1