本文整理汇总了Python中coverage_model.parameter.ParameterContext.axis方法的典型用法代码示例。如果您正苦于以下问题:Python ParameterContext.axis方法的具体用法?Python ParameterContext.axis怎么用?Python ParameterContext.axis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类coverage_model.parameter.ParameterContext
的用法示例。
在下文中一共展示了ParameterContext.axis方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_parameters
# 需要导入模块: from coverage_model.parameter import ParameterContext [as 别名]
# 或者: from coverage_model.parameter.ParameterContext import axis [as 别名]
def create_parameters(cls):
'''
WARNING: This method is a wrapper intended only for tests, it should not be used in production code.
It probably will not align to most datasets.
'''
pdict = ParameterDictionary()
t_ctxt = ParameterContext('time', param_type=QuantityType(value_encoding=np.int64))
t_ctxt.axis = AxisTypeEnum.TIME
t_ctxt.uom = 'seconds since 1970-01-01'
t_ctxt.fill_value = 0x0
pdict.add_context(t_ctxt)
lat_ctxt = ParameterContext('lat', param_type=QuantityType(value_encoding=np.float32))
lat_ctxt.axis = AxisTypeEnum.LAT
lat_ctxt.uom = 'degree_north'
lat_ctxt.fill_value = 0e0
pdict.add_context(lat_ctxt)
lon_ctxt = ParameterContext('lon', param_type=QuantityType(value_encoding=np.float32))
lon_ctxt.axis = AxisTypeEnum.LON
lon_ctxt.uom = 'degree_east'
lon_ctxt.fill_value = 0e0
pdict.add_context(lon_ctxt)
temp_ctxt = ParameterContext('temp', param_type=QuantityType(value_encoding=np.float32))
temp_ctxt.uom = 'degree_Celsius'
temp_ctxt.fill_value = 0e0
pdict.add_context(temp_ctxt)
cond_ctxt = ParameterContext('conductivity', param_type=QuantityType(value_encoding=np.float32))
cond_ctxt.uom = 'unknown'
cond_ctxt.fill_value = 0e0
pdict.add_context(cond_ctxt)
data_ctxt = ParameterContext('data', param_type=QuantityType(value_encoding=np.int8))
data_ctxt.uom = 'byte'
data_ctxt.fill_value = 0x0
pdict.add_context(data_ctxt)
pres_ctxt = ParameterContext('pressure', param_type=QuantityType(value_encoding=np.float32))
pres_ctxt.uom = 'Pascal'
pres_ctxt.fill_value = 0x0
pdict.add_context(pres_ctxt)
sal_ctxt = ParameterContext('salinity', param_type=QuantityType(value_encoding=np.float32))
sal_ctxt.uom = 'PSU'
sal_ctxt.fill_value = 0x0
pdict.add_context(sal_ctxt)
dens_ctxt = ParameterContext('density', param_type=QuantityType(value_encoding=np.float32))
dens_ctxt.uom = 'unknown'
dens_ctxt.fill_value = 0x0
pdict.add_context(dens_ctxt)
return pdict
示例2: _create_parameter_dictionary
# 需要导入模块: from coverage_model.parameter import ParameterContext [as 别名]
# 或者: from coverage_model.parameter.ParameterContext import axis [as 别名]
def _create_parameter_dictionary(self):
pdict = ParameterDictionary()
lat_ctxt = ParameterContext('lat', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
lat_ctxt.axis = AxisTypeEnum.LAT
lat_ctxt.uom = 'degree_north'
pdict.add_context(lat_ctxt)
lon_ctxt = ParameterContext('lon', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
lon_ctxt.axis = AxisTypeEnum.LON
lon_ctxt.uom = 'degree_east'
pdict.add_context(lon_ctxt)
return pdict
示例3: _create_parameter_dictionary
# 需要导入模块: from coverage_model.parameter import ParameterContext [as 别名]
# 或者: from coverage_model.parameter.ParameterContext import axis [as 别名]
def _create_parameter_dictionary(self):
pdict = ParameterDictionary()
lat_ctxt = ParameterContext('lat', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
lat_ctxt.axis = AxisTypeEnum.LAT
lat_ctxt.uom = 'degree_north'
pdict.add_context(lat_ctxt)
lon_ctxt = ParameterContext('lon', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
lon_ctxt.axis = AxisTypeEnum.LON
lon_ctxt.uom = 'degree_east'
pdict.add_context(lon_ctxt)
temp_ctxt = ParameterContext('water_temperature', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
temp_ctxt.uom = 'degree_Celsius'
pdict.add_context(temp_ctxt)
temp_ctxt = ParameterContext('water_temperature_bottom', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
temp_ctxt.uom = 'degree_Celsius'
pdict.add_context(temp_ctxt)
temp_ctxt = ParameterContext('water_temperature_middle', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
temp_ctxt.uom = 'degree_Celsius'
pdict.add_context(temp_ctxt)
temp_ctxt = ParameterContext('z', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
temp_ctxt.uom = 'meters'
pdict.add_context(temp_ctxt)
cond_ctxt = ParameterContext('streamflow', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
cond_ctxt.uom = 'unknown'
pdict.add_context(cond_ctxt)
pres_ctxt = ParameterContext('specific_conductance', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
pres_ctxt.uom = 'unknown'
pdict.add_context(pres_ctxt)
pres_ctxt = ParameterContext('data_qualifier', param_type=QuantityType(value_encoding=numpy.dtype('bool')))
pres_ctxt.uom = 'unknown'
pdict.add_context(pres_ctxt)
return pdict
示例4: create
# 需要导入模块: from coverage_model.parameter import ParameterContext [as 别名]
# 或者: from coverage_model.parameter.ParameterContext import axis [as 别名]
def create(self, path):
mkdir_silent(path)
tcrs = CRS([AxisTypeEnum.TIME])
scrs = CRS([AxisTypeEnum.LON, AxisTypeEnum.LAT, AxisTypeEnum.HEIGHT])
tdom = GridDomain(GridShape('temporal', [0]), tcrs, MutabilityEnum.EXTENSIBLE)
sdom = GridDomain(GridShape('spatial', [0]), scrs, MutabilityEnum.IMMUTABLE) # Dimensionality is excluded for now
pdict = ParameterDictionary()
t_ctxt = ParameterContext('time', param_type=QuantityType(value_encoding=np.int64))
t_ctxt.axis = AxisTypeEnum.TIME
t_ctxt.uom = 'seconds since 1970-01-01'
t_ctxt.fill_value = 0x0
pdict.add_context(t_ctxt)
lat_ctxt = ParameterContext('lat', param_type=QuantityType(value_encoding=np.float32))
lat_ctxt.axis = AxisTypeEnum.LAT
lat_ctxt.uom = 'degree_north'
lat_ctxt.fill_value = 0e0
pdict.add_context(lat_ctxt)
lon_ctxt = ParameterContext('lon', param_type=QuantityType(value_encoding=np.float32))
lon_ctxt.axis = AxisTypeEnum.LON
lon_ctxt.uom = 'degree_east'
lon_ctxt.fill_value = 0e0
pdict.add_context(lon_ctxt)
dens_ctxt = ParameterContext('data_quantity', param_type=QuantityType(value_encoding=np.float32))
dens_ctxt.uom = 'unknown'
dens_ctxt.fill_value = 0x0
pdict.add_context(dens_ctxt)
serial_ctxt = ParameterContext('data_array', param_type=ArrayType())
serial_ctxt.uom = 'unknown'
serial_ctxt.fill_value = 0x0
pdict.add_context(serial_ctxt)
guid = str(uuid.uuid4()).upper()
self.path = path
self.cov = SimplexCoverage(path, guid, name='test_cov', parameter_dictionary=pdict, temporal_domain=tdom, spatial_domain=sdom)
示例5: build_context
# 需要导入模块: from coverage_model.parameter import ParameterContext [as 别名]
# 或者: from coverage_model.parameter.ParameterContext import axis [as 别名]
def build_context(self,record):
context = ParameterContext(name=record['Name'], param_type=self.param_type(record['Parameter Type']))
context.uom = record['Unit of Measure']
if record['Fill Value']:
context.fill_value = self.fill_value(record['Fill Value'], record['Parameter Type'])
if record['Axis']:
context.axis = self.ref_frame(record['Axis'])
for key in self.additional_attrs.iterkeys():
if key in record and record[key]:
setattr(context,self.additional_attrs[key],record[key])
return context
示例6: _add_location_time_ctxt
# 需要导入模块: from coverage_model.parameter import ParameterContext [as 别名]
# 或者: from coverage_model.parameter.ParameterContext import axis [as 别名]
def _add_location_time_ctxt(self, pdict):
t_ctxt = ParameterContext('time', param_type=QuantityType(value_encoding=numpy.int64))
t_ctxt.axis = AxisTypeEnum.TIME
t_ctxt.uom = 'seconds since 1970-01-01'
t_ctxt.fill_value = 0x0
pdict.add_context(t_ctxt)
lat_ctxt = ParameterContext('lat', param_type=QuantityType(value_encoding=numpy.float32))
lat_ctxt.axis = AxisTypeEnum.LAT
lat_ctxt.uom = 'degree_north'
lat_ctxt.fill_value = 0e0
pdict.add_context(lat_ctxt)
lon_ctxt = ParameterContext('lon', param_type=QuantityType(value_encoding=numpy.float32))
lon_ctxt.axis = AxisTypeEnum.LON
lon_ctxt.uom = 'degree_east'
lon_ctxt.fill_value = 0e0
pdict.add_context(lon_ctxt)
return pdict
示例7: _setup_resources
# 需要导入模块: from coverage_model.parameter import ParameterContext [as 别名]
# 或者: from coverage_model.parameter.ParameterContext import axis [as 别名]
def _setup_resources(self):
pdict = ParameterDictionary()
t_ctxt = ParameterContext('data', param_type=QuantityType(value_encoding=numpy.dtype('int64')))
t_ctxt.axis = AxisTypeEnum.TIME
t_ctxt.uom = 'seconds since 01-01-1970'
pdict.add_context(t_ctxt)
stream_id, stream_route, stream_def = self.create_stream_and_logger(name='fibonacci_stream', pdict=pdict)
# tx = TaxyTool()
# tx.add_taxonomy_set('data', 'external_data')
self.DVR_CONFIG['dh_cfg'] = {
'TESTING': True,
'stream_id': stream_id,
'stream_route': stream_route,
'stream_def': stream_def,
'data_producer_id': 'fibonacci_data_producer_id',
'max_records': 4,
}
示例8: _setup_resources
# 需要导入模块: from coverage_model.parameter import ParameterContext [as 别名]
# 或者: from coverage_model.parameter.ParameterContext import axis [as 别名]
#.........这里部分代码省略.........
# Create DataSource
dsrc = DataSource(protocol_type='FILE', institution=Institution(), contact=ContactInformation())
dsrc.connection_params['base_data_url'] = ''
dsrc.contact.name='Tim Giguere'
dsrc.contact.email = '[email protected]'
# Create ExternalDataset
ds_name = 'ruv_test_dataset'
dset = ExternalDataset(name=ds_name, dataset_description=DatasetDescription(), update_description=UpdateDescription(), contact=ContactInformation())
dset.dataset_description.parameters['base_url'] = 'test_data/ruv/'
dset.dataset_description.parameters['list_pattern'] = 'RDLi_SEAB_2011_08_24_1600.ruv'
dset.dataset_description.parameters['date_pattern'] = '%Y %m %d %H %M'
dset.dataset_description.parameters['date_extraction_pattern'] = 'RDLi_SEAB_([\d]{4})_([\d]{2})_([\d]{2})_([\d]{2})([\d]{2}).ruv'
dset.dataset_description.parameters['temporal_dimension'] = None
dset.dataset_description.parameters['zonal_dimension'] = None
dset.dataset_description.parameters['meridional_dimension'] = None
dset.dataset_description.parameters['vertical_dimension'] = None
dset.dataset_description.parameters['variables'] = [
]
# Create DataSourceModel
dsrc_model = DataSourceModel(name='ruv_model')
dsrc_model.model = 'RUV'
dsrc_model.data_handler_module = 'N/A'
dsrc_model.data_handler_class = 'N/A'
## Run everything through DAMS
ds_id = dams_cli.create_external_dataset(external_dataset=dset)
ext_dprov_id = dams_cli.create_external_data_provider(external_data_provider=dprov)
ext_dsrc_id = dams_cli.create_data_source(data_source=dsrc)
ext_dsrc_model_id = dams_cli.create_data_source_model(dsrc_model)
# Register the ExternalDataset
dproducer_id = dams_cli.register_external_data_set(external_dataset_id=ds_id)
# Or using each method
dams_cli.assign_data_source_to_external_data_provider(data_source_id=ext_dsrc_id, external_data_provider_id=ext_dprov_id)
dams_cli.assign_data_source_to_data_model(data_source_id=ext_dsrc_id, data_source_model_id=ext_dsrc_model_id)
dams_cli.assign_external_dataset_to_data_source(external_dataset_id=ds_id, data_source_id=ext_dsrc_id)
dams_cli.assign_external_dataset_to_agent_instance(external_dataset_id=ds_id, agent_instance_id=eda_inst_id)
# dams_cli.assign_external_data_agent_to_agent_instance(external_data_agent_id=self.eda_id, agent_instance_id=self.eda_inst_id)
#create temp streamdef so the data product can create the stream
craft = CoverageCraft
sdom, tdom = craft.create_domains()
sdom = sdom.dump()
tdom = tdom.dump()
parameter_dictionary = craft.create_parameters()
parameter_dictionary = parameter_dictionary.dump()
dprod = IonObject(RT.DataProduct,
name='ruv_parsed_product',
description='parsed ruv product',
temporal_domain = tdom,
spatial_domain = sdom)
streamdef_id = pubsub_cli.create_stream_definition(name="temp", description="temp")
# Generate the data product and associate it to the ExternalDataset
dproduct_id = dpms_cli.create_data_product(data_product=dprod,
stream_definition_id=streamdef_id,
parameter_dictionary=parameter_dictionary)
dams_cli.assign_data_product(input_resource_id=ds_id, data_product_id=dproduct_id)
stream_id, assn = rr_cli.find_objects(subject=dproduct_id, predicate=PRED.hasStream, object_type=RT.Stream, id_only=True)
stream_id = stream_id[0]
log.info('Created resources: {0}'.format({'ExternalDataset':ds_id, 'ExternalDataProvider':ext_dprov_id, 'DataSource':ext_dsrc_id, 'DataSourceModel':ext_dsrc_model_id, 'DataProducer':dproducer_id, 'DataProduct':dproduct_id, 'Stream':stream_id}))
#CBM: Use CF standard_names
#ttool = TaxyTool()
#
#ttool.add_taxonomy_set('data','test data')
pdict = ParameterDictionary()
t_ctxt = ParameterContext('data', param_type=QuantityType(value_encoding=numpy.dtype('int64')))
t_ctxt.axis = AxisTypeEnum.TIME
t_ctxt.uom = 'seconds since 01-01-1970'
pdict.add_context(t_ctxt)
#CBM: Eventually, probably want to group this crap somehow - not sure how yet...
# Create the logger for receiving publications
self.create_stream_and_logger(name='ruv',stream_id=stream_id)
self.EDA_RESOURCE_ID = ds_id
self.EDA_NAME = ds_name
self.DVR_CONFIG['dh_cfg'] = {
'TESTING':True,
'stream_id':stream_id,
'external_dataset_res':dset,
'param_dictionary':pdict.dump(),
'data_producer_id':dproducer_id,#CBM: Should this be put in the main body of the config - with mod & cls?
'max_records':20,
}
示例9: _setup_resources
# 需要导入模块: from coverage_model.parameter import ParameterContext [as 别名]
# 或者: from coverage_model.parameter.ParameterContext import axis [as 别名]
#.........这里部分代码省略.........
craft = CoverageCraft
sdom, tdom = craft.create_domains()
sdom = sdom.dump()
tdom = tdom.dump()
parameter_dictionary = craft.create_parameters()
parameter_dictionary = parameter_dictionary.dump()
dprod = IonObject(RT.DataProduct,
name='usgs_parsed_product',
description='parsed usgs product',
temporal_domain = tdom,
spatial_domain = sdom)
# Generate the data product and associate it to the ExternalDataset
dproduct_id = dpms_cli.create_data_product(data_product=dprod,
stream_definition_id=streamdef_id,
parameter_dictionary=parameter_dictionary)
dams_cli.assign_data_product(input_resource_id=ds_id, data_product_id=dproduct_id)
stream_id, assn = rr_cli.find_objects(subject=dproduct_id, predicate=PRED.hasStream, object_type=RT.Stream, id_only=True)
stream_id = stream_id[0]
log.info('Created resources: {0}'.format({'ExternalDataset':ds_id, 'ExternalDataProvider':ext_dprov_id, 'DataSource':ext_dsrc_id, 'DataSourceModel':ext_dsrc_model_id, 'DataProducer':dproducer_id, 'DataProduct':dproduct_id, 'Stream':stream_id}))
#CBM: Use CF standard_names
# ttool = TaxyTool()
# ttool.add_taxonomy_set('time','time')
# ttool.add_taxonomy_set('lon','longitude')
# ttool.add_taxonomy_set('lat','latitude')
# ttool.add_taxonomy_set('z','water depth')
# ttool.add_taxonomy_set('water_temperature', 'average water temperature')
# ttool.add_taxonomy_set('water_temperature_bottom','water temperature at bottom of water column')
# ttool.add_taxonomy_set('water_temperature_middle', 'water temperature at middle of water column')
# ttool.add_taxonomy_set('streamflow', 'flow velocity of stream')
# ttool.add_taxonomy_set('specific_conductance', 'specific conductance of water')
# ttool.add_taxonomy_set('data_qualifier','data qualifier flag')
#
# ttool.add_taxonomy_set('coords','This group contains coordinate parameters')
# ttool.add_taxonomy_set('data','This group contains data parameters')
# Create the logger for receiving publications
self.create_stream_and_logger(name='usgs',stream_id=stream_id)
pdict = ParameterDictionary()
t_ctxt = ParameterContext('time', param_type=QuantityType(value_encoding=numpy.dtype('int64')))
t_ctxt.axis = AxisTypeEnum.TIME
t_ctxt.uom = 'seconds since 01-01-1970'
pdict.add_context(t_ctxt)
lat_ctxt = ParameterContext('lat', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
lat_ctxt.axis = AxisTypeEnum.LAT
lat_ctxt.uom = 'degree_north'
pdict.add_context(lat_ctxt)
lon_ctxt = ParameterContext('lon', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
lon_ctxt.axis = AxisTypeEnum.LON
lon_ctxt.uom = 'degree_east'
pdict.add_context(lon_ctxt)
temp_ctxt = ParameterContext('water_temperature', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
temp_ctxt.uom = 'degree_Celsius'
pdict.add_context(temp_ctxt)
temp_ctxt = ParameterContext('water_temperature_bottom', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
temp_ctxt.uom = 'degree_Celsius'
pdict.add_context(temp_ctxt)
temp_ctxt = ParameterContext('water_temperature_middle', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
temp_ctxt.uom = 'degree_Celsius'
pdict.add_context(temp_ctxt)
temp_ctxt = ParameterContext('z', param_type=QuantityType(value_encoding = numpy.dtype('float32')))
temp_ctxt.uom = 'meters'
pdict.add_context(temp_ctxt)
cond_ctxt = ParameterContext('streamflow', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
cond_ctxt.uom = 'unknown'
pdict.add_context(cond_ctxt)
pres_ctxt = ParameterContext('specific_conductance', param_type=QuantityType(value_encoding=numpy.dtype('float32')))
pres_ctxt.uom = 'unknown'
pdict.add_context(pres_ctxt)
pres_ctxt = ParameterContext('data_qualifier', param_type=QuantityType(value_encoding=numpy.dtype('bool')))
pres_ctxt.uom = 'unknown'
pdict.add_context(pres_ctxt)
self.EDA_RESOURCE_ID = ds_id
self.EDA_NAME = ds_name
self.DVR_CONFIG['dh_cfg'] = {
'TESTING':True,
'stream_id':stream_id,
#'taxonomy':ttool.dump(),
'param_dictionary':pdict.dump(),
'data_producer_id':dproducer_id,#CBM: Should this be put in the main body of the config - with mod & cls?
'max_records':1,
}
示例10: _make_coverage
# 需要导入模块: from coverage_model.parameter import ParameterContext [as 别名]
# 或者: from coverage_model.parameter.ParameterContext import axis [as 别名]
def _make_coverage(path):
tcrs = CRS([AxisTypeEnum.TIME])
scrs = CRS([AxisTypeEnum.LON, AxisTypeEnum.LAT, AxisTypeEnum.HEIGHT])
tdom = GridDomain(GridShape('temporal', [0]), tcrs, MutabilityEnum.EXTENSIBLE)
sdom = GridDomain(GridShape('spatial', [0]), scrs, MutabilityEnum.IMMUTABLE) # Dimensionality is excluded for now
pdict = ParameterDictionary()
t_ctxt = ParameterContext('time', param_type=QuantityType(value_encoding=np.int64))
t_ctxt.axis = AxisTypeEnum.TIME
t_ctxt.uom = 'seconds since 1970-01-01'
t_ctxt.fill_value = 0x0
pdict.add_context(t_ctxt)
lat_ctxt = ParameterContext('lat', param_type=QuantityType(value_encoding=np.float32))
lat_ctxt.axis = AxisTypeEnum.LAT
lat_ctxt.uom = 'degree_north'
lat_ctxt.fill_value = 0e0
pdict.add_context(lat_ctxt)
lon_ctxt = ParameterContext('lon', param_type=QuantityType(value_encoding=np.float32))
lon_ctxt.axis = AxisTypeEnum.LON
lon_ctxt.uom = 'degree_east'
lon_ctxt.fill_value = 0e0
pdict.add_context(lon_ctxt)
cat = {0:'lemon',1:'apple',2:'banana',99:'None'}
cat_ctxt = ParameterContext('category', param_type=CategoryType(categories=cat))
cat_ctxt.long_name = "example of category"
pdict.add_context(cat_ctxt)
dens_ctxt = ParameterContext('quantity', param_type=QuantityType(value_encoding=np.float32))
dens_ctxt.uom = 'unknown'
dens_ctxt.fill_value = 0x0
pdict.add_context(dens_ctxt)
const_ctxt = ParameterContext('constant', param_type=ConstantType())
const_ctxt.long_name = 'example of a parameter of type ConstantType'
pdict.add_context(const_ctxt)
rec_ctxt = ParameterContext('boolean', param_type=BooleanType())
rec_ctxt.long_name = 'example of a parameter of type BooleanType'
pdict.add_context(rec_ctxt)
rec_ctxt = ParameterContext('range', param_type=ConstantRangeType())
rec_ctxt.long_name = 'Range example'
rec_ctxt.fill_value = 0x0
pdict.add_context(rec_ctxt)
rec_ctxt = ParameterContext('record', param_type=RecordType())
rec_ctxt.long_name = 'example of a parameter of type RecordType, will be filled with dictionaries'
rec_ctxt.fill_value = 0x0
pdict.add_context(rec_ctxt)
serial_ctxt = ParameterContext('array', param_type=ArrayType())
serial_ctxt.uom = 'unknown'
serial_ctxt.fill_value = 0x0
pdict.add_context(serial_ctxt)
guid = create_guid()
guid = guid.replace("-", "")
cov = SimplexCoverage(path, guid, name="sample_cov", parameter_dictionary=pdict, temporal_domain=tdom, spatial_domain=sdom)
return (cov,path+os.sep+guid)
示例11: build_contexts
# 需要导入模块: from coverage_model.parameter import ParameterContext [as 别名]
# 或者: from coverage_model.parameter.ParameterContext import axis [as 别名]
def build_contexts():
'''
Builds the relevant parameter context objects
'''
contexts = []
cond_ctxt = ParameterContext('conductivity', param_type=QuantityType(value_encoding=np.float32))
cond_ctxt.uom = 'unknown'
cond_ctxt.fill_value = 0e0
contexts.append(cond_ctxt)
pres_ctxt = ParameterContext('pressure', param_type=QuantityType(value_encoding=np.float32))
pres_ctxt.uom = 'Pascal'
pres_ctxt.fill_value = 0x0
contexts.append(pres_ctxt)
sal_ctxt = ParameterContext('salinity', param_type=QuantityType(value_encoding=np.float32))
sal_ctxt.uom = 'PSU'
sal_ctxt.fill_value = 0x0
contexts.append(sal_ctxt)
den_ctxt = ParameterContext('density', param_type=QuantityType(value_encoding=np.float32))
den_ctxt.uom = 'kg/m3'
den_ctxt.fill_value = 0x0
contexts.append(den_ctxt)
temp_ctxt = ParameterContext('temp', param_type=QuantityType(value_encoding=np.float32))
temp_ctxt.uom = 'degree_Celsius'
temp_ctxt.fill_value = 0e0
contexts.append(temp_ctxt)
t_ctxt = ParameterContext('time', param_type=QuantityType(value_encoding=np.int64))
t_ctxt.uom = 'seconds since 1970-01-01'
t_ctxt.fill_value = 0x0
contexts.append(t_ctxt)
lat_ctxt = ParameterContext('lat', param_type=QuantityType(value_encoding=np.float32))
lat_ctxt.axis = AxisTypeEnum.LAT
lat_ctxt.uom = 'degree_north'
lat_ctxt.fill_value = 0e0
contexts.append(lat_ctxt)
lon_ctxt = ParameterContext('lon', param_type=QuantityType(value_encoding=np.float32))
lon_ctxt.axis = AxisTypeEnum.LON
lon_ctxt.uom = 'degree_east'
lon_ctxt.fill_value = 0e0
contexts.append(lon_ctxt)
raw_ctxt = ParameterContext('raw', param_type=ArrayType())
raw_ctxt.description = 'raw binary string values'
raw_ctxt.uom = 'utf-8 byte string'
raw_ctxt.fill_value = 0x0
contexts.append(raw_ctxt)
port_ts_ctxt = ParameterContext(name='port_timestamp', param_type=QuantityType(value_encoding=np.float64))
port_ts_ctxt._derived_from_name = 'time'
port_ts_ctxt.uom = 'seconds'
port_ts_ctxt.fill_value = -1
contexts.append(port_ts_ctxt)
driver_ts_ctxt = ParameterContext(name='driver_timestamp', param_type=QuantityType(value_encoding=np.float64))
driver_ts_ctxt._derived_from_name = 'time'
driver_ts_ctxt.uom = 'seconds'
driver_ts_ctxt.fill_value = -1
contexts.append(driver_ts_ctxt)
internal_ts_ctxt = ParameterContext(name='internal_timestamp', param_type=QuantityType(value_encoding=np.float64))
internal_ts_ctxt._derived_from_name = 'time'
internal_ts_ctxt.uom = 'seconds'
internal_ts_ctxt.fill_value = -1
contexts.append(internal_ts_ctxt)
timer_num_ctxt = ParameterContext(name='timer', param_type=QuantityType(value_encoding=np.float64))
timer_num_ctxt.fill_value = -1
contexts.append(timer_num_ctxt)
serial_num_ctxt = ParameterContext(name='serial_num', param_type=QuantityType(value_encoding=np.int32))
serial_num_ctxt.fill_value = -1
contexts.append(serial_num_ctxt)
count_ctxt = ParameterContext(name='counts', param_type=QuantityType(value_encoding=np.uint64))
count_ctxt.fill_value = -1
contexts.append(count_ctxt)
checksum_ctxt = ParameterContext(name='checksum', param_type=QuantityType(value_encoding=np.int32))
checksum_ctxt.fill_value = -1
contexts.append(checksum_ctxt)
pref_ts_ctxt = ParameterContext(name='preferred_timestamp', param_type=QuantityType(value_encoding=np.uint64))
pref_ts_ctxt.description = 'name of preferred timestamp'
pref_ts_ctxt.fill_value = 0x0
contexts.append(pref_ts_ctxt)
# TODO: This should probably be of type CategoryType when implemented
qual_flag_ctxt = ParameterContext(name='quality_flag', param_type=ArrayType())
qual_flag_ctxt.description = 'flag indicating quality'
qual_flag_ctxt.fill_value = None
contexts.append(qual_flag_ctxt)
#.........这里部分代码省略.........