コード例 #1
0
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
コード例 #2
0
def populate_obs_type_image_COVIMS_duration_OBS(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    inst_mod = index_row['INSTRUMENT_MODE_ID']

    if inst_mod != 'IMAGE':
        return None

    phase_name = metadata['phase_name']
    ir_exp = import_util.safe_column(index_row, 'IR_EXPOSURE')
    vis_exp = import_util.safe_column(index_row, 'VIS_EXPOSURE')

    if phase_name == 'IR':
        if ir_exp is None:
            return None
        if ir_exp < 0:
            import_util.log_nonrepeating_warning(f'IR Exposure {ir_exp} is < 0')
            return None
        return ir_exp/1000
    if vis_exp is None:
        return None
    if vis_exp < 0:
        import_util.log_nonrepeating_warning(f'VIS Exposure {vis_exp} is < 0')
        return None
    return vis_exp/1000
コード例 #3
0
def populate_obs_type_image_COVIMS_duration(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    inst_mod = index_row['INSTRUMENT_MODE_ID']

    if inst_mod != 'IMAGE':
        return None

    phase_name = metadata['phase_name']
    ir_exp = import_util.safe_column(index_row, 'IR_EXPOSURE')
    vis_exp = import_util.safe_column(index_row, 'VIS_EXPOSURE')

    if phase_name == 'IR':
        if ir_exp is None:
            return None
        if ir_exp < 0:
            import_util.log_nonrepeating_warning(f'IR Exposure {ir_exp} is < 0')
            return None
        return ir_exp/1000
    if vis_exp is None:
        return None
    if vis_exp < 0:
        import_util.log_nonrepeating_warning(f'VIS Exposure {vis_exp} is < 0')
        return None
    return vis_exp/1000
コード例 #4
0
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
コード例 #5
0
def populate_obs_type_image_HSTx_greater_pixel_size_OBS(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    lines = import_util.safe_column(index_row, 'LINES')
    samples = import_util.safe_column(index_row, 'LINE_SAMPLES')
    if lines is None or samples is None:
        return None
    return max(lines, samples)
コード例 #6
0
def populate_obs_general_COISS_right_asc2(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MAXIMUM_RIGHT_ASCENSION')

    index_row = metadata['index_row']
    ra = import_util.safe_column(index_row, 'RIGHT_ASCENSION')
    return ra
コード例 #7
0
def populate_obs_general_NHMVIC_right_asc2(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MAXIMUM_RIGHT_ASCENSION')

    supp_index_row = metadata['supp_index_row']
    ra = import_util.safe_column(supp_index_row, 'RIGHT_ASCENSION')
    return ra
コード例 #8
0
def populate_obs_general_COISS_declination2(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MAXIMUM_DECLINATION')

    index_row = metadata['index_row']
    dec = import_util.safe_column(index_row, 'DECLINATION')
    return dec
コード例 #9
0
def populate_obs_general_COUVIS_declination1(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MINIMUM_DECLINATION')

    index_row = metadata['index_row']
    dec = import_util.safe_column(index_row, 'DECLINATION')
    return dec
コード例 #10
0
def populate_obs_general_COUVIS_right_asc1(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MINIMUM_RIGHT_ASCENSION')

    index_row = metadata['index_row']
    ra = import_util.safe_column(index_row, 'RIGHT_ASCENSION')
    return ra
コード例 #11
0
def populate_obs_general_NHMVIC_declination2(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MAXIMUM_DECLINATION')

    supp_index_row = metadata['supp_index_row']
    dec = import_util.safe_column(supp_index_row, 'DECLINATION')
    return dec
コード例 #12
0
def populate_obs_general_NHLORRI_right_asc1_OBS(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MINIMUM_RIGHT_ASCENSION')

    supp_index_row = metadata['supp_index_row']
    ra = import_util.safe_column(supp_index_row, 'RIGHT_ASCENSION')
    return ra
コード例 #13
0
def populate_obs_general_NHLORRI_declination1_OBS(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MINIMUM_DECLINATION')

    supp_index_row = metadata['supp_index_row']
    dec = import_util.safe_column(supp_index_row, 'DECLINATION')
    return dec
コード例 #14
0
def populate_obs_wavelength_HSTSTIS_wave_res2_OBS(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    wr1 = import_util.safe_column(index_row, 'MAXIMUM_WAVELENGTH_RESOLUTION')
    wr2 = import_util.safe_column(index_row, 'MINIMUM_WAVELENGTH_RESOLUTION')

    # This is necessary because in some cases these are backwards in the table!
    if wr1 > wr2:
        return wr1
    return wr2
コード例 #15
0
def populate_obs_general_GOSSI_declination2_OBS(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MAXIMUM_DECLINATION')

    index_row = metadata['index_row']
    dec = import_util.safe_column(index_row, 'DECLINATION')
    if dec is None:
        return None
    return dec + np.rad2deg(_GOSSI_FOV_RAD_DIAG / 2)
コード例 #16
0
def populate_obs_general_GOSSI_declination2(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MAXIMUM_DECLINATION')

    index_row = metadata['index_row']
    dec = import_util.safe_column(index_row, 'DECLINATION')
    if dec is None:
        return None
    return dec + np.rad2deg(_GOSSI_FOV_RAD_DIAG/2)
コード例 #17
0
def populate_obs_type_image_COVIMS_greater_pixel_size_OBS(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    inst_mod = index_row['INSTRUMENT_MODE_ID']

    if inst_mod != 'IMAGE':
        return None

    width = import_util.safe_column(index_row, 'SWATH_WIDTH')
    length = import_util.safe_column(index_row, 'SWATH_LENGTH')

    return max(width, length)
コード例 #18
0
def populate_obs_type_image_COVIMS_greater_pixel_size(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    inst_mod = index_row['INSTRUMENT_MODE_ID']

    if inst_mod != 'IMAGE':
        return None

    width = import_util.safe_column(index_row, 'SWATH_WIDTH')
    length = import_util.safe_column(index_row, 'SWATH_LENGTH')

    return max(width, length)
コード例 #19
0
def populate_obs_wavelength_HSTx_wavelength2_OBS(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    wl1 = import_util.safe_column(index_row, 'MINIMUM_WAVELENGTH')
    wl2 = import_util.safe_column(index_row, 'MAXIMUM_WAVELENGTH')

    if wl1 is None or wl2 is None:
        return None

    # This is necessary because in some cases these are backwards in the table!
    if wl1 > wl2:
        return wl1
    return wl2
コード例 #20
0
def populate_obs_general_HSTx_quantity_OBS(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    wl1 = import_util.safe_column(index_row, 'MINIMUM_WAVELENGTH')
    wl2 = import_util.safe_column(index_row, 'MAXIMUM_WAVELENGTH')

    if wl1 is None or wl2 is None:
        return 'REFLECT'

    # We call it "EMISSION" if at least 3/4 of the passband is below 350 nm
    # and the high end of the passband is below 400 nm.
    if wl2 < 0.4 and (3*wl1+wl2)/4 < 0.35:
        return 'EMISSION'
    return 'REFLECT'
コード例 #21
0
def populate_obs_general_VGISS_declination2(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MAXIMUM_DECLINATION')

    return None
コード例 #22
0
def populate_obs_ring_geometry_CORSS_emission2_OCC(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    inc = import_util.safe_column(index_row,
                                  'MINIMUM_LIGHT_SOURCE_INCIDENCE_ANGLE')

    return 180 - inc
コード例 #23
0
def populate_obs_general_VGISS_declination1(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MINIMUM_DECLINATION')

    return None
コード例 #24
0
def _emission_helper(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    em = 90+abs(import_util.safe_column(index_row,
                                         'OBSERVED_RING_ELEVATION'))

    return em
コード例 #25
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
コード例 #26
0
def _incidence_helper(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    inc = 90 - abs(
        import_util.safe_column(index_row, 'OBSERVED_RING_ELEVATION'))

    return inc
コード例 #27
0
 def _some_index_col(self, col, idx=None):
     index = self._col_in_some_index(col)
     if index is None:
         self._log_nonrepeating_error(
             f'Column "{col}" not found in supp_index or index')
         return None
     return safe_column(self._metadata[index], col, idx=idx)
コード例 #28
0
def populate_obs_general_VGISS_right_asc1(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MINIMUM_RIGHT_ASCENSION')

    return None
コード例 #29
0
def populate_obs_general_VGISS_right_asc2(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MAXIMUM_RIGHT_ASCENSION')

    return None
コード例 #30
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
コード例 #31
0
def populate_obs_ring_geometry_CORSS_observer_ring_opening_angle2_OCC(
        **kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    el = import_util.safe_column(index_row, 'MAXIMUM_OBSERVED_RING_ELEVATION')

    return el
コード例 #32
0
def populate_obs_occultation_COUVIS_optical_depth_max_OCC(**kwargs):
    metadata = kwargs['metadata']
    supp_index_row = metadata['supp_index_row']
    opac = import_util.safe_column(supp_index_row,
                                   'HIGHEST_DETECTABLE_OPACITY')

    return opac
コード例 #33
0
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
コード例 #34
0
def _GOSSI_ra_helper(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MINIMUM_RIGHT_ASCENSION')

    index_row = metadata['index_row']
    ra = import_util.safe_column(index_row, 'RIGHT_ASCENSION')
    dec = import_util.safe_column(index_row, 'DECLINATION')
    if ra is None or dec is None:
        return None, None
    delta = np.rad2deg(_GOSSI_FOV_RAD_DIAG/2 / np.cos(np.deg2rad(dec)))
    ra1 = (ra-delta) % 360
    ra2 = (ra+delta) % 360
    if ra2 < ra1:
        ra1, ra2 = ra2, ra1
    return ra1, ra2
コード例 #35
0
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
コード例 #36
0
def _GOSSI_ra_helper(**kwargs):
    metadata = kwargs['metadata']
    ring_geo_row = metadata.get('ring_geo_row', None)
    if ring_geo_row is not None:
        return import_util.safe_column(ring_geo_row, 'MINIMUM_RIGHT_ASCENSION')

    index_row = metadata['index_row']
    ra = import_util.safe_column(index_row, 'RIGHT_ASCENSION')
    dec = import_util.safe_column(index_row, 'DECLINATION')
    if ra is None or dec is None:
        return None, None
    delta = np.rad2deg(_GOSSI_FOV_RAD_DIAG / 2 / np.cos(np.deg2rad(dec)))
    ra1 = (ra - delta) % 360
    ra2 = (ra + delta) % 360
    if ra2 < ra1:
        ra1, ra2 = ra2, ra1
    return ra1, ra2
コード例 #37
0
def populate_obs_general_HSTx_observation_duration_OBS(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    exposure = import_util.safe_column(index_row, 'EXPOSURE_DURATION')

    if exposure is None:
        return None

    return exposure
コード例 #38
0
def populate_obs_instrument_covims_ir_exposure_OBS(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    ir_exp = import_util.safe_column(index_row, 'IR_EXPOSURE')

    if ir_exp is None:
        return None

    return ir_exp / 1000.
コード例 #39
0
def populate_obs_type_image_COUVIS_duration(**kwargs):
    if not _COUVIS_is_image(**kwargs):
        return None

    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    integration_duration = import_util.safe_column(index_row,
                                                   'INTEGRATION_DURATION')
    return integration_duration
コード例 #40
0
def populate_obs_general_NHLORRI_observation_duration(**kwargs):
    metadata = kwargs['metadata']
    supp_index_row = metadata['supp_index_row']
    exposure = import_util.safe_column(supp_index_row, 'EXPOSURE_DURATION')

    if exposure is None:
        return None

    return exposure
コード例 #41
0
def populate_obs_type_image_COUVIS_duration(**kwargs):
    if not _COUVIS_is_image(**kwargs):
        return None

    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    integration_duration = import_util.safe_column(index_row,
                                                   'INTEGRATION_DURATION')
    return integration_duration
コード例 #42
0
def populate_obs_general_NHMVIC_observation_duration(**kwargs):
    metadata = kwargs['metadata']
    supp_index_row = metadata['supp_index_row']
    exposure = import_util.safe_column(supp_index_row, 'EXPOSURE_DURATION')

    if exposure is None:
        return None

    return exposure
コード例 #43
0
def populate_obs_wavelength_COUVIS_spec_size(**kwargs):
    channel, image_time = _COUVIS_channel_time_helper(**kwargs)
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    slit_state = index_row['SLIT_STATE']

    if channel == 'HSP' or channel == 'HDAC':
        return None

    supp_index_row = metadata.get('supp_index_row', None)
    if supp_index_row is None:
        return None
    band1 = import_util.safe_column(supp_index_row, 'MINIMUM_BAND_NUMBER')
    band2 = import_util.safe_column(supp_index_row, 'MAXIMUM_BAND_NUMBER')
    band_bin = import_util.safe_column(supp_index_row, 'BAND_BINNING_FACTOR')
    if band1 is None or band2 is None or band_bin is None:
        return None

    return (band2 - band1 + 1) // band_bin
コード例 #44
0
def populate_obs_general_VGISS_observation_duration(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    exposure = import_util.safe_column(index_row, 'EXPOSURE_DURATION')

    if exposure is None or exposure < 0:
        # There's one exposure somewhere that has duration -0.09999
        return None

    return exposure
コード例 #45
0
def populate_obs_general_VGISS_observation_duration(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    exposure = import_util.safe_column(index_row, 'EXPOSURE_DURATION')

    if exposure is None or exposure < 0:
        # There's one exposure somewhere that has duration -0.09999
        return None

    return exposure
コード例 #46
0
def populate_obs_wavelength_COUVIS_spec_size(**kwargs):
    channel, image_time = _COUVIS_channel_time_helper(**kwargs)
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    slit_state = index_row['SLIT_STATE']

    if channel == 'HSP' or channel == 'HDAC':
        return None

    supp_index_row = metadata.get('supp_index_row', None)
    if supp_index_row is None:
        return None
    band1 = import_util.safe_column(supp_index_row, 'MINIMUM_BAND_NUMBER')
    band2 = import_util.safe_column(supp_index_row, 'MAXIMUM_BAND_NUMBER')
    band_bin = import_util.safe_column(supp_index_row, 'BAND_BINNING_FACTOR')
    if band1 is None or band2 is None or band_bin is None:
        return None

    return (band2 - band1 + 1) // band_bin
コード例 #47
0
def populate_obs_type_image_COUVIS_greater_pixel_size(**kwargs):
    if not _COUVIS_is_image(**kwargs):
        return None

    metadata = kwargs['metadata']
    supp_index_row = metadata.get('supp_index_row', None)
    if supp_index_row is None:
        return None
    line1 = import_util.safe_column(supp_index_row,
                                    'WINDOW_MINIMUM_LINE_NUMBER')
    line2 = import_util.safe_column(supp_index_row,
                                    'WINDOW_MAXIMUM_LINE_NUMBER')
    line_bin = import_util.safe_column(supp_index_row, 'LINE_BINNING_FACTOR')
    samples = import_util.safe_column(supp_index_row, 'LINE_SAMPLES')
    if line1 is None or line2 is None or line_bin is None or samples is None:
        return None
    pixels = max(samples, (line2 - line1 + 1) // line_bin)
    if pixels < 0:
        return None
    return pixels
コード例 #48
0
def populate_obs_type_image_COUVIS_greater_pixel_size(**kwargs):
    if not _COUVIS_is_image(**kwargs):
        return None

    metadata = kwargs['metadata']
    supp_index_row = metadata.get('supp_index_row', None)
    if supp_index_row is None:
        return None
    line1 = import_util.safe_column(supp_index_row,
                                    'WINDOW_MINIMUM_LINE_NUMBER')
    line2 = import_util.safe_column(supp_index_row,
                                    'WINDOW_MAXIMUM_LINE_NUMBER')
    line_bin = import_util.safe_column(supp_index_row,
                                       'LINE_BINNING_FACTOR')
    samples = import_util.safe_column(supp_index_row, 'LINE_SAMPLES')
    if line1 is None or line2 is None or line_bin is None or samples is None:
        return None
    pixels = max(samples, (line2-line1+1)//line_bin)
    if pixels < 0:
        return None
    return pixels
コード例 #49
0
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
コード例 #50
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
コード例 #51
0
def _COUVIS_wave_res_helper(**kwargs):
    metadata = kwargs['metadata']
    supp_index_row = metadata.get('supp_index_row', None)
    if supp_index_row is None:
        return None
    channel, image_time = _COUVIS_channel_time_helper(**kwargs)
    band_bin = import_util.safe_column(supp_index_row, 'BAND_BINNING_FACTOR')

    if channel == 'EUV':
        return band_bin * 0.0000607422
    if channel == 'FUV':
        return band_bin * 0.000078125

    wl_row = metadata['obs_wavelength_row']
    wl1 = wl_row['wavelength1']
    wl2 = wl_row['wavelength2']
    if wl1 is None or wl2 is None:
        return None
    return wl2 - wl1
コード例 #52
0
def populate_obs_wavelength_COUVIS_wavelength2(**kwargs):
    channel, image_time = _COUVIS_channel_time_helper(**kwargs)
    if channel == 'HSP':
        return 0.19
    if channel == 'HDAC':
        return 0.180

    metadata = kwargs['metadata']
    supp_index_row = metadata.get('supp_index_row', None)
    if supp_index_row is None:
        return None
    band2 = import_util.safe_column(supp_index_row, 'MINIMUM_BAND_NUMBER')
    if band2 is None:
        return None

    if channel == 'EUV':
        return  0.0558 + (band2 + 1) * 0.0000607422
    if channel == 'FUV':
        return 0.11 + (band2 + 1) * 0.000078125

    import_util.log_nonrepeating_warning(
        f'obs_wavelength_COUVIS_wavelength1 has unknown channel type '+
        f' {channel}')
    return None
コード例 #53
0
def populate_obs_general_COCIRS_observation_duration(**kwargs):
    metadata = kwargs['metadata']
    index_row = metadata['index_row']
    # This is the MEAN duration in SECONDS
    exposure = import_util.safe_column(index_row, 'EXPOSURE_DURATION')
    return exposure