def create_simple_qc(self): contexts = {} types_manager = TypesManager(self.dataset_management,None,None) t_ctxt = ParameterContext('time', param_type=QuantityType(value_encoding=np.dtype('float64'))) t_ctxt.uom = 'seconds since 1900-01-01' t_ctxt_id = self.dataset_management.create_parameter_context(name='time', parameter_context=t_ctxt.dump()) self.addCleanup(self.dataset_management.delete_parameter_context, t_ctxt_id) contexts['time'] = (t_ctxt, t_ctxt_id) temp_ctxt = ParameterContext('temp', param_type=QuantityType(value_encoding=np.dtype('float32')), fill_value=fill_value) temp_ctxt.uom = 'deg_C' temp_ctxt.ooi_short_name = 'TEMPWAT' temp_ctxt.qc_contexts = types_manager.make_qc_functions('temp','TEMPWAT',lambda *args, **kwargs : None) temp_ctxt_id = self.dataset_management.create_parameter_context(name='temp', parameter_context=temp_ctxt.dump(), ooi_short_name='TEMPWAT') self.addCleanup(self.dataset_management.delete_parameter_context, temp_ctxt_id) contexts['temp'] = temp_ctxt, temp_ctxt_id press_ctxt = ParameterContext('pressure', param_type=QuantityType(value_encoding=np.dtype('float32')), fill_value=fill_value) press_ctxt.uom = 'dbar' press_ctxt.ooi_short_name = 'PRESWAT' press_ctxt.qc_contexts = types_manager.make_qc_functions('pressure', 'PRESWAT', lambda *args, **kwargs : None) press_ctxt_id = self.dataset_management.create_parameter_context(name='pressure', parameter_context=press_ctxt.dump(), ooi_short_name='PRESWAT') self.addCleanup(self.dataset_management.delete_parameter_context, press_ctxt_id) contexts['pressure'] = press_ctxt, press_ctxt_id lat_ctxt = ParameterContext('lat', param_type=SparseConstantType(base_type=ConstantType(value_encoding='float64'), fill_value=fill_value), fill_value=fill_value) lat_ctxt.uom = 'degree_north' lat_ctxt_id = self.dataset_management.create_parameter_context(name='lat', parameter_context=lat_ctxt.dump()) contexts['lat'] = lat_ctxt, lat_ctxt_id lon_ctxt = ParameterContext('lon', param_type=SparseConstantType(base_type=ConstantType(value_encoding='float64'), fill_value=fill_value), fill_value=fill_value) lon_ctxt.uom = 'degree_east' lon_ctxt_id = self.dataset_management.create_parameter_context(name='lon', parameter_context=lon_ctxt.dump()) contexts['lon'] = lon_ctxt, lon_ctxt_id return contexts
def create_simple_qc(self): contexts = {} types_manager = TypesManager(self.dataset_management,None,None) t_ctxt = ParameterContext('time', param_type=QuantityType(value_encoding=np.dtype('float64'))) t_ctxt.uom = 'seconds since 1900-01-01' t_ctxt_id = self.dataset_management.create_parameter_context(name='time', parameter_context=t_ctxt.dump()) self.addCleanup(self.dataset_management.delete_parameter_context, t_ctxt_id) contexts['time'] = (t_ctxt, t_ctxt_id) temp_ctxt = ParameterContext('temp', param_type=QuantityType(value_encoding=np.dtype('float32')), fill_value=-9999) temp_ctxt.uom = 'deg_C' temp_ctxt.ooi_short_name = 'TEMPWAT' temp_ctxt.qc_contexts = types_manager.make_qc_functions('temp','TEMPWAT',lambda *args, **kwargs : None) temp_ctxt_id = self.dataset_management.create_parameter_context(name='temp', parameter_context=temp_ctxt.dump(), ooi_short_name='TEMPWAT') self.addCleanup(self.dataset_management.delete_parameter_context, temp_ctxt_id) contexts['temp'] = temp_ctxt, temp_ctxt_id return contexts