def _build_parsed_values(self): # the timestamp comes from the DCL logger timestamp, parse the string into a datetime utc_time = dcl_controller_timestamp_to_utc_time(self.raw_data.group(DCL_TIMESTAMP_GROUP)) self.set_internal_timestamp(unix_time=utc_time) return [self._encode_value(name, self.raw_data.group(idx), function) for name, idx, function in PARTICLE_MAP]
def _build_parsed_values(self): parsed_values = [] # initialize an empty list log.debug('ADCPT ACFGM BPV self._dcl_data_dict = %s', self._dcl_data_dict) dcl_controller_timestamp = \ self._dcl_data_dict[AdcptAcfgmPd0DclKey.DCL_CONTROLLER_TIMESTAMP] dcl_controller_start_timestamp = \ self._dcl_data_dict[AdcptAcfgmPd0DclKey.DCL_CONTROLLER_STARTING_TIMESTAMP] parsed_values.append(self._encode_value(AdcptAcfgmPd0DclKey.DCL_CONTROLLER_TIMESTAMP, dcl_controller_timestamp, str)) parsed_values.append(self._encode_value(AdcptAcfgmPd0DclKey.DCL_CONTROLLER_STARTING_TIMESTAMP, dcl_controller_start_timestamp, str)) # use the build_parsed values of the super class to parse all the pd0 data pd0_values = super(AdcptAcfgmPd0DclParticle, self)._build_parsed_values() # append the pd0 data to the dcl data parsed_values.extend(pd0_values) # Note: internal timestamp has to be saved after calling the super class # build_parsed_values to over-write what it has saved utc_time = utilities.dcl_controller_timestamp_to_utc_time(dcl_controller_timestamp) self.set_internal_timestamp(unix_time=utc_time) return parsed_values
def _build_parsed_values(self): # the timestamp comes from the DCL logger timestamp, parse the string into a datetime utc_time = dcl_controller_timestamp_to_utc_time( self.raw_data.group(DCL_TIMESTAMP_GROUP)) self.set_internal_timestamp(unix_time=utc_time) return [ self._encode_value(name, self.raw_data.group(idx), function) for name, idx, function in PARTICLE_MAP ]
def _build_parsed_values(self): """ Set the timestamp and encode the common particles from the raw data using COMMON_PARTICLE_MAP """ # the timestamp comes from the DCL logger timestamp, parse the string into a datetime utc_time = dcl_controller_timestamp_to_utc_time(self.raw_data.group(DCL_TIMESTAMP_GROUP)) self.set_internal_timestamp(unix_time=utc_time) return [self._encode_value(name, self.raw_data.group(group), function) for name, group, function in COMMON_PARTICLE_MAP]
def _build_parsed_values(self): """ Set the timestamp and encode the common particles from the raw data using COMMON_PARTICLE_MAP """ # the timestamp comes from the DCL logger timestamp, parse the string into a datetime utc_time = dcl_controller_timestamp_to_utc_time( self.raw_data.group(DCL_TIMESTAMP_GROUP)) self.set_internal_timestamp(unix_time=utc_time) return [ self._encode_value(name, self.raw_data.group(group), function) for name, group, function in COMMON_PARTICLE_MAP ]
def _extract_metadata_unix_timestamp(self, idle_match): """ This function will create a timestamp to be used as the internal timestamp for the metadata particle is generated. """ # calculate the metadata particle internal timestamp # from the DCL timestamp. utc_time = dcl_controller_timestamp_to_utc_time( idle_match.group(MetaDataMatchGroups.META_GROUP_DCL_TIMESTAMP)) return utc_time
def _build_parsed_values(self): """ Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample creation """ # The particle timestamp is the DCL Controller timestamp. utc_time = dcl_controller_timestamp_to_utc_time(self.raw_data.group('rte_time')) self.set_internal_timestamp(unix_time=utc_time) return [self._encode_value(name, self.raw_data.group(name), function) for name, function in DATA_PARTICLE_MAP]
def _extract_metadata_unix_timestamp(self, idle_match): """ This function will create a timestamp to be used as the internal timestamp for the metadata particle is generated. """ # calculate the metadata particle internal timestamp # from the DCL timestamp. utc_time = dcl_controller_timestamp_to_utc_time(idle_match.group( MetaDataMatchGroups.META_GROUP_DCL_TIMESTAMP)) return utc_time
def _create_particles(self, pd0, ts): utc_time = utilities.dcl_controller_timestamp_to_utc_time(ts) utc_time = ntplib.system_to_ntp_time(utc_time) velocity = adcp_pd0.VelocityEarth(pd0, port_timestamp=utc_time, preferred_timestamp=DataParticleKey.PORT_TIMESTAMP) self._record_buffer.append(velocity) config = adcp_pd0.AdcpsConfig(pd0, port_timestamp=utc_time, preferred_timestamp=DataParticleKey.PORT_TIMESTAMP) engineering = adcp_pd0.AdcpsEngineering(pd0, port_timestamp=utc_time, preferred_timestamp=DataParticleKey.PORT_TIMESTAMP) for particle in [config, engineering]: if self._changed(particle): self._record_buffer.append(particle)
def _create_particles(self, pd0, ts): utc_time = utilities.dcl_controller_timestamp_to_utc_time(ts) utc_time = ntplib.system_to_ntp_time(utc_time) velocity = adcp_pd0.VelocityEarth(pd0, port_timestamp=utc_time, preferred_timestamp=DataParticleKey.PORT_TIMESTAMP) self._record_buffer.append(velocity) config = adcp_pd0.AdcpsConfig(pd0, port_timestamp=utc_time, preferred_timestamp=DataParticleKey.PORT_TIMESTAMP) engineering = adcp_pd0.AdcpsEngineering(pd0, port_timestamp=utc_time, preferred_timestamp=DataParticleKey.PORT_TIMESTAMP) for particle in [config, engineering]: if self._changed(particle): self._record_buffer.append(particle)
def __init__(self, raw_data, port_timestamp=None, internal_timestamp=None, preferred_timestamp=DataParticleKey.PORT_TIMESTAMP, quality_flag=DataParticleValue.OK, new_sequence=None): super(CtdbpCdefDclDataParticle, self).__init__(raw_data, port_timestamp, internal_timestamp, preferred_timestamp, quality_flag, new_sequence) # The particle timestamp is the DCL Controller timestamp. utc_time = dcl_controller_timestamp_to_utc_time( self.raw_data.group('dcl_controller_timestamp')) self.set_internal_timestamp(unix_time=utc_time)
def _build_parsed_values(self): """ Take something in the data format and turn it into a particle with the appropriate tag. @throws SampleException If there is a problem with sample creation """ # The particle timestamp is the DCL Controller timestamp. utc_time = dcl_controller_timestamp_to_utc_time( self.raw_data.group('rte_time')) self.set_internal_timestamp(unix_time=utc_time) return [ self._encode_value(name, self.raw_data.group(name), function) for name, function in DATA_PARTICLE_MAP ]
def __init__(self, raw_data, port_timestamp=None, internal_timestamp=None, preferred_timestamp=DataParticleKey.PORT_TIMESTAMP, quality_flag=DataParticleValue.OK, new_sequence=None): super(DostaAbcdjmCtdbpDclDataParticle, self).__init__(raw_data, port_timestamp, internal_timestamp, preferred_timestamp, quality_flag, new_sequence) # The particle timestamp is the DCL Controller timestamp. utc_time = dcl_controller_timestamp_to_utc_time(self.raw_data.group('dcl_controller_timestamp')) self.set_internal_timestamp(unix_time=utc_time)
def __init__(self, raw_data, port_timestamp=None, internal_timestamp=None, preferred_timestamp=DataParticleKey.PORT_TIMESTAMP, quality_flag=DataParticleValue.OK, new_sequence=None): super(CtdbpCdefDclCpParserDataParticle, self).__init__(raw_data, port_timestamp, internal_timestamp, preferred_timestamp, quality_flag, new_sequence) # The particle timestamp is the DCL Controller timestamp. # The individual fields have already been extracted by the parser. # This works for both the uncorrected and the corrected files utc_time = dcl_controller_timestamp_to_utc_time(raw_data.group(1)) self.set_internal_timestamp(unix_time=utc_time)
def __init__(self, raw_data, port_timestamp=None, internal_timestamp=None, preferred_timestamp=DataParticleKey.PORT_TIMESTAMP, quality_flag=DataParticleValue.OK, new_sequence=None): super(CtdbpCdefDclCeParserDataParticle, self).__init__(raw_data, port_timestamp, internal_timestamp, preferred_timestamp, quality_flag, new_sequence) # The particle timestamp is the DCL Controller timestamp. # The individual fields have already been extracted by the parser. # This works for both the uncorrected and the corrected files utc_time = dcl_controller_timestamp_to_utc_time(self.raw_data.group(1)) self.set_internal_timestamp(unix_time=utc_time)
def __init__(self, raw_data, port_timestamp=None, internal_timestamp=None, preferred_timestamp=DataParticleKey.PORT_TIMESTAMP, quality_flag=DataParticleValue.OK, new_sequence=None): super(PresfAbcDclParserTideDataParticle, self).__init__(raw_data, port_timestamp, internal_timestamp, preferred_timestamp, quality_flag, new_sequence) # The particle timestamp is the DCL Controller timestamp. # The individual fields have already been extracted by the parser. utc_time = utilities.dcl_controller_timestamp_to_utc_time( self.raw_data.group(1)) self.set_internal_timestamp(unix_time=utc_time)
def __init__(self, raw_data, port_timestamp=None, internal_timestamp=None, preferred_timestamp=DataParticleKey.PORT_TIMESTAMP, quality_flag=DataParticleValue.OK, new_sequence=None): super(PresfAbcDclParserTideDataParticle, self).__init__(raw_data, port_timestamp, internal_timestamp, preferred_timestamp, quality_flag, new_sequence) # The particle timestamp is the DCL Controller timestamp. # The individual fields have already been extracted by the parser. utc_time = utilities.dcl_controller_timestamp_to_utc_time(self.raw_data.group(1)) self.set_internal_timestamp(unix_time=utc_time)
def _build_parsed_values(self): parsed_values = [] # initialize an empty list log.debug('ADCPT ACFGM BPV self._dcl_data_dict = %s', self._dcl_data_dict) dcl_controller_timestamp = \ self._dcl_data_dict[AdcptAcfgmPd0DclKey.DCL_CONTROLLER_TIMESTAMP] dcl_controller_start_timestamp = \ self._dcl_data_dict[AdcptAcfgmPd0DclKey.DCL_CONTROLLER_STARTING_TIMESTAMP] parsed_values.append( self._encode_value(AdcptAcfgmPd0DclKey.DCL_CONTROLLER_TIMESTAMP, dcl_controller_timestamp, str)) parsed_values.append( self._encode_value( AdcptAcfgmPd0DclKey.DCL_CONTROLLER_STARTING_TIMESTAMP, dcl_controller_start_timestamp, str)) # use the build_parsed values of the super class to parse all the pd0 data pd0_values = super(AdcptAcfgmPd0DclParticle, self)._build_parsed_values() # append the pd0 data to the dcl data parsed_values.extend(pd0_values) # Note: internal timestamp has to be saved after calling the super class # build_parsed_values to over-write what it has saved utc_time = utilities.dcl_controller_timestamp_to_utc_time( dcl_controller_timestamp) self.set_internal_timestamp(unix_time=utc_time) return parsed_values