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()
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)
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
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()
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
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_')
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_')
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
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
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])
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)
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)