def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.extinction_coeff_per_bin = timeseries.TimeSeries_2D(self.extinction_coeff_per_bin) self.extinction_coeff_per_bin._data_period = self.parent_sizedist._data_period self.angular_scatt_func = timeseries.TimeSeries_2D(self.angular_scatt_func.transpose()) self.angular_scatt_func._data_period = self.parent_sizedist._data_period self.__hemispheric_forwardscattering = None self.__hemispheric_backscattering = None self.__hemispheric_backscattering_ratio = None self.__hemispheric_forwardscattering_ratio = None
def _parse_netCDF(self): super(ArmDatasetSub, self)._parse_netCDF() mass_concentrations = _pd.DataFrame(index=self.time_stamps) mass_conc_keys = [ 'total_organics', 'ammonium', 'sulfate', 'nitrate', 'chloride' ] for k in mass_conc_keys: mass_concentrations[k] = _pd.Series(self._read_variable( k, reverse_qc_flag=4), index=self.time_stamps) mass_concentrations.columns.name = 'Mass conc. ug/m^3' mass_concentrations.index.name = 'Time' org_mx = self._read_variable('org_mx') org_mx = _pd.DataFrame(org_mx, index=self.time_stamps) org_mx.columns = self._read_variable('amus') org_mx.columns.name = 'amus (m/z)' self.mass_concentrations = _AMS.AMS_Timeseries_lev01( mass_concentrations) self.mass_concentrations.data[ 'total'] = self.mass_concentrations.data.sum(axis=1) self.mass_concentrations.data.rename( columns={'total_organics': 'organic_aerosol'}, inplace=True) self.mass_concentrations._data_period = self._data_period self.organic_mass_spectral_matrix = _timeseries.TimeSeries_2D(org_mx) self.organic_mass_spectral_matrix._data_period = self._data_period return
def _concat(self, arm_data_objs, close_gaps=True): for att in self._concatable: first_object = getattr(arm_data_objs[0], att) which_type = type(first_object).__name__ data_period = first_object._data_period if which_type == 'TimeSeries_2D': value = _timeseries.TimeSeries_2D( _pd.concat([getattr(i, att).data for i in arm_data_objs])) elif which_type == 'TimeSeries': value = _timeseries.TimeSeries( _pd.concat([getattr(i, att).data for i in arm_data_objs])) elif which_type == 'AMS_Timeseries_lev01': value = _AMS.AMS_Timeseries_lev01( _pd.concat([getattr(i, att).data for i in arm_data_objs])) elif which_type == 'SizeDist_TS': # value = _AMS.AMS_Timeseries_lev01(pd.concat([getattr(i, att).data for i in arm_data_objs])) data = _pd.concat( [getattr(i, att).data for i in arm_data_objs]) value = _sizedistribution.SizeDist_TS( data, getattr(arm_data_objs[0], att).bins, 'dNdlogDp') elif which_type == 'TimeSeries_3D': value = _timeseries.TimeSeries_3D( _pd.concat([getattr(i, att).data for i in arm_data_objs])) else: raise TypeError( '%s is not an allowed type here (TimeSeries_2D, TimeSeries)' % which_type) value._data_period = data_period if close_gaps: setattr(self, att, value.close_gaps()) else: setattr(self, att, value)
def kappa_values(self): if not self.__kappa_values: # RH = kappa_values = hg.kappa_simple(self.mean_growth_factor.data.values[:,:,0],self.RH_interDMA.data.values, inverse = True) kappa_values = pd.DataFrame(kappa_values,columns=self.mean_growth_factor.data.major_axis, index = self.mean_growth_factor.data.items) self.__kappa_values = timeseries.TimeSeries_2D(kappa_values) # self.plottable.append('kappa_values') self.__kappa_values._data_period = self._data_period return self.__kappa_values
def _concat(self, arm_data_objs, close_gaps=True): for att in self._concatable: first_object = getattr(arm_data_objs[0], att) which_type = type(first_object).__name__ data_period = first_object._data_period if which_type == 'TimeSeries_2D': value = _timeseries.TimeSeries_2D( _pd.concat([getattr(i, att).data for i in arm_data_objs])) elif which_type == 'TimeSeries': value = _timeseries.TimeSeries( _pd.concat([getattr(i, att).data for i in arm_data_objs])) elif which_type == 'AMS_Timeseries_lev01': value = _AMS.AMS_Timeseries_lev01( _pd.concat([getattr(i, att).data for i in arm_data_objs])) elif which_type == 'SizeDist_TS': # value = _AMS.AMS_Timeseries_lev01(pd.concat([getattr(i, att).data for i in arm_data_objs])) data = _pd.concat( [getattr(i, att).data for i in arm_data_objs]) value = _sizedistribution.SizeDist_TS( data, getattr(arm_data_objs[0], att).bins, 'dNdlogDp', ignore_data_gap_error=True, ) elif which_type == 'TimeSeries_3D': value = _timeseries.TimeSeries_3D( _pd.concat([getattr(i, att).data for i in arm_data_objs])) else: raise TypeError( '%s is not an allowed type here (TimeSeries_2D, TimeSeries)' % which_type) if hasattr(first_object, 'availability'): try: avail_concat = _pd.concat([ getattr(i, att).availability.availability for i in arm_data_objs ]) avail = Data_Quality(None, avail_concat, None, first_object.flag_info) value.availability = avail except: _warnings.warn( 'availability could not be concatinated make sure you converted it to a pandas frame at some point!' ) value._data_period = data_period if close_gaps: setattr(self, att, value.close_gaps()) else: setattr(self, att, value)
def signal2noise_ratio(self, value, **kwargs): if type(value).__name__ == 'TimeSeries_2D': self._signal2noise_ratio = value else: self._signal2noise_ratio = _timeseries.TimeSeries_2D( value, **kwargs)