本文整理汇总了Python中ion.services.dm.utility.granule_utils.ParameterContext.uom方法的典型用法代码示例。如果您正苦于以下问题:Python ParameterContext.uom方法的具体用法?Python ParameterContext.uom怎么用?Python ParameterContext.uom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ion.services.dm.utility.granule_utils.ParameterContext
的用法示例。
在下文中一共展示了ParameterContext.uom方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_parameter
# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import uom [as 别名]
def _create_parameter(self):
pdict = ParameterDictionary()
pdict = self._add_location_time_ctxt(pdict)
pres_ctxt = ParameterContext('pressure', param_type=QuantityType(value_encoding=numpy.float32))
pres_ctxt.uom = 'Pascal'
pres_ctxt.fill_value = 0x0
pdict.add_context(pres_ctxt)
temp_ctxt = ParameterContext('temp', param_type=QuantityType(value_encoding=numpy.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=numpy.float32))
cond_ctxt.uom = 'unknown'
cond_ctxt.fill_value = 0e0
pdict.add_context(cond_ctxt)
raw_fixed_ctxt = ParameterContext('raw_fixed', param_type=QuantityType(value_encoding=numpy.float32))
raw_fixed_ctxt.uom = 'unknown'
raw_fixed_ctxt.fill_value = 0e0
pdict.add_context(raw_fixed_ctxt)
raw_blob_ctxt = ParameterContext('raw_blob', param_type=QuantityType(value_encoding=numpy.float32))
raw_blob_ctxt.uom = 'unknown'
raw_blob_ctxt.fill_value = 0e0
pdict.add_context(raw_blob_ctxt)
return pdict
示例2: _create_param_contexts
# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import uom [as 别名]
def _create_param_contexts(self):
context_ids = []
t_ctxt = ParameterContext('ingestion_timestamp', param_type=QuantityType(value_encoding=numpy.dtype('float64')))
t_ctxt.uom = 'seconds since 1900-01-01'
t_ctxt.fill_value = -9999
t_ctxt_id = self.dataset_management_client.create_parameter_context(name='ingestion_timestamp', parameter_context=t_ctxt.dump())
context_ids.append(t_ctxt_id)
raw_ctxt = ParameterContext('raw', param_type=ArrayType())
raw_ctxt.uom = ''
context_ids.append(self.dataset_management_client.create_parameter_context(name='raw', parameter_context=raw_ctxt.dump()))
return context_ids, t_ctxt_id
示例3: _add_location_time_ctxt
# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import uom [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
示例4: get_coverage_parameter
# 需要导入模块: from ion.services.dm.utility.granule_utils import ParameterContext [as 别名]
# 或者: from ion.services.dm.utility.granule_utils.ParameterContext import uom [as 别名]
def get_coverage_parameter(cls, parameter_context):
"""
Creates a Coverage Model based Parameter Context given the
ParameterContext IonObject.
Note: If the parameter is a parameter function and depends on dynamically
created calibrations, this will fail.
"""
# Only CF and netCDF compliant variable names
parameter_context.name = re.sub(r'[^a-zA-Z0-9_]', '_', parameter_context.name)
from ion.services.dm.utility.types import TypesManager
# The TypesManager does all the parsing and converting to the coverage model instances
tm = TypesManager(None, {}, {})
# First thing to do is create the parameter type
param_type = tm.get_parameter_type(
parameter_context.parameter_type,
parameter_context.value_encoding,
parameter_context.code_report,
parameter_context.parameter_function_id,
parameter_context.parameter_function_map)
# Ugh, I hate it but I did copy this section from
# ion/processes/bootstrap/ion_loader.py
context = ParameterContext(name=parameter_context.name, param_type=param_type)
# Now copy over all the attrs
context.uom = parameter_context.units
try:
if isinstance(context.uom, basestring):
tm.get_unit(context.uom)
except UdunitsError:
log.warning('Parameter %s has invalid units: %s', parameter_context.name, context.uom)
# Fill values can be a bit tricky...
context.fill_value = tm.get_fill_value(parameter_context.fill_value,
parameter_context.value_encoding,
param_type)
context.reference_urls = parameter_context.reference_urls
context.internal_name = parameter_context.name
context.display_name = parameter_context.display_name
context.standard_name = parameter_context.standard_name
context.ooi_short_name = parameter_context.ooi_short_name
context.description = parameter_context.description
context.precision = parameter_context.precision
context.visible = parameter_context.visible
return context