cas = "grt" + yeardoy + ".cas" orb = "grt" + yeardoy + ".orb" ion = "grt" + yeardoy + ".ion" con = "grt" + yeardoy + ".con" rcv = "grt" + yeardoy + ".rcv" dif = "orbdif" + yeardoy pre_app_log = "great_preedit.app_log" int_app_log = "great_oi.app_log" lsq_app_log = "great_podlsq.app_log" pos_app_log = "great_editres.app_log" fit_app_log = "great_orbfit.app_log" dif_app_log = "great_orbdif.app_log" con_app_log = "great_ambfixDd.app_log" # change dir tool.check_path(prj_dir) tool.check_path(xml_dir) tool.check_path(prj_log) prj_dir = os.path.join(prj_dir, '%4s' % args.year) prj_log = os.path.join(prj_log, '%4s' % args.year) prj_log13 = os.path.join(prj_log13, '%4s' % args.year) tool.check_path(prj_dir) tool.check_path(prj_log) prj_dir = os.path.join(prj_dir, '%03s' % args.idoy) prj_log = os.path.join(prj_log, '%03s' % args.idoy, "log_tb") prj_log13 = os.path.join(prj_log13, '%03s' % args.idoy, "log_tb") tool.check_path(prj_dir) tool.check_path(xml_dir) tool.check_path(prj_log) tool.check_path(prj_log13)
def read_orbdif_files(prj_dir, year, beg_doy, end_doy, post='_fix'): tool.check_path(prj_dir) doys_rms = {} wb_mean = Workbook() ws_mean = wb_mean.create_sheet("Mysheet") # 插入到最后 (默认) ws_mean.title = "mean_rms" # process not only one day for i in range(int(beg_doy), int(end_doy) + 1): year = '%4s' % year doy = '%03d' % i yyyydoy = '%4s%03d' % (year, i) dif = "orbdif" + yyyydoy doy_path = os.path.join(prj_dir, year, doy, "result") tool.check_path(doy_path) lsq_dif = os.path.join(doy_path, dif + post) doy_flo_result = read_one_orbdif_file(lsq_dif) # ======== the sum get form great in orbdif file sat_used_today = doy_flo_result["PRN"].split() rms_mean_today = doy_flo_result["RMS"].split() num = 0 for prn in sat_used_today: if prn == "PRN": num = num + 1 continue if prn in doys_rms: doys_rms[prn].append(rms_mean_today[num]) else: key = prn doys_rms[key] = [key] doys_rms[key].append(rms_mean_today[num]) num = num + 1 # ======== excel for epoch result without lsq wb = Workbook() epoch_ori_result = doy_flo_result["ORI"] for str_sat in epoch_ori_result: ws = wb.create_sheet("Mysheet") # 插入到最后 (默认) ws.title = str_sat for line in epoch_ori_result[str_sat]: line = line[4:] tmp = line.split() ws.append(tmp) wb.save('float_ori_%s.xlsx' % yyyydoy) # ======== excel for epoch result with lsq epoch_lsq_result = doy_flo_result["LSQ"] wb = Workbook() sat_acr = ["A", "C", "R"] for sat in doy_flo_result["SAT"]: sat_acr.append(sat + "_A") sat_acr.append(sat + "_C") sat_acr.append(sat + "_R") ws = wb.create_sheet() # 插入到最后 (默认) ws.title = "LSQ_EPOCH" ws.append(sat_acr) for mjd in epoch_lsq_result: line = epoch_lsq_result[mjd] tmp = line.split() ws.append(tmp) wb.save('float_lsq_%s.xlsx' % yyyydoy) # =========== mean rms for each sat for rms in doys_rms: ws_mean.append(doys_rms[rms]) wb_mean.save("orbdif_" + ('%03d' % beg_doy) + "_" + ('%03d' % end_doy) + ".xlsx")