示例#1
0
 def test_remove_2D_names_w_target(self):
     gen.remove_leading_text(self.testInst, target='variable')
     # check prepended text removed from variables
     assert '_profiles' in self.testInst.data.variables
     assert self.testInst.data['_profiles'].shape[0] == self.Npts
     # check prepended text removed from metadata
     assert '_profiles' in self.testInst.meta.keys()
示例#2
0
 def test_remove_names_wo_target(self):
     self.testInst['ICON_L27_Blurp'] = self.testInst['dummy1']
     gen.remove_leading_text(self.testInst)
     # check variables unchanged
     assert (len(self.testInst['ICON_L27_Blurp']) == self.Npts)
     # check other names untouched
     assert (len(self.testInst['dummy1']) == self.Npts)
示例#3
0
def remove_preamble(inst):
    """Removes preambles in variable names

    Parameters
    -----------
    inst : pysat.Instrument
        ICON FUV or MIGHTI Instrument class object

    """
    id_str = inst.inst_id.upper()

    target = {
        'los_wind_green':
        'ICON_L21_',
        'los_wind_red':
        'ICON_L21_',
        'vector_wind_green':
        'ICON_L22_',
        'vector_wind_red':
        'ICON_L22_',
        'temperature': [
            'ICON_L1_MIGHTI_{id:s}_'.format(id=id_str),
            'ICON_L23_MIGHTI_{id:s}_'.format(id=id_str), 'ICON_L23_'
        ],
        'day':
        'ICON_L24_',
        'night':
        'ICON_L25_'
    }
    mm_gen.remove_leading_text(inst, target=target[inst.tag])

    return
示例#4
0
 def test_remove_names_w_target(self):
     self.testInst['ICON_L27_Blurp'] = self.testInst['dummy1']
     gen.remove_leading_text(self.testInst, target='ICON_L27')
     # check prepended text removed
     assert len(self.testInst['_Blurp']) == self.Npts
     # check other names untouched
     assert len(self.testInst['dummy1']) == self.Npts
     # check prepended text removed from metadata
     assert '_Blurp' in self.testInst.meta.keys()
示例#5
0
def remove_preamble(inst):
    """Removes preambles in variable names"""

    target = {'los_wind_green': 'ICON_L21_',
              'los_wind_red': 'ICON_L21_',
              'vector_wind_green': 'ICON_L22_',
              'vector_wind_red': 'ICON_L22_',
              'temperature': ['ICON_L1_MIGHTI_{}_'.format(inst.sat_id.upper()),
                              'ICON_L23_MIGHTI_{}_'.format(inst.sat_id.upper()),
                              'ICON_L23_']}
    mm_gen.remove_leading_text(inst, target=target[inst.tag])

    return
示例#6
0
def default(inst):
    """Default routine to be applied when loading data. Removes variable
    preambles.

    Parameters
    -----------
    inst : (pysat.Instrument)
        Instrument class object

    """

    if not inst.kwargs['keep_original_names']:
        mm_gen.remove_leading_text(inst, target='ICON_L27_')
示例#7
0
def default(inst):
    """Default routine to be applied when loading data. Adjusts epoch timestamps
    to datetimes and removes variable preambles.

    Parameters
    -----------
    inst : (pysat.Instrument)
        Instrument class object

    """

    mm_gen.convert_timestamp_to_datetime(inst, sec_mult=1.0e-3)
    if not inst.kwargs['keep_original_names']:
        mm_gen.remove_leading_text(inst, target='ICON_L26_')
示例#8
0
def preprocess(self, keep_original_names=False):
    """Removes variable preambles.

    Parameters
    ----------
    keep_original_names : boolean
        if True then the names as given in the netCDF ICON file
        will be used as is. If False, a preamble is removed. (default=False)

    """

    if not keep_original_names:
        mm_gen.remove_leading_text(self, target='ICON_L27_')
    return
示例#9
0
def preprocess(self, keep_original_names=False):
    """Adjusts epoch timestamps to datetimes and removes variable preambles.

    Parameters
    ----------
    keep_original_names : boolean
        if True then the names as given in the netCDF ICON file
        will be used as is. If False, a preamble is removed. (default=False)

    """

    mm_gen.convert_timestamp_to_datetime(self, sec_mult=1.0e-3)
    if not keep_original_names:
        mm_gen.remove_leading_text(self, target='ICON_L26_')
    return
示例#10
0
def remove_preamble(inst):
    """Removes preambles in variable names"""

    target = {'day': 'ICON_L24_',
              'night': 'ICON_L25_'}
    mm_gen.remove_leading_text(inst, target=target[inst.tag])
示例#11
0
 def test_remove_prefix_w_bad_target(self):
     self.testInst['ICON_L27_Blurp'] = self.testInst['dummy1']
     gen.remove_leading_text(self.testInst, target=17.5)
示例#12
0
 def test_remove_prefix_w_bad_target(self):
     self.testInst['ICON_L27_Blurp'] = self.testInst['dummy1']
     with pytest.raises(ValueError):
         gen.remove_leading_text(self.testInst, target=17.5)