示例#1
0
def populate_obs_mission_hubble_HSTNICMOS_filter_type(**kwargs):
    filter1, filter2 = _decode_filters(**kwargs)

    # NICMOS doesn't do filter stacking
    assert filter2 is None

    if filter1.startswith('G'):
        return 'SP'
    if filter1.endswith('N'):
        return 'N'
    if filter1.endswith('M'):
        return 'M'
    if filter1.endswith('W'):
        return 'W'

    if filter1.startswith('POL'):
        if filter1.endswith('S'):
            return 'W' # POLxS is 0.8-1.3, about the same as wide filters
        elif filter1.endswith('L'):
            return 'M' # POLxL is 1.89-2.1, about the same as medium filters

    if filter1 == 'BLANK': # Opaque
        return 'OT'

    import_util.log_nonrepeating_error(f'Unknown filter "{filter1}"')
    return None
示例#2
0
def populate_obs_mission_hubble_HSTACS_filter_type(**kwargs):
    filter1, filter2 = _decode_filters(**kwargs)
    # We only care about filter1 since the second is (almost) always a
    # polarizer
    if filter2 is not None and not filter2.startswith('POL'):
        import_util.log_nonrepeating_warning(
            f'Filter combination {filter1}+{filter2} does not have a'
            +' polarizer as the second filter - filter_type may be wrong')

    # From ACS Inst handbook Table 3.3
    if filter1 in ['F475W', 'F625W', 'F775W', 'F850LP', 'F435W', 'F555W',
                   'F550M', 'F606W', 'F814W', 'F220W', 'F250W', 'F330W',
                   'CLEAR']:
        return 'W'

    if filter1 in ['F658N', 'F502N', 'F660N', 'F344N', 'F892N']:
        return 'N'

    if filter1.startswith('FR'):
        return 'FR'

    if filter1 in ['G800L', 'PR200L', 'PR110L', 'PR130L']:
        return 'SP'

    if filter1 in ['F122M']:
        return 'M'

    if filter1 in ['F115LP', 'F125LP', 'F140LP', 'F150LP', 'F165LP']:
        return 'LP'

    # ACS doesn't have any CH4 filters

    import_util.log_nonrepeating_error(
        f'Unknown filter {filter1} while determining filter type')
    return None
def populate_obs_mission_voyager_spacecraft_clock_count2(**kwargs):
    metadata = kwargs['metadata']
    supp_index_row = metadata['supp_index_row']
    if supp_index_row is None:
        return None
    partition = import_util.safe_column(supp_index_row,
                                        'SPACECRAFT_CLOCK_PARTITION_NUMBER')
    stop_time = supp_index_row['SPACECRAFT_CLOCK_STOP_COUNT']

    sc = str(partition) + '/' + stop_time
    try:
        sc_cvt = opus_support.parse_voyager_sclk(sc)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Unable to parse Voyager SCLK "{sc}": {e}')
        return None

    voyager_row = metadata['obs_mission_voyager_row']
    sc1 = voyager_row['spacecraft_clock_count1']
    if sc1 is not None and sc_cvt < sc1:
        import_util.log_warning(
    f'spacecraft_clock_count1 ({sc1}) and spacecraft_clock_count2 ({sc_cvt}) '
    +f'are in the wrong order - setting to count1')
        sc_cvt = sc1

    return sc_cvt
示例#4
0
def populate_obs_mission_hubble_HSTWFPC2_filter_type(**kwargs):
    filter1, filter2 = _decode_filters(**kwargs)

    if filter2 is None:
        filter2 = ''

    if filter1.startswith('FR') or filter2.startswith('FR'):
        return 'FR' # Ramp overrides everything

    if filter1.startswith('FQ') or filter1 == 'F160BN15':
        filter1 = 'N'
    if filter2.startswith('FQ') or filter2 == 'F160BN15':
        filter2 = 'N'

    # Start from narrowest band - paired filters take the type of the smallest
    # bandpass
    if filter1.endswith('N') or filter2.endswith('N'):
        return 'N'
    if filter1.endswith('M') or filter2.endswith('M'):
        return 'M'
    if filter1.endswith('W') or filter2.endswith('W'):
        return 'W'
    if filter1.endswith('LP') or filter2.endswith('LP'):
        return 'LP'

    import_util.log_nonrepeating_error(
        f'Unknown filter combination "{filter1}+{filter2}"')
    return None
def populate_obs_general_NHMVIC_time2(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    stop_time = import_util.safe_column(index_row, 'STOP_TIME')

    if stop_time is None:
        return None

    try:
        stop_time_sec = julian.tai_from_iso(stop_time)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad stop time format "{stop_time}": {e}')
        return None

    general_row = metadata['obs_general_row']
    start_time_sec = general_row['time1']

    if start_time_sec is not None and stop_time_sec < start_time_sec:
        start_time = import_util.safe_column(index_row, 'START_TIME')
        import_util.log_warning(f'time1 ({start_time}) and time2 ({stop_time}) '
                                f'are in the wrong order - setting to time1')
        stop_time_sec = start_time_sec

    return stop_time_sec
示例#6
0
def populate_obs_mission_voyager_spacecraft_clock_count2(**kwargs):
    metadata = kwargs['metadata']
    supp_index_row = metadata['supp_index_row']
    if supp_index_row is None:
        return None
    partition = import_util.safe_column(supp_index_row,
                                        'SPACECRAFT_CLOCK_PARTITION_NUMBER')
    stop_time = supp_index_row['SPACECRAFT_CLOCK_STOP_COUNT']

    sc = str(partition) + '/' + stop_time
    try:
        sc_cvt = opus_support.parse_voyager_sclk(sc)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Unable to parse Voyager SCLK "{sc}": {e}')
        return None

    voyager_row = metadata['obs_mission_voyager_row']
    sc1 = voyager_row['spacecraft_clock_count1']
    if sc1 is not None and sc_cvt < sc1:
        import_util.log_warning(
    f'spacecraft_clock_count1 ({sc1}) and spacecraft_clock_count2 ({sc_cvt}) '
    +f'are in the wrong order - setting to count1')
        sc_cvt = sc1

    return sc_cvt
def populate_obs_general_COISS_time2(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    stop_time = import_util.safe_column(index_row, 'STOP_TIME')

    if stop_time is None:
        return None

    try:
        stop_time_sec = julian.tai_from_iso(stop_time)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad stop time format "{stop_time}": {e}')
        return None

    general_row = metadata['obs_general_row']
    start_time_sec = general_row['time1']

    if start_time_sec is not None and stop_time_sec < start_time_sec:
        start_time = import_util.safe_column(index_row, 'START_TIME')
        import_util.log_warning(
            f'time1 ({start_time}) and time2 ({stop_time}) '
            f'are in the wrong order - setting to time1')
        stop_time_sec = start_time_sec

    return stop_time_sec
示例#8
0
def populate_obs_mission_hubble_HSTWFPC2_targeted_detector_id(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    targeted_detector_id = index_row['TARGETED_DETECTOR_ID']
    if targeted_detector_id == '':
        import_util.log_nonrepeating_error(
            f'Empty targeted detector ID')
    return targeted_detector_id
def populate_obs_mission_galileo_spacecraft_clock_count2(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    sc = index_row['SPACECRAFT_CLOCK_START_COUNT']
    try:
        sc_cvt = opus_support.parse_galileo_sclk(sc)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Unable to parse Galileo SCLK "{sc}": {e}')
        return None
    return sc_cvt
示例#10
0
def populate_obs_mission_galileo_spacecraft_clock_count2(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    sc = index_row['SPACECRAFT_CLOCK_START_COUNT']
    try:
        sc_cvt = opus_support.parse_galileo_sclk(sc)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Unable to parse Galileo SCLK "{sc}": {e}')
        return None
    return sc_cvt
def populate_obs_occultation_COVIMS_occ_dir_OCC(**kwargs):
    filespec = _COVIMS_file_spec_helper(**kwargs)

    # We don't allow "Both" as a direction since these are always split into
    # separate files.
    if '_I_' in filespec:
        return 'I'
    if '_E_' in filespec:
        return 'E'
    import_util.log_nonrepeating_error(
        f'Unknown ring occultation direction in filespec "{filespec}"')
    return None
def populate_obs_general_NHLORRI_opus_id_OBS(**kwargs):
    file_spec = _NHLORRI_file_spec_helper(**kwargs)
    pds_file = pdsfile.PdsFile.from_filespec(file_spec)
    try:
        opus_id = pds_file.opus_id
    except:
        opus_id = None
    if not opus_id:
        import_util.log_nonrepeating_error(
            f'Unable to create OPUS_ID for FILE_SPEC "{file_spec}"')
        return file_spec.split('/')[-1]
    return opus_id
示例#13
0
def populate_obs_mission_hubble_HSTSTIS_filter_type(**kwargs):
    filter1, filter2 = _decode_filters(**kwargs)
    assert filter2 is None

    if filter1 in ['CLEAR', 'CRYSTAL QUARTZ', 'LONG_PASS',
                   'STRONTIUM_FLUORIDE', 'ND_3']:
        return 'LP'
    if filter1 == 'LYMAN_ALPHA':
        return 'N'

    import_util.log_nonrepeating_error(f'Unknown filter "{filter1}"')
    return None
def _wavelength_helper(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    instrument_id = index_row['INSTRUMENT_NAME'][0]
    filter_name = index_row['FILTER_NAME']

    if filter_name not in _VGISS_FILTER_WAVELENGTHS:
        import_util.log_nonrepeating_error(
            f'Unknown VGISS filter name "{filter_name}"')
        return 0

    return _VGISS_FILTER_WAVELENGTHS[filter_name]
def _wavelength_helper(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    instrument_id = index_row['INSTRUMENT_ID']
    filter_name = index_row['FILTER_NAME']

    if filter_name not in _GOSSI_FILTER_WAVELENGTHS:
        import_util.log_nonrepeating_error(
            f'Unknown GOSSI filter name "{filter_name}"')
        return 0

    return _GOSSI_FILTER_WAVELENGTHS[filter_name]
def helper_cassini_obs_name(**kwargs):
    "Look up the obs_id in the main or supplemental index."
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    obs_id = index_row.get('OBSERVATION_ID', None)
    if obs_id is None:
        supp_index_row = metadata.get('supp_index_row', None) # COUVIS
        if supp_index_row is not None:
            obs_id = supp_index_row.get('OBSERVATION_ID', None)
    if obs_id is None:
        import_util.log_nonrepeating_error('No OBSERVATION_ID found')

    return obs_id
示例#17
0
def populate_obs_general_HSTx_observation_type(**kwargs):
    metadata = kwargs['metadata']
    instrument = kwargs['instrument_name']
    index_row = metadata['index_row']
    obs_type = index_row['OBSERVATION_TYPE']
    if obs_type not in ('IMAGE', 'IMAGING', 'SPECTRUM',
                        'SPECTROSCOPIC'):  # XXX
        import_util.log_nonrepeating_error(
            f'Unknown HST OBSERVATION_TYPE "{obs_type}"')
        return None
    if obs_type.startswith('SPEC'):  # Covers bad "SPECTROSCOPIC" value
        return 'SPI'  # Spectral Image (2-D with spectral information)
    return 'IMG'  # Image
def populate_obs_general_CORSS_time1_OCC(**kwargs):
    metadata = kwargs['metadata']
    supp_index_row = metadata['supp_index_row']
    start_time = supp_index_row['SPACECRAFT_EVENT_START_TIME']

    try:
        start_time_sec = julian.tai_from_iso(start_time)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad start time format "{start_time}": {e}')
        return None

    return start_time_sec
def populate_obs_pds_COISS_product_creation_time(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    pct = index_row['PRODUCT_CREATION_TIME']

    try:
        pct_sec = julian.tai_from_iso(pct)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad product creation time format "{pct}": {e}')
        return None

    return pct_sec
def populate_obs_pds_COVIMS_product_creation_time(**kwargs):
    metadata = kwargs['metadata']
    index_label = metadata['index_label']
    pct = index_label['PRODUCT_CREATION_TIME']

    try:
        pct_sec = julian.tai_from_iso(pct)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad product creation time format "{pct}": {e}')
        return None

    return pct_sec
def populate_obs_general_NHMVIC_opus_id(**kwargs):
    file_spec = _NHMVIC_file_spec_helper(**kwargs)
    pds_file = pdsfile.PdsFile.from_filespec(file_spec)
    try:
        opus_id = pds_file.opus_id.replace('.', '-')
    except:
        opus_id = None
    if not opus_id:
        metadata = kwargs['metadata']
        index_row = metadata['index_row']
        import_util.log_nonrepeating_error(
            f'Unable to create OPUS_ID for FILE_SPEC "{file_spec}"')
        return file_spec.split('/')[-1]
    return opus_id
def _pixel_size_helper(**kwargs):
    # For COISS, this is both greater and lesser pixel size
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    exposure = index_row['INSTRUMENT_MODE_ID']
    if exposure == 'FULL':
        return 1024
    if exposure == 'SUM2':
        return 512
    if exposure == 'SUM4':
        return 256
    import_util.log_nonrepeating_error(
        f'Unknown INSTRUMENT_MODE_ID "{exposure}"')
    return None
def populate_obs_general_COISS_opus_id(**kwargs):
    file_spec = _COISS_file_spec_helper(**kwargs)
    pds_file = pdsfile.PdsFile.from_filespec(file_spec)
    try:
        opus_id = pds_file.opus_id.replace('.', '-')
    except:
        opus_id = None
    if not opus_id:
        metadata = kwargs['metadata']
        index_row = metadata['index_row']
        import_util.log_nonrepeating_error(
            f'Unable to create OPUS_ID for FILE_SPEC "{file_spec}"')
        return file_spec.split('/')[-1]
    return opus_id
示例#24
0
def populate_obs_pds_GOSSI_product_creation_time(**kwargs):
    # For GOSSI the PRODUCT_CREATION_TIME is provided in the volume label file,
    # not the individual observation rows
    metadata = kwargs['metadata']
    index_label = metadata['index_label']
    pct = index_label['PRODUCT_CREATION_TIME']

    try:
        pct_sec = julian.tai_from_iso(pct)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad product creation time format "{pct}": {e}')
        return None

    return pct_sec
def populate_obs_pds_NHMVIC_product_creation_time(**kwargs):
    metadata = kwargs['metadata']
    supp_index_row = metadata['supp_index_row']
    if supp_index_row is None:
        return None
    pct = supp_index_row['PRODUCT_CREATION_TIME']

    try:
        pct_sec = julian.tai_from_iso(pct)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad product creation time format "{pct}": {e}')
        return None

    return pct_sec
示例#26
0
def populate_obs_general_COVIMS_opus_id_OBS(**kwargs):
    metadata = kwargs['metadata']
    phase_name = metadata['phase_name'].lower()
    file_spec = _COVIMS_file_spec_helper(**kwargs)
    pds_file = pdsfile.PdsFile.from_filespec(file_spec)
    try:
        opus_id = pds_file.opus_id
    except:
        opus_id = None
    if not opus_id:
        import_util.log_nonrepeating_error(
            f'Unable to create OPUS_ID for FILE_SPEC "{file_spec}"')
        return file_spec.split('/')[-1] + '_' + phase_name
    opus_id += '_' + phase_name
    return opus_id
def populate_obs_pds_GOSSI_product_creation_time(**kwargs):
    # For GOSSI the PRODUCT_CREATION_TIME is provided in the volume label file,
    # not the individual observation rows
    metadata = kwargs['metadata']
    index_label = metadata['index_label']
    pct = index_label['PRODUCT_CREATION_TIME']

    try:
        pct_sec = julian.tai_from_iso(pct)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad product creation time format "{pct}": {e}')
        return None

    return pct_sec
示例#28
0
def populate_obs_occultation_GB_occ_dir_OCC(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    occ_dir = index_row['OCCULTATION_DIRECTION']

    if occ_dir == 'INGRESS':
        return 'I'
    if occ_dir == 'EGRESS':
        return 'E'
    if occ_dir == 'BOTH':
        return 'B'

    import_util.log_nonrepeating_error(
        f'Unknown OCCULTATION_DIRECTION "{occ_dir}"')
    return None
def populate_obs_mission_voyager_ert(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    ert_time = index_row['EARTH_RECEIVED_TIME']

    if ert_time.startswith('UNK'):
        return None

    try:
        ert_sec = julian.tai_from_iso(ert_time)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad earth received time format "{ert_time}": {e}')
        return None

    return ert_sec
示例#30
0
def populate_obs_mission_voyager_ert(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    ert_time = index_row['EARTH_RECEIVED_TIME']

    if ert_time.startswith('UNK'):
        return None

    try:
        ert_sec = julian.tai_from_iso(ert_time)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad earth received time format "{ert_time}": {e}')
        return None

    return ert_sec
def populate_obs_general_COISS_time1(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    start_time = import_util.safe_column(index_row, 'START_TIME')

    if start_time is None:
        return None

    try:
        start_time_sec = julian.tai_from_iso(start_time)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad start time format "{start_time}": {e}')
        return None

    return start_time_sec
示例#32
0
def populate_obs_mission_hubble_publication_date(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    pub_date = index_row['PUBLICATION_DATE']

    if pub_date is None:
        return None

    try:
        pub_date_sec = julian.tai_from_iso(pub_date)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad publication date format "{pub_date}": {e}')
        return None

    return pub_date_sec
def populate_obs_general_NHMVIC_time1(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    start_time = import_util.safe_column(index_row, 'START_TIME')

    if start_time is None:
        return None

    try:
        start_time_sec = julian.tai_from_iso(start_time)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad start time format "{start_time}": {e}')
        return None

    return start_time_sec
def populate_obs_general_COCIRS_ring_obs_id(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    instrument_id = index_row['DETECTOR_ID']
    filename = index_row['SPECTRUM_FILE_SPECIFICATION'].split('/')[-1]
    if not filename.startswith('SPEC') or not filename.endswith('.DAT'):
        import_util.log_nonrepeating_error(
            f'Bad format SPECTRUM_FILE_SPECIFICATION "{filename}"')
        return None
    image_num = filename[4:14]
    planet = helper_cassini_planet_id(**kwargs)
    if planet is None:
        pl_str = ''
    else:
        pl_str = planet[0]

    return pl_str + '_SPEC_CO_CIRS_' + image_num + '_' + instrument_id
示例#35
0
def populate_obs_mission_voyager_spacecraft_clock_count1(**kwargs):
    metadata = kwargs['metadata']
    supp_index_row = metadata['supp_index_row']
    if supp_index_row is None:
        return None
    partition = import_util.safe_column(supp_index_row,
                                        'SPACECRAFT_CLOCK_PARTITION_NUMBER')
    start_time = supp_index_row['SPACECRAFT_CLOCK_START_COUNT']

    sc = str(partition) + '/' + start_time
    try:
        sc_cvt = opus_support.parse_voyager_sclk(sc)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Unable to parse Voyager SCLK "{sc}": {e}')
        return None
    return sc_cvt
def populate_obs_general_GOSSI_time1_OBS(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    stop_time = import_util.safe_column(index_row, 'IMAGE_TIME')
    exposure = import_util.safe_column(index_row, 'EXPOSURE_DURATION')

    if exposure is None or stop_time is None:
        exposure = 0

    try:
        stop_time_sec = julian.tai_from_iso(stop_time)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad image time format "{stop_time}": {e}')
        return None

    return stop_time_sec - exposure / 1000
def populate_obs_mission_voyager_spacecraft_clock_count1(**kwargs):
    metadata = kwargs['metadata']
    supp_index_row = metadata['supp_index_row']
    if supp_index_row is None:
        return None
    partition = import_util.safe_column(supp_index_row,
                                        'SPACECRAFT_CLOCK_PARTITION_NUMBER')
    start_time = supp_index_row['SPACECRAFT_CLOCK_START_COUNT']

    sc = str(partition) + '/' + start_time
    try:
        sc_cvt = opus_support.parse_voyager_sclk(sc)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Unable to parse Voyager SCLK "{sc}": {e}')
        return None
    return sc_cvt
def populate_obs_general_COCIRS_ring_obs_id(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    instrument_id = index_row['DETECTOR_ID']
    filename = index_row['SPECTRUM_FILE_SPECIFICATION'].split('/')[-1]
    if not filename.startswith('SPEC') or not filename.endswith('.DAT'):
        import_util.log_nonrepeating_error(
            f'Bad format SPECTRUM_FILE_SPECIFICATION "{filename}"')
        return None
    image_num = filename[4:14]
    planet = helper_cassini_planet_id(**kwargs)
    if planet is None:
        pl_str = ''
    else:
        pl_str = planet[0]

    return pl_str + '_SPEC_CO_CIRS_' + image_num + '_' + instrument_id
def populate_obs_general_GOSSI_time1(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    stop_time = import_util.safe_column(index_row, 'IMAGE_TIME')
    exposure = import_util.safe_column(index_row, 'EXPOSURE_DURATION')

    if exposure is None or stop_time is None:
        exposure = 0

    try:
        stop_time_sec = julian.tai_from_iso(stop_time)
    except Exception as e:
        import_util.log_nonrepeating_error(
            f'Bad image time format "{stop_time}": {e}')
        return None

    return stop_time_sec-exposure/1000
示例#40
0
def helper_new_horizons_planet_id(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['supp_index_row']
    # Values are:
    #   Jupiter Encounter
    #   Pluto Cruise
    #   Pluto Encounter
    #   Post-Launch Checkout
    mp = index_row['MISSION_PHASE_NAME'].upper()
    if mp == 'JUPITER ENCOUNTER':
        return 'JUP'
    if (mp == 'PLUTO CRUISE' or mp == 'PLUTO ENCOUNTER'):
        return 'PLU'
    if mp == 'POST-LAUNCH CHECKOUT':
        return 'OTH'

    import_util.log_nonrepeating_error(f'Unknown MISSION_PHASE_NAME "{mp}"')
    return None
示例#41
0
def helper_groundbased_target_name(**kwargs):
    metadata = kwargs['metadata']
    index_label = metadata['index_label']
    target_name = index_label['TARGET_NAME']

    if target_name != 'S RINGS':
        import_util.log_nonrepeating_error(
            f'Ground-based mission targets "{target_name}" instead of "S RINGS"'
        )

    if target_name in TARGET_NAME_MAPPING:
        target_name = TARGET_NAME_MAPPING[target_name]
    if target_name is None:
        return None
    if target_name not in TARGET_NAME_INFO:
        import_util.announce_unknown_target_name(target_name)
        return None

    target_name_info = TARGET_NAME_INFO[target_name]
    return target_name, target_name_info[2]
def populate_obs_general_COUVIS_opus_id_OCC(**kwargs):
    file_spec = _COUVIS_file_spec_helper(**kwargs)
    pds_file = pdsfile.PdsFile.from_filespec(file_spec)
    try:
        opus_id = pds_file.opus_id
    except:
        opus_id = None
    if not opus_id:
        import_util.log_nonrepeating_error(
            f'Unable to create OPUS_ID for FILE_SPEC "{file_spec}"')
        return file_spec.split('/')[-1]

    # We do this because the filenames are wrong in the archive
    if opus_id == 'co-uvis-occ-2005-139-psicen-e':
        opus_id = 'co-uvis-occ-2007-038-psicen-e'
    elif opus_id == 'co-uvis-occ-2005-139-thehya-e':
        opus_id = 'co-uvis-occ-2009-062-thehya-e'
    elif opus_id == 'co-uvis-occ-2007-038-sao205839-i':
        opus_id = 'co-uvis-occ-2008-026-sao205839-i'

    return opus_id
def populate_obs_instrument_COISS_image_observation_type(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    obs_type = index_row['IMAGE_OBSERVATION_TYPE']

    # Sometimes they have both SCIENCE,OPNAV and OPNAV,SCIENCE so normalize
    # the order
    has_science = obs_type.find('SCIENCE') != -1
    has_opnav = obs_type.find('OPNAV') != -1
    has_calib = obs_type.find('CALIBRATION') != -1
    has_support = obs_type.find('SUPPORT') != -1
    has_unk = obs_type.find('UNK') != -1
    has_eng = obs_type.find('ENGINEERING') != -1

    ret_list = []
    if has_science:
        ret_list.append('SCIENCE')
    if has_opnav:
        ret_list.append('OPNAV')
    if has_calib:
        ret_list.append('CALIBRATION')
    if has_eng:
        ret_list.append('ENGINEERING')
    if has_support:
        ret_list.append('SUPPORT')
    if has_unk:
        ret_list.append('UNKNOWN')

    ret = '/'.join(ret_list)

    # If the result isn't the same length as what we started with, we must've
    # encountered a new type we didn't know about
    if len(ret) != len(obs_type.replace('UNK', 'UNKNOWN')):
        import_util.log_nonrepeating_error(
            f'Unknown format for COISS image_observation_type: "{obs_type}"')
        return None

    return ret