def populate_from_qrev_mat(self, transect): """Populates the object using data from previously saved QRev Matlab file. Parameters ---------- transect: mat_struct Matlab data structure obtained from sio.loadmat """ self.serial_num = str(transect.adcp.serialNum) self.manufacturer = transect.adcp.manufacturer self.model = transect.adcp.model self.firmware = transect.adcp.firmware self.frequency_khz = transect.adcp.frequency_hz self.beam_angle_deg = transect.adcp.beamAngle_deg self.beam_pattern = transect.adcp.beamPattern self.t_matrix = TransformationMatrix() self.t_matrix.populate_from_qrev_mat(transect.adcp.tMatrix) if len(transect.adcp.configurationCommands) > 0: self.configuration_commands = [] for command in transect.adcp.configurationCommands: if type(command) == str: self.configuration_commands.append(command) self.configuration_commands = np.array(self.configuration_commands) else: self.configuration_commands = None
def sontek(self, rs): """Populates the variables with data from SonTek ADCPs. Parameters ---------- rs: MatSonTek """ self.serial_num = rs.System.SerialNumber self.frequency_khz = rs.Transformation_Matrices.Frequency if self.frequency_khz[2] > 0: self.model = 'M9' else: self.model = 'S5' if hasattr(rs, 'SystemHW'): revision = str(rs.SystemHW.FirmwareRevision) if len(revision) < 2: revision = '0' + revision self.firmware = str(rs.SystemHW.FirmwareVersion) + '.' + revision else: self.firmware = '' self.beam_angle_deg = 25 self.beam_pattern = 'Convex' self.t_matrix = TransformationMatrix() self.t_matrix.populate_data('SonTek', data_in=rs.Transformation_Matrices.Matrix) self.configuration_commands = None
def nortek(self, rs): self.serial_num = rs.System.SerialNumber self.frequency_khz = rs.Transformation_Matrices.Frequency self.model = rs.System.InstrumentModel if hasattr(rs, 'SystemHW'): revision = str(rs.SystemHW.FirmwareRevision) if len(revision) < 2: revision = '0' + revision self.firmware = str(rs.SystemHW.FirmwareVersion) + '.' + revision else: self.firmware = '' self.beam_angle_deg = 25 self.beam_pattern = 'Convex' self.t_matrix = TransformationMatrix() self.t_matrix.populate_data('SonTek', data_in=rs.Transformation_Matrices.Matrix) self.configuration_commands = None
def trdi(self, pd0, mmt_transect, mmt): """Populates the variables with data from TRDI ADCPs. Parameters ---------- pd0: Pd0TRDI Object of Pd0TRDI mmt_transect: MMT_Transect Object of MMT_Transect mmt: MMT_Transect Object of MMT_Transect """ # Instrument frequency self.frequency_khz = pd0.Inst.freq[0] # Firmware self.firmware = pd0.Inst.firm_ver[0] # Instrument beam angle and pattern self.beam_angle_deg = pd0.Inst.beam_ang[0] self.beam_pattern = pd0.Inst.pat[0] # Instrument characteristics mmt_site = getattr(mmt, 'site_info') mmt_config = getattr(mmt_transect, 'active_config') self.serial_num = mmt_site['ADCPSerialNmb'] # Determine TRDI model num = float(self.firmware) model_switch = np.floor(num) if model_switch == 10: self.model = 'Rio Grande' if 'Fixed_Commands' in mmt_config.keys(): self.configuration_commands = np.array(['Fixed'], dtype=object) self.configuration_commands = np.append(self.configuration_commands, mmt_config['Fixed_Commands']) elif model_switch == 31: self.model = 'StreamPro' self.frequency_khz = 2000 if 'Fixed_Commands_StreamPro' in mmt_config.keys(): self.configuration_commands = np.array(['Fixed'], dtype=object) self.configuration_commands = np.append(self.configuration_commands, mmt_config['Fixed_Commands_StreamPro']) elif model_switch == 44: self.model = 'RiverRay' if 'Fixed_Commands_RiverRay' in mmt_config.keys(): self.configuration_commands = np.array(['Fixed'], dtype=object) self.configuration_commands = np.append(self.configuration_commands, mmt_config['Fixed_Commands_RiverRay']) elif model_switch == 56: self.model = 'RiverPro' if pd0.Cfg.n_beams[0] < 5: if 'RG_Test' in mmt.qaqc.keys(): idx = mmt.qaqc['RG_Test'][0].find('RioPro') if idx != -1: self.model = 'RioPro' if 'Fixed_Commands_RiverPro' in mmt_config.keys(): self.configuration_commands = np.array(['Fixed'], dtype=object) self.configuration_commands = np.append(self.configuration_commands, mmt_config['Fixed_Commands_RiverPro']) else: self.configuration_commands = np.array(['Fixed'], dtype=object) self.configuration_commands = np.append(self.configuration_commands, ' ') else: self.model = 'Unknown' if 'Fixed_Commands' in mmt_config.keys(): self.configuration_commands = np.array(['Fixed'], dtype=object) self.configuration_commands = np.append(self.configuration_commands, mmt_config['Fixed_Commands']) if 'Wizard_Commands' in mmt_config.keys(): self.configuration_commands = np.append(self.configuration_commands, ['Wizard']) self.configuration_commands = np.append(self.configuration_commands, mmt_config['Wizard_Commands']) if 'User_Commands' in mmt_config.keys(): self.configuration_commands = np.append(self.configuration_commands, ['User']) self.configuration_commands = np.append(self.configuration_commands, mmt_config['User_Commands']) # Obtain transformation matrix from one of the available sources if not np.isnan(pd0.Inst.t_matrix[0, 0]): self.t_matrix = TransformationMatrix() self.t_matrix.populate_data(manufacturer='TRDI', model='pd0', data_in=pd0) elif self.model == 'RiverRay': self.t_matrix = TransformationMatrix() self.t_matrix.populate_data(manufacturer='TRDI', model=self.model, data_in='Nominal') else: if isinstance(mmt.qaqc, dict) and len(mmt.qaqc) > 0: if 'RG_Test' in mmt.qaqc.keys(): self.t_matrix = TransformationMatrix() self.t_matrix.populate_data(manufacturer='TRDI', model=self.model, data_in=mmt.qaqc['RG_Test'][0]) elif 'Compass_Calibration' in mmt.qaqc.keys(): self.t_matrix = TransformationMatrix() self.t_matrix.populate_data(manufacturer='TRDI', model=self.model, data_in=mmt.qaqc['Compass_Calibration'][0]) elif 'Compass_Eval_Timestamp' in mmt.qaqc.keys(): self.t_matrix = TransformationMatrix() self.t_matrix.populate_data(manufacturer='TRDI', model=self.model, data_in=mmt.qaqc['Compass_Evaluation'][0]) else: self.t_matrix = TransformationMatrix() self.t_matrix.populate_data(manufacturer='TRDI', model=self.model, data_in='Nominal') else: self.t_matrix = TransformationMatrix() self.t_matrix.populate_data(manufacturer='TRDI', model=self.model, data_in='Nominal')
def rowe(self, rtb, mmt_transect, mmt): """Populates the variables with data from TRDI ADCPs. Parameters ---------- rtb: RtbRowe Object of RtbRowe. Raw ensemble data mmt_transect: RTT_Transect Object of RTT_Transect. Transect data in project mmt: rttRowe Object of RTT_Rowe. Project file """ # Instrument frequency self.frequency_khz = rtb.Inst.freq[0] # Firmware self.firmware = rtb.Inst.firm_ver[0] # Instrument beam angle and pattern self.beam_angle_deg = rtb.Inst.beam_ang[0] self.beam_pattern = rtb.Inst.pat[0] # Instrument characteristics mmt_site = getattr(mmt, 'site_info') mmt_config = getattr(mmt_transect, 'active_config') self.serial_num = mmt_site['ADCPSerialNmb'] # Determine Rowe model firmware = float(self.firmware) if firmware > 1.0: self.model = 'RiverSurveyor' if 'Fixed_Commands' in mmt_config.keys(): self.configuration_commands = np.array(['Fixed'], dtype=object) self.configuration_commands = np.append(self.configuration_commands, mmt_config['Fixed_Commands']) else: self.model = 'Unknown' if 'Fixed_Commands' in mmt_config.keys(): self.configuration_commands = np.array(['Fixed'], dtype=object) self.configuration_commands = np.append(self.configuration_commands, mmt_config['Fixed_Commands']) if 'Wizard_Commands' in mmt_config.keys(): self.configuration_commands = np.append(self.configuration_commands, ['Wizard']) self.configuration_commands = np.append(self.configuration_commands, mmt_config['Wizard_Commands']) if 'User_Commands' in mmt_config.keys(): self.configuration_commands = np.append(self.configuration_commands, ['User']) self.configuration_commands = np.append(self.configuration_commands, mmt_config['User_Commands']) # Obtain transformation matrix from one of the available sources if not np.isnan(rtb.Inst.t_matrix[0, 0]): self.t_matrix = TransformationMatrix() self.t_matrix.populate_data(manufacturer='Rowe', model='pd0', data_in=rtb) else: if isinstance(mmt.qaqc, dict) and len(mmt.qaqc) > 0: if 'RG_Test' in mmt.qaqc.keys(): self.t_matrix = TransformationMatrix() self.t_matrix.populate_data(manufacturer='Rowe', model=self.model, data_in=mmt.qaqc['RG_Test'][0]) elif 'Compass_Calibration' in mmt.qaqc.keys(): self.t_matrix = TransformationMatrix() self.t_matrix.populate_data(manufacturer='Rowe', model=self.model, data_in=mmt.qaqc['Compass_Calibration'][0]) elif 'Compass_Eval_Timestamp' in mmt.qaqc.keys(): self.t_matrix = TransformationMatrix() self.t_matrix.populate_data(manufacturer='Rowe', model=self.model, data_in=mmt.qaqc['Compass_Evaluation'][0]) else: self.t_matrix = TransformationMatrix() self.t_matrix.populate_data(manufacturer='Rowe', model=self.model, data_in='Nominal') else: self.t_matrix = TransformationMatrix() self.t_matrix.populate_data(manufacturer='Rowe', model=self.model, data_in='Nominal')