def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) self.gp_sc_id = rbin.read_uint2(fp.read(2)) self.spectral_channel_id = rbin.read_uint1(fp.read(1)) self.seg_no = rbin.read_uint2(fp.read(2)) self.planned_start_seg_no = rbin.read_uint2(fp.read(2)) self.planned_end_seg_no = rbin.read_uint2(fp.read(2)) self.data_field_repr = rbin.read_uint1(fp.read(1))
def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) self.text = fp.read(self.rec_len-3).strip() # a = [x.strip('_') for x in self.text.split('-')] # self.xrit_channel_id = a[0] # self.dissemination_id = int(a[1]) # self.dissemination_sc = a[2] # self.platform = a[3] self.product_name = self.text[8:11] self.platform = "Himawari-8"
def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) self.text = fp.read(self.rec_len - 3).strip() # a = [x.strip('_') for x in self.text.split('-')] # self.xrit_channel_id = a[0] # self.dissemination_id = int(a[1]) # self.dissemination_sc = a[2] # self.platform = a[3] self.product_name = self.text[8:11] self.platform = "Himawari-8"
def read_epiheader(fp): """Read the msg header. """ ftr = dict() ftr["15TRAILERVersion"] = ord(fp.read(1)) ftr["SateliteID"] = rbin.read_uint2(fp.read(2)) ftr["NominalImageScanning"] = ord(fp.read(1)) > 0 ftr["ReducedScan"] = ord(fp.read(1)) > 0 ftr["ForwardScanStart"] = rbin.read_cds_time(fp.read(6)) ftr["ForwardScanEnd"] = rbin.read_cds_time(fp.read(6)) ftr["NominalBehaviour"] = ord(fp.read(1)) > 0 ftr["RadScanIrregularity"] = ord(fp.read(1)) > 0 ftr["RadStoppage"] = ord(fp.read(1)) > 0 ftr["RepeatCycleNotCompleted"] = ord(fp.read(1)) > 0 ftr["GainChangeTookPlace"] = ord(fp.read(1)) > 0 ftr["DecontaminationTookPlace"] = ord(fp.read(1)) > 0 ftr["NoBBCalibrationAchieved"] = ord(fp.read(1)) > 0 ftr["IncorrectTemperature"] = ord(fp.read(1)) > 0 ftr["InvalidBBData"] = ord(fp.read(1)) > 0 ftr["InvalidAuxOrHKTMData"] = ord(fp.read(1)) > 0 ftr["RefocusingMechanismActuated"] = ord(fp.read(1)) > 0 ftr["MirrorBackToReferencePos"] = ord(fp.read(1)) > 0 ftr["PlannedNumberOfL10Lines"] = np.fromstring(fp.read(12 * 4), dtype=">u4") ftr["NumberOfMissingL10Lines"] = np.fromstring(fp.read(12 * 4), dtype=">u4") ftr["NumberOfCorruptedL10Lines"] = np.fromstring(fp.read(12 * 4), dtype=">u4") ftr["NumberOfReplacedL10Lines"] = np.fromstring(fp.read(12 * 4), dtype=">u4") validitytype = np.dtype([('NominalImage', '>u1'), ('NonNominalBecauseIncomplete', '>u1'), ('NonNominalRadiometricQuality', '>u1'), ('NonNominalGeometricQuality', '>u1'), ('NonNominalTimeliness', '>u1'), ('IncompleteL15', '>u1')]) ftr["L15ImageValidity"] = np.fromstring(fp.read(12 * 6), dtype=validitytype) ftr["SouthernLineActual"] = rbin.read_int4(fp.read(4)) ftr["NorthernLineActual"] = rbin.read_int4(fp.read(4)) ftr["EasternColumnActual"] = rbin.read_int4(fp.read(4)) ftr["WesternColumnActual"] = rbin.read_int4(fp.read(4)) ftr["LowerSouthLineActual"] = rbin.read_int4(fp.read(4)) ftr["LowerNorthLineActual"] = rbin.read_int4(fp.read(4)) ftr["LowerEastColumnActual"] = rbin.read_int4(fp.read(4)) ftr["LowerWestColumnActual"] = rbin.read_int4(fp.read(4)) ftr["UpperSouthLineActual"] = rbin.read_int4(fp.read(4)) ftr["UpperNorthLineActual"] = rbin.read_int4(fp.read(4)) ftr["UpperEastColumnActual"] = rbin.read_int4(fp.read(4)) ftr["UpperWestColumnActual"] = rbin.read_int4(fp.read(4)) return ftr
def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) a = [] nb = 3 while nb < (self.rec_len): ln = rbin.read_int4(fp.read(4)) stamp = rbin.read_cds_time(fp.read(6)) lv = rbin.read_uint1(fp.read(1)) lr = rbin.read_uint1(fp.read(1)) lg = rbin.read_uint1(fp.read(1)) a.append((ln, stamp, lv, lr, lg)) nb += 13 self.line_quality = a
def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) self.proj_name = fp.read(32).strip() self.cfac = rbin.read_int4(fp.read(4)) self.lfac = rbin.read_int4(fp.read(4)) self.coff = rbin.read_int4(fp.read(4)) self.loff = rbin.read_int4(fp.read(4)) i1 = self.proj_name.find('(') i2 = self.proj_name.find(')') if i1 != -1 and i2 != -1: self.ssp = float(self.proj_name[i1+1:i2]) else: self.ssp = None
def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) self.text = fp.read(self.rec_len-3).strip() a = [x.strip('_') for x in self.text.split('-')] self.xrit_channel_id = a[0] self.dissemination_id = int(a[1]) self.dissemination_sc = a[2] self.platform = a[3] self.product_name = a[4] self.segment_name = a[5] self.time_stamp = mipp.strptime(a[6], "%Y%m%d%H%M") self.flags = a[7] self.segment_id = a[3] + '_' + a[4] + '_' + a[5] + '_' + self.time_stamp.strftime("%Y%m%d_%H%M") self.product_id = a[3] + '_' + a[4] + '_' + self.time_stamp.strftime("%Y%m%d_%H%M")
def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) self.data_definition = _decode_data_definition(fp.read(self.rec_len-3))
def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) self.station_id = rbin.read_uint2(fp.read(2))
def read_proheader(fp): """Read the msg header. """ hdr = dict() # Satellite definition satdef = {} satdef["SatelliteId"] = rbin.read_uint2(fp.read(2)) satdef["NominalLongitude"] = rbin.read_float4(fp.read(4)) satdef["SatelliteStatus"] = ord(fp.read(1)) hdr["SatelliteDefinition"] = satdef del satdef # Satellite operations satop = {} satop["LastManoeuvreFlag"] = ord(fp.read(1)) > 0 satop["LastManoeuvreStartTime"] = rbin.read_cds_time(fp.read(6)) satop["LastManoeuvreEndTime"] = rbin.read_cds_time(fp.read(6)) satop["LastManoeuvreType"] = ord(fp.read(1)) satop["NextManoeuvreFlag"] = ord(fp.read(1)) > 0 satop["NextManoeuvreStartTime"] = rbin.read_cds_time(fp.read(6)) satop["NextManoeuvreEndTime"] = rbin.read_cds_time(fp.read(6)) satop["NextManoeuvreType"] = ord(fp.read(1)) hdr["SatelliteOperations"] = satop del satop # Orbit orbit = {} orbit["PeriodStartTime"] = rbin.read_cds_time(fp.read(6)) orbit["PeriodEndTime"] = rbin.read_cds_time(fp.read(6)) orbitcoef = np.dtype(">u2, >u4, >u2, >u4," " (8,)>f8, (8,)>f8, (8,)>f8," " (8,)>f8, (8,)>f8, (8,)>f8") orbit["OrbitPolynomial"] = np.fromstring(fp.read(39600), dtype=orbitcoef, count=100) hdr["Orbit"] = orbit del orbit # Attitude attitude = {} attitude["PeriodStartTime"] = rbin.read_cds_time(fp.read(6)) attitude["PeriodEndTime"] = rbin.read_cds_time(fp.read(6)) attitude["PrincipleAxisOffsetAngle"] = rbin.read_float8(fp.read(8)) attitudecoef = np.dtype(">u2, >u4, >u2, >u4, (8,)>f8, (8,)>f8, (8,)>f8") attitude["AttitudePolynomial"] = np.fromstring(fp.read(20400), dtype=attitudecoef, count=100) hdr["Attitude"] = attitude del attitude # SpinRateatRCStart hdr["SpinRateatRCStart"] = rbin.read_float8(fp.read(8)) # UTCCorrelation utccor = {} utccor["PeriodStartTime"] = rbin.read_cds_time(fp.read(6)) utccor["PeriodEndTime"] = rbin.read_cds_time(fp.read(6)) utccor["OnBoardTimeStart"] = rbin.read_cuc_time(fp.read(7), 4, 3) utccor["VarOnBoardTimeStart"] = rbin.read_float8(fp.read(8)) utccor["A1"] = rbin.read_float8(fp.read(8)) utccor["VarA1"] = rbin.read_float8(fp.read(8)) utccor["A2"] = rbin.read_float8(fp.read(8)) utccor["VarA2"] = rbin.read_float8(fp.read(8)) hdr["UTCCorrelation"] = utccor del utccor # PlannedAcquisitionTime pat = {} pat["TrueRepeatCycleStart"] = rbin.read_cds_expanded_time(fp.read(10)) pat["PlannedForwardScanEnd"] = rbin.read_cds_expanded_time(fp.read(10)) pat["PlannedRepeatCycleEnd"] = rbin.read_cds_expanded_time(fp.read(10)) hdr["PlannedAcquisitionTime"] = pat # RadiometerStatus radiostatus = {} radiostatus["ChannelStatus"] = np.fromstring(fp.read(12), dtype=np.uint8) radiostatus["DetectorStatus"] = np.fromstring(fp.read(42), dtype=np.uint8) hdr["RadiometerStatus"] = radiostatus # RadiometerSettings radiosettings = {} radiosettings["MDUSamplingDelays"] = np.fromstring(fp.read(42 * 2), dtype=">u2") radiosettings["HRVFrameOffsets"] = {} radiosettings["HRVFrameOffsets"]["MDUNomHRVDelay1"] = rbin.read_uint2(fp.read(2)) radiosettings["HRVFrameOffsets"]["MDUNomHRVDelay2"] = rbin.read_uint2(fp.read(2)) radiosettings["HRVFrameOffsets"]["Spare"] = rbin.read_uint2(fp.read(2)) radiosettings["HRVFrameOffsets"]["MDUNomHRVBreakline"] = rbin.read_uint2(fp.read(2)) radiosettings["DHSSSynchSelection"] = ord(fp.read(1)) radiosettings["MDUOutGain"] = np.fromstring(fp.read(42 * 2), dtype=">u2") radiosettings["MDUCourseGain"] = np.fromstring(fp.read(42), dtype=np.uint8) radiosettings["MDUFineGain"] = np.fromstring(fp.read(42 * 2), dtype=">u2") radiosettings["MDUNumericalOffset"] = np.fromstring(fp.read(42 * 2), dtype=">u2") radiosettings["PUGain"] = np.fromstring(fp.read(42 * 2), dtype=">u2") radiosettings["PUOffset"] = np.fromstring(fp.read(27 * 2), dtype=">u2") radiosettings["PUBias"] = np.fromstring(fp.read(15 * 2), dtype=">u2") radiosettings["OperationParameters"] = {} radiosettings["OperationParameters"]["L0_LineCounter"] = rbin.read_uint2(fp.read(2)) radiosettings["OperationParameters"]["K1_RetraceLines"] = rbin.read_uint2(fp.read(2)) radiosettings["OperationParameters"]["K2_PauseDeciseconds"] = rbin.read_uint2(fp.read(2)) radiosettings["OperationParameters"]["K3_RetraceLines"] = rbin.read_uint2(fp.read(2)) radiosettings["OperationParameters"]["K4_PauseDeciseconds"] = rbin.read_uint2(fp.read(2)) radiosettings["OperationParameters"]["K5_RetraceLines"] = rbin.read_uint2(fp.read(2)) radiosettings["OperationParameters"]["X_DeepSpaceWindowPosition"] = ord(fp.read(1)) radiosettings["RefocusingLines"] = rbin.read_uint2(fp.read(2)) radiosettings["RefocusingDirection"] = ord(fp.read(1)) radiosettings["RefocusingPosition"] = rbin.read_uint2(fp.read(2)) radiosettings["ScanRefPosFlag"] = ord(fp.read(1)) > 0 radiosettings["ScanRefPosNumber"] = rbin.read_uint2(fp.read(2)) radiosettings["ScanRefPosVal"] = rbin.read_float4(fp.read(4)) radiosettings["ScanFirstLine"] = rbin.read_uint2(fp.read(2)) radiosettings["ScanLastLine"] = rbin.read_uint2(fp.read(2)) radiosettings["RetraceStartLine"] = rbin.read_uint2(fp.read(2)) hdr["RadiometerSettings"] = radiosettings # RadiometerOperations radiooper = {} radiooper["LastGainChangeFlag"] = ord(fp.read(1)) > 0 radiooper["LastGainChangeTime"] = rbin.read_cds_time(fp.read(6)) radiooper["Decontamination"] = {} radiooper["Decontamination"]["DecontaminationNow"] = ord(fp.read(1)) > 0 radiooper["Decontamination"]["DecontaminationStart"] = rbin.read_cds_time(fp.read(6)) radiooper["Decontamination"]["DecontaminationEnd"] = rbin.read_cds_time(fp.read(6)) radiooper["BBCalScheduled"] = ord(fp.read(1)) > 0 radiooper["BBCalibrationType"] = ord(fp.read(1)) radiooper["BBFirstLine"] = rbin.read_uint2(fp.read(2)) radiooper["BBLastLine"] = rbin.read_uint2(fp.read(2)) radiooper["ColdFocalPlaneOpTemp"] = rbin.read_uint2(fp.read(2)) radiooper["WarmFocalPlaneOpTemp"] = rbin.read_uint2(fp.read(2)) hdr["RadiometerOperations"] = radiooper ## CelestialEvents # CelestialBodiesPosition celbodies = {} celbodies["PeriodTimeStart"] = rbin.read_cds_time(fp.read(6)) celbodies["PeriodTimeEnd"] = rbin.read_cds_time(fp.read(6)) celbodies["RelatedOrbitFileTime"] = fp.read(15) celbodies["RelatedAttitudeFileTime"] = fp.read(15) earthmoonsuncoef = np.dtype(">u2, >u4, >u2, >u4, (8,)>f8, (8,)>f8") celbodies["EarthEphemeris"] = np.fromstring(fp.read(14000), dtype=earthmoonsuncoef, count=100) celbodies["MoonEphemeris"] = np.fromstring(fp.read(14000), dtype=earthmoonsuncoef, count=100) celbodies["SunEphemeris"] = np.fromstring(fp.read(14000), dtype=earthmoonsuncoef, count=100) starcoef = np.dtype(">u2, >u2, >u4, >u2, >u4, (8,)>f8, (8,)>f8") starcoefs = np.dtype([('starcoefs', starcoef, (20,))]) celbodies["StarEphemeris"] = np.fromstring(fp.read(284000), dtype=starcoefs, count=100) hdr["CelestialBodiesPosition"] = celbodies # RelationToImage reltoim = {} reltoim["TypeofEclipse"] = ord(fp.read(1)) reltoim["EclipseStartTime"] = rbin.read_cds_time(fp.read(6)) reltoim["EclipseEndTime"] = rbin.read_cds_time(fp.read(6)) reltoim["VisibleBodiesInImage"] = ord(fp.read(1)) reltoim["BodiesClosetoFOV"] = ord(fp.read(1)) reltoim["ImpactOnImageQuality"] = ord(fp.read(1)) hdr["RelationToImage"] = reltoim ## ImageDescriptionRecord grid_origin = ["north west", "south west", "south east", "north east"] # ProjectionDescription projdes = {} projdes["TypeOfProjection"] = ord(fp.read(1)) projdes["LongitudeOfSSP"] = rbin.read_float4(fp.read(4)) hdr["ProjectionDescription"] = projdes # ReferenceGridVIS_IR refvisir = {} refvisir["NumberOfLines"] = rbin.read_int4(fp.read(4)) refvisir["NumberOfColumns"] = rbin.read_int4(fp.read(4)) refvisir["LineDirGridStep"] = rbin.read_float4(fp.read(4)) refvisir["ColumnDirGridStep"] = rbin.read_float4(fp.read(4)) refvisir["GridOrigin"] = grid_origin[ord(fp.read(1))] hdr["ReferenceGridVIS_IR"] = refvisir # ReferenceGridHRV refhrv = {} refhrv["NumberOfLines"] = rbin.read_int4(fp.read(4)) refhrv["NumberOfColumns"] = rbin.read_int4(fp.read(4)) refhrv["LineDirGridStep"] = rbin.read_float4(fp.read(4)) refhrv["ColumnDirGridStep"] = rbin.read_float4(fp.read(4)) refhrv["GridOrigin"] = grid_origin[ord(fp.read(1))] hdr["ReferenceGridHRV"] = refhrv # PlannedCoverageVIS_IR covvisir = {} covvisir["SouthernLinePlanned"] = rbin.read_int4(fp.read(4)) covvisir["NorthernLinePlanned"] = rbin.read_int4(fp.read(4)) covvisir["EasternColumnPlanned"] = rbin.read_int4(fp.read(4)) covvisir["WesternColumnPlanned"] = rbin.read_int4(fp.read(4)) hdr["PlannedCoverageVIS_IR"] = covvisir # PlannedCoverageHRV covhrv = {} covhrv["LowerSouthLinePlanned"] = rbin.read_int4(fp.read(4)) covhrv["LowerNorthLinePlanned"] = rbin.read_int4(fp.read(4)) covhrv["LowerEastColumnPlanned"] = rbin.read_int4(fp.read(4)) covhrv["LowerWestColumnPlanned"] = rbin.read_int4(fp.read(4)) covhrv["UpperSouthLinePlanned"] = rbin.read_int4(fp.read(4)) covhrv["UpperNorthLinePlanned"] = rbin.read_int4(fp.read(4)) covhrv["UpperEastColumnPlanned"] = rbin.read_int4(fp.read(4)) covhrv["UpperWestColumnPlanned"] = rbin.read_int4(fp.read(4)) hdr["PlannedCoverageHRV"] = covhrv # Level 1_5 ImageProduction image_proc_direction = ["North-South", "South-North"] pixel_gen_direction = ["East-West", "West-East"] l15prod = {} l15prod["ImageProcDirection"] = image_proc_direction[ord(fp.read(1))] l15prod["PixelGenDirection"] = pixel_gen_direction[ord(fp.read(1))] # 0: No processing, 1: Spectral radiance, 2: Effective radiance l15prod["PlannedChanProcessing"] = np.fromstring(fp.read(12), dtype=np.uint8) hdr["Level 1_5 ImageProduction"] = l15prod ## RadiometricProcessing # RPSummary rpsummary = {} rpsummary["RadianceLinearization"] = np.fromstring(fp.read(12), dtype=np.bool) rpsummary["DetectorEqualization"] = np.fromstring(fp.read(12), dtype=np.bool) rpsummary["OnboardCalibrationResult"] = np.fromstring(fp.read(12), dtype=np.bool) rpsummary["MPEFCalFeedback"] = np.fromstring(fp.read(12), dtype=np.bool) rpsummary["MTFAdaptation"] = np.fromstring(fp.read(12), dtype=np.bool) rpsummary["StraylightCorrectionFlag"] = np.fromstring(fp.read(12), dtype=np.bool) hdr["RPSummary"] = rpsummary # Level1_5ImageCalibration caltype = np.dtype([('Cal_Slope', '>f8'), ('Cal_Offset', '>f8')]) hdr["Level1_5ImageCalibration"] = np.fromstring(fp.read(192), dtype=caltype) # BlackBodyDataUsed bbdu = {} bbdu["BBObservationUTC"] = rbin.read_cds_expanded_time(fp.read(10)) bbdu["BBRelatedData"] = {} bbdu["BBRelatedData"]["OnBoardBBTime"] = rbin.read_cuc_time(fp.read(7), 4, 3) bbdu["BBRelatedData"]["MDUOutGain"] = np.fromstring(fp.read(42 * 2), dtype=">u2") bbdu["BBRelatedData"]["MDUCoarseGain"] = np.fromstring(fp.read(42), dtype=np.uint8) bbdu["BBRelatedData"]["MDUFineGain"] = np.fromstring(fp.read(42 * 2), dtype=">u2") bbdu["BBRelatedData"]["MDUNumericalOffset"] = np.fromstring(fp.read(42 * 2), dtype=">u2") bbdu["BBRelatedData"]["PUGain"] = np.fromstring(fp.read(42 * 2), dtype=">u2") bbdu["BBRelatedData"]["PUOffset"] = np.fromstring(fp.read(27 * 2), dtype=">u2") bbdu["BBRelatedData"]["PUBias"] = np.fromstring(fp.read(15 * 2), dtype=">u2") # 12 bits bitstrings... convert to uint16 data = np.fromstring(fp.read(int(42 * 1.5)), dtype=np.uint8) data = data.astype(np.uint16) data[::3] = data[::3]*256 + data[1::3] // 16 data[1::3] = (data[1::3] & 0x0f)*16 + data[2::3] result = np.ravel(data.reshape(-1,3)[:,:2]) bbdu["BBRelatedData"]["DCRValues"] = result bbdu["BBRelatedData"]["X_DeepSpaceWindowPosition"] = ord(fp.read(1)) bbdu["BBRelatedData"]["ColdFPTemperature"] = {} bbdu["BBRelatedData"]["ColdFPTemperature"]["FCUNominalColdFocalPlaneTemp"] = rbin.read_uint2(fp.read(2)) / 100. bbdu["BBRelatedData"]["ColdFPTemperature"]["FCURedundantColdFocalPlaneTemp"] = rbin.read_uint2(fp.read(2)) / 100. bbdu["BBRelatedData"]["WarmFPTemperature"] = {} bbdu["BBRelatedData"]["WarmFPTemperature"]["FCUNominalWarmFocalPlaneVHROTemp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["WarmFPTemperature"]["FCURedundantWarmFocalPlaneVHROTemp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["ScanMirrorTemperature"] = {} bbdu["BBRelatedData"]["ScanMirrorTemperature"]["FCUNominalScanMirrorSensor1Temp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["ScanMirrorTemperature"]["FCURedundantScanMirrorSensor1Temp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["ScanMirrorTemperature"]["FCUNominalScanMirrorSensor2Temp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["ScanMirrorTemperature"]["FCURedundantScanMirrorSensor2Temp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["M1M2M3Temperature"] = {} bbdu["BBRelatedData"]["M1M2M3Temperature"]["FCUNominalM1MirrorSensor1Temp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["M1M2M3Temperature"]["FCURedundantM1MirrorSensor1Temp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["M1M2M3Temperature"]["FCUNominalM1MirrorSensor2Temp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["M1M2M3Temperature"]["FCURedundantM1MirrorSensor2Temp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["M1M2M3Temperature"]["FCUNominalM23AssemblySensor1Temp"] = ord(fp.read(1)) / 4. + 265 bbdu["BBRelatedData"]["M1M2M3Temperature"]["FCURedundantM23AssemblySensor1Temp"] = ord(fp.read(1)) / 4. + 265 bbdu["BBRelatedData"]["M1M2M3Temperature"]["FCUNominalM23AssemblySensor2Temp"] = ord(fp.read(1)) / 4. + 265 bbdu["BBRelatedData"]["M1M2M3Temperature"]["FCURedundantM23AssemblySensor2Temp"] = ord(fp.read(1)) / 4. + 265 bbdu["BBRelatedData"]["BaffleTemperature"] = {} bbdu["BBRelatedData"]["BaffleTemperature"]["FCUNominalM1BaffleTemp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["BaffleTemperature"]["FCURedundantM1BaffleTemp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["BlackBodyTemperature"] = {} bbdu["BBRelatedData"]["BlackBodyTemperature"]["FCUNominalBlackBodySensorTemp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["BlackBodyTemperature"]["FCURedundantBlackBodySensorTemp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["FCUMode"] = {} bbdu["BBRelatedData"]["FCUMode"]["FCUNominalSMMStatus"] = rbin.read_uint2(fp.read(2)) bbdu["BBRelatedData"]["FCUMode"]["FCURedundantSMMStatus"] = rbin.read_uint2(fp.read(2)) extracted_data_type = np.dtype([('NumberOfPixelsUsed', '>u4'), ('MeanCount', '>f4'), ('RMS', '>f4'), ('MaxCount', '>u2'), ('MinCount', '>u2'), ('BB_Processing_Slope', '>f8'), ('BB_Processing_Offset', '>f8')]) bbdu["BBRelatedData"]["ExtractedBBData"] = np.fromstring(fp.read(32 * 12), dtype=extracted_data_type) impf_cal_type = np.dtype([("ImageQualityFlag", "u1"), ("ReferenceDataFlag", "u1"), ("AbsCalMethod", "u1"), ("Pad1", "u1"), ("AbsCalWeightVic", ">f4"), ("AbsCalWeightXsat", ">f4"), ("AbsCalCoeff", ">f4"), ("AbsCalError", ">f4"), ("CalMonBias", ">f4"), ("CalMonRms", ">f4"), ("OffsetCount", ">f4")]) bbdu["MPEFCalFeedback"] = np.fromstring(fp.read(32 * 12), dtype=impf_cal_type) bbdu["RadTransform"] = np.fromstring(fp.read(42 * 64 * 4), dtype=">f4").reshape((42,64)) bbdu["RadProcMTFAdaptation"] = {} bbdu["RadProcMTFAdaptation"]["VIS_IRMTFCorrectionE_W"] = np.fromstring(fp.read(33 * 16 * 4), dtype=">f4").reshape((33, 16)) bbdu["RadProcMTFAdaptation"]["VIS_IRMTFCorrectionN_S"] = np.fromstring(fp.read(33 * 16 * 4), dtype=">f4").reshape((33, 16)) bbdu["RadProcMTFAdaptation"]["HRVMTFCorrectionE_W"] = np.fromstring(fp.read(9 * 16 * 4), dtype=">f4").reshape((9, 16)) bbdu["RadProcMTFAdaptation"]["HRVMTFCorrectionN_S"] = np.fromstring(fp.read(9 * 16 * 4), dtype=">f4").reshape((9, 16)) bbdu["RadProcMTFAdaptation"]["StraylightCorrection"] = np.fromstring(fp.read(12 * 8 * 8 * 4), dtype=">f4").reshape((12, 8, 8)) hdr["BlackBodyDataUsed"] = bbdu # GeometricProcessing geoproc = {} geoproc["OptAxisDistances"] = {} geoproc["OptAxisDistances"]["E-WFocalPlane"] = np.fromstring(fp.read(42 * 4), dtype=">f4") geoproc["OptAxisDistances"]["N-SFocalPlane"] = np.fromstring(fp.read(42 * 4), dtype=">f4") geoproc["EarthModel"] = {} geoproc["EarthModel"]["TypeOfEarthModel"] = ord(fp.read(1)) geoproc["EarthModel"]["EquatorialRadius"] = rbin.read_float8(fp.read(8)) geoproc["EarthModel"]["NorthPolarRadius"] = rbin.read_float8(fp.read(8)) geoproc["EarthModel"]["SouthPolarRadius"] = rbin.read_float8(fp.read(8)) geoproc["AtmosphericModel"] = np.fromstring(fp.read(12 * 360 * 4), dtype=">f4").reshape((12, 360)) geoproc["ResamplingFunctions"] = np.fromstring(fp.read(12), dtype=np.uint8) hdr["GeometricProcessing"] = geoproc return hdr
def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) self.text = fp.read(self.rec_len-3).strip()
def read_proheader(fp): """Read the msg header. """ hdr = dict() # Satellite definition satdef = {} satdef["SatelliteId"] = rbin.read_uint2(fp.read(2)) satdef["NominalLongitude"] = rbin.read_float4(fp.read(4)) satdef["SatelliteStatus"] = ord(fp.read(1)) hdr["SatelliteDefinition"] = satdef del satdef # Satellite operations satop = {} satop["LastManoeuvreFlag"] = ord(fp.read(1)) > 0 satop["LastManoeuvreStartTime"] = rbin.read_cds_time(fp.read(6)) satop["LastManoeuvreEndTime"] = rbin.read_cds_time(fp.read(6)) satop["LastManoeuvreType"] = ord(fp.read(1)) satop["NextManoeuvreFlag"] = ord(fp.read(1)) > 0 satop["NextManoeuvreStartTime"] = rbin.read_cds_time(fp.read(6)) satop["NextManoeuvreEndTime"] = rbin.read_cds_time(fp.read(6)) satop["NextManoeuvreType"] = ord(fp.read(1)) hdr["SatelliteOperations"] = satop del satop # Orbit orbit = {} orbit["PeriodStartTime"] = rbin.read_cds_time(fp.read(6)) orbit["PeriodEndTime"] = rbin.read_cds_time(fp.read(6)) orbitcoef = np.dtype(">u2, >u4, >u2, >u4," " (8,)>f8, (8,)>f8, (8,)>f8," " (8,)>f8, (8,)>f8, (8,)>f8") orbit["OrbitPolynomial"] = np.fromstring(fp.read(39600), dtype=orbitcoef, count=100) hdr["Orbit"] = orbit del orbit # Attitude attitude = {} attitude["PeriodStartTime"] = rbin.read_cds_time(fp.read(6)) attitude["PeriodEndTime"] = rbin.read_cds_time(fp.read(6)) attitude["PrincipleAxisOffsetAngle"] = rbin.read_float8(fp.read(8)) attitudecoef = np.dtype(">u2, >u4, >u2, >u4, (8,)>f8, (8,)>f8, (8,)>f8") attitude["AttitudePolynomial"] = np.fromstring(fp.read(20400), dtype=attitudecoef, count=100) hdr["Attitude"] = attitude del attitude # SpinRateatRCStart hdr["SpinRateatRCStart"] = rbin.read_float8(fp.read(8)) # UTCCorrelation utccor = {} utccor["PeriodStartTime"] = rbin.read_cds_time(fp.read(6)) utccor["PeriodEndTime"] = rbin.read_cds_time(fp.read(6)) utccor["OnBoardTimeStart"] = rbin.read_cuc_time(fp.read(7), 4, 3) utccor["VarOnBoardTimeStart"] = rbin.read_float8(fp.read(8)) utccor["A1"] = rbin.read_float8(fp.read(8)) utccor["VarA1"] = rbin.read_float8(fp.read(8)) utccor["A2"] = rbin.read_float8(fp.read(8)) utccor["VarA2"] = rbin.read_float8(fp.read(8)) hdr["UTCCorrelation"] = utccor del utccor # PlannedAcquisitionTime pat = {} pat["TrueRepeatCycleStart"] = rbin.read_cds_expanded_time(fp.read(10)) pat["PlannedForwardScanEnd"] = rbin.read_cds_expanded_time(fp.read(10)) pat["PlannedRepeatCycleEnd"] = rbin.read_cds_expanded_time(fp.read(10)) hdr["PlannedAcquisitionTime"] = pat # RadiometerStatus radiostatus = {} radiostatus["ChannelStatus"] = np.fromstring(fp.read(12), dtype=np.uint8) radiostatus["DetectorStatus"] = np.fromstring(fp.read(42), dtype=np.uint8) hdr["RadiometerStatus"] = radiostatus # RadiometerSettings radiosettings = {} radiosettings["MDUSamplingDelays"] = np.fromstring(fp.read(42 * 2), dtype=">u2") radiosettings["HRVFrameOffsets"] = {} radiosettings["HRVFrameOffsets"]["MDUNomHRVDelay1"] = rbin.read_uint2( fp.read(2)) radiosettings["HRVFrameOffsets"]["MDUNomHRVDelay2"] = rbin.read_uint2( fp.read(2)) radiosettings["HRVFrameOffsets"]["Spare"] = rbin.read_uint2(fp.read(2)) radiosettings["HRVFrameOffsets"]["MDUNomHRVBreakline"] = rbin.read_uint2( fp.read(2)) radiosettings["DHSSSynchSelection"] = ord(fp.read(1)) radiosettings["MDUOutGain"] = np.fromstring(fp.read(42 * 2), dtype=">u2") radiosettings["MDUCourseGain"] = np.fromstring(fp.read(42), dtype=np.uint8) radiosettings["MDUFineGain"] = np.fromstring(fp.read(42 * 2), dtype=">u2") radiosettings["MDUNumericalOffset"] = np.fromstring(fp.read(42 * 2), dtype=">u2") radiosettings["PUGain"] = np.fromstring(fp.read(42 * 2), dtype=">u2") radiosettings["PUOffset"] = np.fromstring(fp.read(27 * 2), dtype=">u2") radiosettings["PUBias"] = np.fromstring(fp.read(15 * 2), dtype=">u2") radiosettings["OperationParameters"] = {} radiosettings["OperationParameters"]["L0_LineCounter"] = rbin.read_uint2( fp.read(2)) radiosettings["OperationParameters"]["K1_RetraceLines"] = rbin.read_uint2( fp.read(2)) radiosettings["OperationParameters"][ "K2_PauseDeciseconds"] = rbin.read_uint2(fp.read(2)) radiosettings["OperationParameters"]["K3_RetraceLines"] = rbin.read_uint2( fp.read(2)) radiosettings["OperationParameters"][ "K4_PauseDeciseconds"] = rbin.read_uint2(fp.read(2)) radiosettings["OperationParameters"]["K5_RetraceLines"] = rbin.read_uint2( fp.read(2)) radiosettings["OperationParameters"]["X_DeepSpaceWindowPosition"] = ord( fp.read(1)) radiosettings["RefocusingLines"] = rbin.read_uint2(fp.read(2)) radiosettings["RefocusingDirection"] = ord(fp.read(1)) radiosettings["RefocusingPosition"] = rbin.read_uint2(fp.read(2)) radiosettings["ScanRefPosFlag"] = ord(fp.read(1)) > 0 radiosettings["ScanRefPosNumber"] = rbin.read_uint2(fp.read(2)) radiosettings["ScanRefPosVal"] = rbin.read_float4(fp.read(4)) radiosettings["ScanFirstLine"] = rbin.read_uint2(fp.read(2)) radiosettings["ScanLastLine"] = rbin.read_uint2(fp.read(2)) radiosettings["RetraceStartLine"] = rbin.read_uint2(fp.read(2)) hdr["RadiometerSettings"] = radiosettings # RadiometerOperations radiooper = {} radiooper["LastGainChangeFlag"] = ord(fp.read(1)) > 0 radiooper["LastGainChangeTime"] = rbin.read_cds_time(fp.read(6)) radiooper["Decontamination"] = {} radiooper["Decontamination"]["DecontaminationNow"] = ord(fp.read(1)) > 0 radiooper["Decontamination"]["DecontaminationStart"] = rbin.read_cds_time( fp.read(6)) radiooper["Decontamination"]["DecontaminationEnd"] = rbin.read_cds_time( fp.read(6)) radiooper["BBCalScheduled"] = ord(fp.read(1)) > 0 radiooper["BBCalibrationType"] = ord(fp.read(1)) radiooper["BBFirstLine"] = rbin.read_uint2(fp.read(2)) radiooper["BBLastLine"] = rbin.read_uint2(fp.read(2)) radiooper["ColdFocalPlaneOpTemp"] = rbin.read_uint2(fp.read(2)) radiooper["WarmFocalPlaneOpTemp"] = rbin.read_uint2(fp.read(2)) hdr["RadiometerOperations"] = radiooper # CelestialEvents # CelestialBodiesPosition celbodies = {} celbodies["PeriodTimeStart"] = rbin.read_cds_time(fp.read(6)) celbodies["PeriodTimeEnd"] = rbin.read_cds_time(fp.read(6)) celbodies["RelatedOrbitFileTime"] = fp.read(15) celbodies["RelatedAttitudeFileTime"] = fp.read(15) earthmoonsuncoef = np.dtype(">u2, >u4, >u2, >u4, (8,)>f8, (8,)>f8") celbodies["EarthEphemeris"] = np.fromstring(fp.read(14000), dtype=earthmoonsuncoef, count=100) celbodies["MoonEphemeris"] = np.fromstring(fp.read(14000), dtype=earthmoonsuncoef, count=100) celbodies["SunEphemeris"] = np.fromstring(fp.read(14000), dtype=earthmoonsuncoef, count=100) starcoef = np.dtype(">u2, >u2, >u4, >u2, >u4, (8,)>f8, (8,)>f8") starcoefs = np.dtype([('starcoefs', starcoef, (20, ))]) celbodies["StarEphemeris"] = np.fromstring(fp.read(284000), dtype=starcoefs, count=100) hdr["CelestialBodiesPosition"] = celbodies # RelationToImage reltoim = {} reltoim["TypeofEclipse"] = ord(fp.read(1)) reltoim["EclipseStartTime"] = rbin.read_cds_time(fp.read(6)) reltoim["EclipseEndTime"] = rbin.read_cds_time(fp.read(6)) reltoim["VisibleBodiesInImage"] = ord(fp.read(1)) reltoim["BodiesClosetoFOV"] = ord(fp.read(1)) reltoim["ImpactOnImageQuality"] = ord(fp.read(1)) hdr["RelationToImage"] = reltoim # ImageDescriptionRecord grid_origin = ["north west", "south west", "south east", "north east"] # ProjectionDescription projdes = {} projdes["TypeOfProjection"] = ord(fp.read(1)) projdes["LongitudeOfSSP"] = rbin.read_float4(fp.read(4)) hdr["ProjectionDescription"] = projdes # ReferenceGridVIS_IR refvisir = {} refvisir["NumberOfLines"] = rbin.read_int4(fp.read(4)) refvisir["NumberOfColumns"] = rbin.read_int4(fp.read(4)) refvisir["LineDirGridStep"] = rbin.read_float4(fp.read(4)) refvisir["ColumnDirGridStep"] = rbin.read_float4(fp.read(4)) refvisir["GridOrigin"] = grid_origin[ord(fp.read(1))] hdr["ReferenceGridVIS_IR"] = refvisir # ReferenceGridHRV refhrv = {} refhrv["NumberOfLines"] = rbin.read_int4(fp.read(4)) refhrv["NumberOfColumns"] = rbin.read_int4(fp.read(4)) refhrv["LineDirGridStep"] = rbin.read_float4(fp.read(4)) refhrv["ColumnDirGridStep"] = rbin.read_float4(fp.read(4)) refhrv["GridOrigin"] = grid_origin[ord(fp.read(1))] hdr["ReferenceGridHRV"] = refhrv # PlannedCoverageVIS_IR covvisir = {} covvisir["SouthernLinePlanned"] = rbin.read_int4(fp.read(4)) covvisir["NorthernLinePlanned"] = rbin.read_int4(fp.read(4)) covvisir["EasternColumnPlanned"] = rbin.read_int4(fp.read(4)) covvisir["WesternColumnPlanned"] = rbin.read_int4(fp.read(4)) hdr["PlannedCoverageVIS_IR"] = covvisir # PlannedCoverageHRV covhrv = {} covhrv["LowerSouthLinePlanned"] = rbin.read_int4(fp.read(4)) covhrv["LowerNorthLinePlanned"] = rbin.read_int4(fp.read(4)) covhrv["LowerEastColumnPlanned"] = rbin.read_int4(fp.read(4)) covhrv["LowerWestColumnPlanned"] = rbin.read_int4(fp.read(4)) covhrv["UpperSouthLinePlanned"] = rbin.read_int4(fp.read(4)) covhrv["UpperNorthLinePlanned"] = rbin.read_int4(fp.read(4)) covhrv["UpperEastColumnPlanned"] = rbin.read_int4(fp.read(4)) covhrv["UpperWestColumnPlanned"] = rbin.read_int4(fp.read(4)) hdr["PlannedCoverageHRV"] = covhrv # Level 1_5 ImageProduction image_proc_direction = ["North-South", "South-North"] pixel_gen_direction = ["East-West", "West-East"] l15prod = {} l15prod["ImageProcDirection"] = image_proc_direction[ord(fp.read(1))] l15prod["PixelGenDirection"] = pixel_gen_direction[ord(fp.read(1))] # 0: No processing, 1: Spectral radiance, 2: Effective radiance l15prod["PlannedChanProcessing"] = np.fromstring(fp.read(12), dtype=np.uint8) hdr["Level 1_5 ImageProduction"] = l15prod # RadiometricProcessing # RPSummary rpsummary = {} rpsummary["RadianceLinearization"] = np.fromstring(fp.read(12), dtype=np.bool) rpsummary["DetectorEqualization"] = np.fromstring(fp.read(12), dtype=np.bool) rpsummary["OnboardCalibrationResult"] = np.fromstring(fp.read(12), dtype=np.bool) rpsummary["MPEFCalFeedback"] = np.fromstring(fp.read(12), dtype=np.bool) rpsummary["MTFAdaptation"] = np.fromstring(fp.read(12), dtype=np.bool) rpsummary["StraylightCorrectionFlag"] = np.fromstring(fp.read(12), dtype=np.bool) hdr["RPSummary"] = rpsummary # Level1_5ImageCalibration caltype = np.dtype([('Cal_Slope', '>f8'), ('Cal_Offset', '>f8')]) hdr["Level1_5ImageCalibration"] = np.fromstring(fp.read(192), dtype=caltype) # BlackBodyDataUsed bbdu = {} bbdu["BBObservationUTC"] = rbin.read_cds_expanded_time(fp.read(10)) bbdu["BBRelatedData"] = {} bbdu["BBRelatedData"]["OnBoardBBTime"] = rbin.read_cuc_time( fp.read(7), 4, 3) bbdu["BBRelatedData"]["MDUOutGain"] = np.fromstring(fp.read(42 * 2), dtype=">u2") bbdu["BBRelatedData"]["MDUCoarseGain"] = np.fromstring(fp.read(42), dtype=np.uint8) bbdu["BBRelatedData"]["MDUFineGain"] = np.fromstring(fp.read(42 * 2), dtype=">u2") bbdu["BBRelatedData"]["MDUNumericalOffset"] = np.fromstring(fp.read(42 * 2), dtype=">u2") bbdu["BBRelatedData"]["PUGain"] = np.fromstring(fp.read(42 * 2), dtype=">u2") bbdu["BBRelatedData"]["PUOffset"] = np.fromstring(fp.read(27 * 2), dtype=">u2") bbdu["BBRelatedData"]["PUBias"] = np.fromstring(fp.read(15 * 2), dtype=">u2") # 12 bits bitstrings... convert to uint16 data = np.fromstring(fp.read(int(42 * 1.5)), dtype=np.uint8) data = data.astype(np.uint16) data[::3] = data[::3] * 256 + data[1::3] // 16 data[1::3] = (data[1::3] & 0x0f) * 16 + data[2::3] result = np.ravel(data.reshape(-1, 3)[:, :2]) bbdu["BBRelatedData"]["DCRValues"] = result bbdu["BBRelatedData"]["X_DeepSpaceWindowPosition"] = ord(fp.read(1)) bbdu["BBRelatedData"]["ColdFPTemperature"] = {} bbdu["BBRelatedData"]["ColdFPTemperature"][ "FCUNominalColdFocalPlaneTemp"] = rbin.read_uint2(fp.read(2)) / 100. bbdu["BBRelatedData"]["ColdFPTemperature"][ "FCURedundantColdFocalPlaneTemp"] = rbin.read_uint2(fp.read(2)) / 100. bbdu["BBRelatedData"]["WarmFPTemperature"] = {} bbdu["BBRelatedData"]["WarmFPTemperature"][ "FCUNominalWarmFocalPlaneVHROTemp"] = rbin.read_uint2( fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["WarmFPTemperature"][ "FCURedundantWarmFocalPlaneVHROTemp"] = rbin.read_uint2( fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["ScanMirrorTemperature"] = {} bbdu["BBRelatedData"]["ScanMirrorTemperature"][ "FCUNominalScanMirrorSensor1Temp"] = rbin.read_uint2( fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["ScanMirrorTemperature"][ "FCURedundantScanMirrorSensor1Temp"] = rbin.read_uint2( fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["ScanMirrorTemperature"][ "FCUNominalScanMirrorSensor2Temp"] = rbin.read_uint2( fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["ScanMirrorTemperature"][ "FCURedundantScanMirrorSensor2Temp"] = rbin.read_uint2( fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["M1M2M3Temperature"] = {} bbdu["BBRelatedData"]["M1M2M3Temperature"][ "FCUNominalM1MirrorSensor1Temp"] = rbin.read_uint2( fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["M1M2M3Temperature"][ "FCURedundantM1MirrorSensor1Temp"] = rbin.read_uint2( fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["M1M2M3Temperature"][ "FCUNominalM1MirrorSensor2Temp"] = rbin.read_uint2( fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["M1M2M3Temperature"][ "FCURedundantM1MirrorSensor2Temp"] = rbin.read_uint2( fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["M1M2M3Temperature"][ "FCUNominalM23AssemblySensor1Temp"] = ord(fp.read(1)) / 4. + 265 bbdu["BBRelatedData"]["M1M2M3Temperature"][ "FCURedundantM23AssemblySensor1Temp"] = ord(fp.read(1)) / 4. + 265 bbdu["BBRelatedData"]["M1M2M3Temperature"][ "FCUNominalM23AssemblySensor2Temp"] = ord(fp.read(1)) / 4. + 265 bbdu["BBRelatedData"]["M1M2M3Temperature"][ "FCURedundantM23AssemblySensor2Temp"] = ord(fp.read(1)) / 4. + 265 bbdu["BBRelatedData"]["BaffleTemperature"] = {} bbdu["BBRelatedData"]["BaffleTemperature"][ "FCUNominalM1BaffleTemp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["BaffleTemperature"][ "FCURedundantM1BaffleTemp"] = rbin.read_uint2(fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["BlackBodyTemperature"] = {} bbdu["BBRelatedData"]["BlackBodyTemperature"][ "FCUNominalBlackBodySensorTemp"] = rbin.read_uint2( fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["BlackBodyTemperature"][ "FCURedundantBlackBodySensorTemp"] = rbin.read_uint2( fp.read(2)) / 100. + 250 bbdu["BBRelatedData"]["FCUMode"] = {} bbdu["BBRelatedData"]["FCUMode"]["FCUNominalSMMStatus"] = rbin.read_uint2( fp.read(2)) bbdu["BBRelatedData"]["FCUMode"][ "FCURedundantSMMStatus"] = rbin.read_uint2(fp.read(2)) extracted_data_type = np.dtype([('NumberOfPixelsUsed', '>u4'), ('MeanCount', '>f4'), ('RMS', '>f4'), ('MaxCount', '>u2'), ('MinCount', '>u2'), ('BB_Processing_Slope', '>f8'), ('BB_Processing_Offset', '>f8')]) bbdu["BBRelatedData"]["ExtractedBBData"] = np.fromstring( fp.read(32 * 12), dtype=extracted_data_type) impf_cal_type = np.dtype([("ImageQualityFlag", "u1"), ("ReferenceDataFlag", "u1"), ("AbsCalMethod", "u1"), ("Pad1", "u1"), ("AbsCalWeightVic", ">f4"), ("AbsCalWeightXsat", ">f4"), ("AbsCalCoeff", ">f4"), ("AbsCalError", ">f4"), ("GSICSCalCoeff", ">f4"), ("GSICSCalError", ">f4"), ("GSICSOffsetCount", ">f4")]) bbdu["MPEFCalFeedback"] = np.fromstring(fp.read(32 * 12), dtype=impf_cal_type) bbdu["RadTransform"] = np.fromstring(fp.read(42 * 64 * 4), dtype=">f4").reshape((42, 64)) bbdu["RadProcMTFAdaptation"] = {} bbdu["RadProcMTFAdaptation"]["VIS_IRMTFCorrectionE_W"] = np.fromstring( fp.read(33 * 16 * 4), dtype=">f4").reshape((33, 16)) bbdu["RadProcMTFAdaptation"]["VIS_IRMTFCorrectionN_S"] = np.fromstring( fp.read(33 * 16 * 4), dtype=">f4").reshape((33, 16)) bbdu["RadProcMTFAdaptation"]["HRVMTFCorrectionE_W"] = np.fromstring( fp.read(9 * 16 * 4), dtype=">f4").reshape((9, 16)) bbdu["RadProcMTFAdaptation"]["HRVMTFCorrectionN_S"] = np.fromstring( fp.read(9 * 16 * 4), dtype=">f4").reshape((9, 16)) bbdu["RadProcMTFAdaptation"]["StraylightCorrection"] = np.fromstring( fp.read(12 * 8 * 8 * 4), dtype=">f4").reshape((12, 8, 8)) hdr["BlackBodyDataUsed"] = bbdu # GeometricProcessing geoproc = {} geoproc["OptAxisDistances"] = {} geoproc["OptAxisDistances"]["E-WFocalPlane"] = np.fromstring(fp.read(42 * 4), dtype=">f4") geoproc["OptAxisDistances"]["N-SFocalPlane"] = np.fromstring(fp.read(42 * 4), dtype=">f4") geoproc["EarthModel"] = {} geoproc["EarthModel"]["TypeOfEarthModel"] = ord(fp.read(1)) geoproc["EarthModel"]["EquatorialRadius"] = rbin.read_float8(fp.read(8)) geoproc["EarthModel"]["NorthPolarRadius"] = rbin.read_float8(fp.read(8)) geoproc["EarthModel"]["SouthPolarRadius"] = rbin.read_float8(fp.read(8)) geoproc["AtmosphericModel"] = np.fromstring(fp.read(12 * 360 * 4), dtype=">f4").reshape((12, 360)) geoproc["ResamplingFunctions"] = np.fromstring(fp.read(12), dtype=np.uint8) hdr["GeometricProcessing"] = geoproc return hdr
def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) self.nb = rbin.read_uint1(fp.read(1)) self.nc = rbin.read_uint2(fp.read(2)) self.nl = rbin.read_uint2(fp.read(2)) self.compress_flag = rbin.read_uint1(fp.read(1))
def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) self.text = fp.read(self.rec_len - 3).strip()
def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) self.seg_no = rbin.read_uint1(fp.read(1)) self.planned_end_seg_no = rbin.read_uint1(fp.read(1)) self.planned_start_seg_no = 1 self.seg_line_no = rbin.read_uint2(fp.read(2))
def __init__(self, hdr_type, fp): self.hdr_type = hdr_type self.rec_len = rbin.read_uint2(fp.read(2)) self.data = fp.read(self.rec_len-3)
def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) self.cds_p_field = rbin.read_uint1(fp.read(1)) self.time_stamp = rbin.read_cds_time(fp.read(6))
def __init__(self, fp): self.rec_len = rbin.read_uint2(fp.read(2)) self.file_type = rbin.read_uint1(fp.read(1)) self.total_hdr_len = rbin.read_uint4(fp.read(4)) self.data_field_len = rbin.read_uint8(fp.read(8))