本文整理汇总了Python中coverage_model.parameter.ParameterContext类的典型用法代码示例。如果您正苦于以下问题:Python ParameterContext类的具体用法?Python ParameterContext怎么用?Python ParameterContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ParameterContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build_param_contexts
def build_param_contexts(self):
context_ids = []
t_ctxt = ParameterContext("time", param_type=QuantityType(value_encoding=np.dtype("int64")))
t_ctxt.uom = "seconds since 01-01-1970"
context_ids.append(
self.dataset_management.create_parameter_context(name="time", parameter_context=t_ctxt.dump())
)
cnd_ctxt = ParameterContext("conductivity", param_type=ArrayType())
cnd_ctxt.uom = "mmho/cm"
context_ids.append(
self.dataset_management.create_parameter_context(name="conductivity", parameter_context=cnd_ctxt.dump())
)
temp_ctxt = ParameterContext("temperature", param_type=ArrayType())
temp_ctxt.uom = "degC"
context_ids.append(
self.dataset_management.create_parameter_context(name="temperature", parameter_context=temp_ctxt.dump())
)
press_ctxt = ParameterContext("pressure", param_type=ArrayType())
press_ctxt.uom = "decibars"
context_ids.append(
self.dataset_management.create_parameter_context(name="pressure", parameter_context=press_ctxt.dump())
)
oxy_ctxt = ParameterContext("oxygen", param_type=ArrayType())
oxy_ctxt.uom = "Hz"
context_ids.append(
self.dataset_management.create_parameter_context(name="oxygen", parameter_context=oxy_ctxt.dump())
)
return context_ids
示例2: test_replay_with_parameters
def test_replay_with_parameters(self):
# --------------------------------------------------------------------------------
# Create the configurations and the dataset
# --------------------------------------------------------------------------------
# Get a precompiled parameter dictionary with basic ctd fields
pdict_id = self.dataset_management.read_parameter_dictionary_by_name("ctd_parsed_param_dict", id_only=True)
context_ids = self.dataset_management.read_parameter_contexts(pdict_id, id_only=True)
# Add a field that supports binary data input.
bin_context = ParameterContext("binary", param_type=ArrayType())
context_ids.append(self.dataset_management.create_parameter_context("binary", bin_context.dump()))
# Add another field that supports dictionary elements.
rec_context = ParameterContext("records", param_type=RecordType())
context_ids.append(self.dataset_management.create_parameter_context("records", rec_context.dump()))
pdict_id = self.dataset_management.create_parameter_dictionary(
"replay_pdict", parameter_context_ids=context_ids, temporal_context="time"
)
stream_def_id = self.pubsub_management.create_stream_definition(
"replay_stream", parameter_dictionary_id=pdict_id
)
stream_id, route = self.pubsub_management.create_stream(
"replay_with_params", exchange_point=self.exchange_point_name, stream_definition_id=stream_def_id
)
config_id = self.get_ingestion_config()
dataset_id = self.create_dataset(pdict_id)
self.ingestion_management.persist_data_stream(
stream_id=stream_id, ingestion_configuration_id=config_id, dataset_id=dataset_id
)
# --------------------------------------------------------------------------------
# Coerce the datastore into existence (beats race condition)
# --------------------------------------------------------------------------------
self.get_datastore(dataset_id)
self.launch_producer(stream_id)
self.wait_until_we_have_enough_granules(dataset_id, 40)
query = {
"start_time": 0 - 2208988800,
"end_time": 20 - 2208988800,
"stride_time": 2,
"parameters": ["time", "temp"],
}
retrieved_data = self.data_retriever.retrieve(dataset_id=dataset_id, query=query)
rdt = RecordDictionaryTool.load_from_granule(retrieved_data)
comp = np.arange(0, 20, 2) == rdt["time"]
self.assertTrue(comp.all(), "%s" % rdt.pretty_print())
self.assertEquals(set(rdt.iterkeys()), set(["time", "temp"]))
extents = self.dataset_management.dataset_extents(dataset_id=dataset_id, parameters=["time", "temp"])
self.assertTrue(extents["time"] >= 20)
self.assertTrue(extents["temp"] >= 20)
self.streams.append(stream_id)
self.stop_ingestion(stream_id)
示例3: test_replay_with_parameters
def test_replay_with_parameters(self):
#--------------------------------------------------------------------------------
# Create the configurations and the dataset
#--------------------------------------------------------------------------------
# Get a precompiled parameter dictionary with basic ctd fields
pdict_id = self.dataset_management.read_parameter_dictionary_by_name('ctd_parsed_param_dict',id_only=True)
context_ids = self.dataset_management.read_parameter_contexts(pdict_id, id_only=True)
# Add a field that supports binary data input.
bin_context = ParameterContext('binary', param_type=ArrayType())
context_ids.append(self.dataset_management.create_parameter_context('binary', bin_context.dump()))
# Add another field that supports dictionary elements.
rec_context = ParameterContext('records', param_type=RecordType())
context_ids.append(self.dataset_management.create_parameter_context('records', rec_context.dump()))
pdict_id = self.dataset_management.create_parameter_dictionary('replay_pdict', parameter_context_ids=context_ids, temporal_context='time')
stream_def_id = self.pubsub_management.create_stream_definition('replay_stream', parameter_dictionary_id=pdict_id)
stream_id, route = self.pubsub_management.create_stream('replay_with_params', exchange_point=self.exchange_point_name, stream_definition_id=stream_def_id)
config_id = self.get_ingestion_config()
dataset_id = self.create_dataset(pdict_id)
self.ingestion_management.persist_data_stream(stream_id=stream_id, ingestion_configuration_id=config_id, dataset_id=dataset_id)
dataset_modified = Event()
def cb(*args, **kwargs):
dataset_modified.set()
es = EventSubscriber(event_type=OT.DatasetModified, callback=cb, origin=dataset_id)
es.start()
self.addCleanup(es.stop)
self.publish_fake_data(stream_id, route)
self.assertTrue(dataset_modified.wait(30))
query = {
'start_time': 0 - 2208988800,
'end_time': 20 - 2208988800,
'stride_time' : 2,
'parameters': ['time','temp']
}
retrieved_data = self.data_retriever.retrieve(dataset_id=dataset_id,query=query)
rdt = RecordDictionaryTool.load_from_granule(retrieved_data)
comp = np.arange(0,20,2) == rdt['time']
self.assertTrue(comp.all(),'%s' % rdt.pretty_print())
self.assertEquals(set(rdt.iterkeys()), set(['time','temp']))
extents = self.dataset_management.dataset_extents(dataset_id=dataset_id, parameters=['time','temp'])
self.assertTrue(extents['time']>=20)
self.assertTrue(extents['temp']>=20)
self.streams.append(stream_id)
self.stop_ingestion(stream_id)
示例4: build_context
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
示例5: get_param_dict
def get_param_dict(param_dict_name = None):
raise NotImplementedError('This method has been replaced by DatasetManagementService, please use read_parameter_dictionary_by_name instead')
# read the file just once, not every time needed
global _PARAMETER_DICTIONARIES
global _PARAMETER_CONTEXTS
if not _PARAMETER_DICTIONARIES:
param_dict_defs_file = "res/config/param_dict_defs.yml"
with open(param_dict_defs_file, "r") as f_dict:
dict_string = f_dict.read()
_PARAMETER_DICTIONARIES = yaml.load(dict_string)
param_context_defs_file = "res/config/param_context_defs.yml"
with open(param_context_defs_file, "r") as f_ctxt:
ctxt_string = f_ctxt.read()
_PARAMETER_CONTEXTS = yaml.load(ctxt_string)
# make sure we have the one requested
context_names = _PARAMETER_DICTIONARIES[param_dict_name]
for name in context_names:
if not _PARAMETER_CONTEXTS.has_key(name):
raise AssertionError('The parameter dict has a context that does not exist in the parameter context defs specified in yml: %s' % name)
# package and ship
pdict = ParameterDictionary()
for ctxt_name in context_names:
param_context = ParameterContext.load(_PARAMETER_CONTEXTS[ctxt_name])
pdict.add_context(param_context)
return pdict
示例6: _setup_resources
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,
}
示例7: build_param_contexts
def build_param_contexts(self):
context_ids = []
t_ctxt = ParameterContext('time', param_type=QuantityType(value_encoding=np.dtype('int64')))
t_ctxt.uom = 'seconds since 01-01-1970'
context_ids.append(self.dataset_management.create_parameter_context(name='time', parameter_context=t_ctxt.dump()))
cnd_ctxt = ParameterContext('conductivity', param_type=ArrayType())
cnd_ctxt.uom = 'mmho/cm'
context_ids.append(self.dataset_management.create_parameter_context(name='conductivity', parameter_context=cnd_ctxt.dump()))
temp_ctxt = ParameterContext('temperature', param_type=ArrayType())
temp_ctxt.uom = 'degC'
context_ids.append(self.dataset_management.create_parameter_context(name='temperature', parameter_context=temp_ctxt.dump()))
press_ctxt = ParameterContext('pressure', param_type=ArrayType())
press_ctxt.uom = 'decibars'
context_ids.append(self.dataset_management.create_parameter_context(name='pressure', parameter_context=press_ctxt.dump()))
oxy_ctxt = ParameterContext('oxygen', param_type=ArrayType())
oxy_ctxt.uom = 'Hz'
context_ids.append(self.dataset_management.create_parameter_context(name='oxygen', parameter_context=oxy_ctxt.dump()))
return context_ids
示例8: _create_parameter
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)
return pdict
示例9: _create_parameter_dictionary
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
示例10: load
def load():
from coverage_model.parameter import ParameterContext
from coverage_model.parameter_types import QuantityType, ArrayType, RecordType
from coverage_model.basic_types import AxisTypeEnum
import numpy as np
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.reference_frame = 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.reference_frame = 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'
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=ArrayType())
pref_ts_ctxt.description = 'name of preferred timestamp'
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'
contexts.append(qual_flag_ctxt)
viz_ts_ctxt = ParameterContext(name='viz_timestamp', param_type=QuantityType(value_encoding=np.float64))
viz_ts_ctxt._derived_from_name = 'time'
viz_ts_ctxt.uom = 'seconds'
#.........这里部分代码省略.........
示例11: get_context
def get_context(self, ptype, encoding, fill_value, codeset=None):
ptype = self.types_manager.get_parameter_type(ptype, encoding, codeset)
context = ParameterContext(name='test', param_type=ptype)
context.fill_value = self.types_manager.get_fill_value(fill_value, encoding, ptype)
return context
示例12: create_contexts
def create_contexts(self):
context_ids = []
cond_ctxt = ParameterContext('conductivity_test', param_type=QuantityType(value_encoding=np.float32))
cond_ctxt.uom = 'unknown'
cond_ctxt.fill_value = 0e0
context_ids.append(self.dataset_management.create_parameter_context(name='conductivity_test', parameter_context=cond_ctxt.dump()))
pres_ctxt = ParameterContext('pressure_test', param_type=QuantityType(value_encoding=np.float32))
pres_ctxt.uom = 'Pascal'
pres_ctxt.fill_value = 0x0
context_ids.append(self.dataset_management.create_parameter_context(name='pressure_test', parameter_context=pres_ctxt.dump()))
sal_ctxt = ParameterContext('salinity_test', param_type=QuantityType(value_encoding=np.float32))
sal_ctxt.uom = 'PSU'
sal_ctxt.fill_value = 0x0
context_ids.append(self.dataset_management.create_parameter_context(name='salinity_test', parameter_context=sal_ctxt.dump()))
temp_ctxt = ParameterContext('temp_test', param_type=QuantityType(value_encoding=np.float32))
temp_ctxt.uom = 'degree_Celsius'
temp_ctxt.fill_value = 0e0
context_ids.append(self.dataset_management.create_parameter_context(name='temp_test', parameter_context=temp_ctxt.dump()))
t_ctxt = ParameterContext('time_test', param_type=QuantityType(value_encoding=np.int64))
t_ctxt.uom = 'seconds since 1970-01-01'
t_ctxt.fill_value = 0x0
context_ids.append(self.dataset_management.create_parameter_context(name='time_test', parameter_context=t_ctxt.dump()))
return context_ids
示例13: test_replay_pause
def test_replay_pause(self):
# Get a precompiled parameter dictionary with basic ctd fields
pdict_id = self.dataset_management.read_parameter_dictionary_by_name('ctd_parsed_param_dict',id_only=True)
context_ids = self.dataset_management.read_parameter_contexts(pdict_id, id_only=True)
# Add a field that supports binary data input.
bin_context = ParameterContext('binary', param_type=ArrayType())
context_ids.append(self.dataset_management.create_parameter_context('binary', bin_context.dump()))
# Add another field that supports dictionary elements.
rec_context = ParameterContext('records', param_type=RecordType())
context_ids.append(self.dataset_management.create_parameter_context('records', rec_context.dump()))
pdict_id = self.dataset_management.create_parameter_dictionary('replay_pdict', parameter_context_ids=context_ids, temporal_context='time')
stream_def_id = self.pubsub_management.create_stream_definition('replay_stream', parameter_dictionary_id=pdict_id)
replay_stream, replay_route = self.pubsub_management.create_stream('replay', 'xp1', stream_definition_id=stream_def_id)
dataset_id = self.create_dataset(pdict_id)
scov = DatasetManagementService._get_simplex_coverage(dataset_id)
bb = CoverageCraft(scov)
bb.rdt['time'] = np.arange(100)
bb.rdt['temp'] = np.random.random(100) + 30
bb.sync_with_granule()
DatasetManagementService._persist_coverage(dataset_id, bb.coverage) # This invalidates it for multi-host configurations
# Set up the subscriber to verify the data
subscriber = StandaloneStreamSubscriber(self.exchange_space_name, self.validate_granule_subscription)
xp = self.container.ex_manager.create_xp('xp1')
self.queue_buffer.append(self.exchange_space_name)
subscriber.start()
subscriber.xn.bind(replay_route.routing_key, xp)
# Set up the replay agent and the client wrapper
# 1) Define the Replay (dataset and stream to publish on)
self.replay_id, process_id = self.data_retriever.define_replay(dataset_id=dataset_id, stream_id=replay_stream)
# 2) Make a client to the interact with the process (optionall provide it a process to bind with)
replay_client = ReplayClient(process_id)
# 3) Start the agent (launch the process)
self.data_retriever.start_replay_agent(self.replay_id)
# 4) Start replaying...
replay_client.start_replay()
# Wait till we get some granules
self.assertTrue(self.event.wait(5))
# We got granules, pause the replay, clear the queue and allow the process to finish consuming
replay_client.pause_replay()
gevent.sleep(1)
subscriber.xn.purge()
self.event.clear()
# Make sure there's no remaining messages being consumed
self.assertFalse(self.event.wait(1))
# Resume the replay and wait until we start getting granules again
replay_client.resume_replay()
self.assertTrue(self.event.wait(5))
# Stop the replay, clear the queues
replay_client.stop_replay()
gevent.sleep(1)
subscriber.xn.purge()
self.event.clear()
# Make sure that it did indeed stop
self.assertFalse(self.event.wait(1))
subscriber.stop()
示例14: defining_parameter_dictionary
def defining_parameter_dictionary(self):
# Define the parameter context objects
t_ctxt = ParameterContext('time', param_type=QuantityType(value_encoding=np.int64))
t_ctxt.reference_frame = AxisTypeEnum.TIME
t_ctxt.uom = 'seconds since 1970-01-01'
t_ctxt.fill_value = 0x0
lat_ctxt = ParameterContext('lat', param_type=QuantityType(value_encoding=np.float32))
lat_ctxt.reference_frame = AxisTypeEnum.LAT
lat_ctxt.uom = 'degree_north'
lat_ctxt.fill_value = 0e0
lon_ctxt = ParameterContext('lon', param_type=QuantityType(value_encoding=np.float32))
lon_ctxt.reference_frame = AxisTypeEnum.LON
lon_ctxt.uom = 'degree_east'
lon_ctxt.fill_value = 0e0
height_ctxt = ParameterContext('height', param_type=QuantityType(value_encoding=np.float32))
height_ctxt.reference_frame = AxisTypeEnum.HEIGHT
height_ctxt.uom = 'meters'
height_ctxt.fill_value = 0e0
pres_ctxt = ParameterContext('pres', param_type=QuantityType(value_encoding=np.float32))
pres_ctxt.uom = 'degree_Celsius'
pres_ctxt.fill_value = 0e0
temp_ctxt = ParameterContext('temp', param_type=QuantityType(value_encoding=np.float32))
temp_ctxt.uom = 'degree_Celsius'
temp_ctxt.fill_value = 0e0
cond_ctxt = ParameterContext('cond', param_type=QuantityType(value_encoding=np.float32))
cond_ctxt.uom = 'unknown'
cond_ctxt.fill_value = 0e0
data_ctxt = ParameterContext('data', param_type=QuantityType(value_encoding=np.int8))
data_ctxt.uom = 'byte'
data_ctxt.fill_value = 0x0
# Define the parameter dictionary objects
self.pres = ParameterDictionary()
self.pres.add_context(t_ctxt)
self.pres.add_context(lat_ctxt)
self.pres.add_context(lon_ctxt)
self.pres.add_context(height_ctxt)
self.pres.add_context(pres_ctxt)
self.pres.add_context(data_ctxt)
self.temp = ParameterDictionary()
self.temp.add_context(t_ctxt)
self.temp.add_context(lat_ctxt)
self.temp.add_context(lon_ctxt)
self.temp.add_context(height_ctxt)
self.temp.add_context(temp_ctxt)
self.temp.add_context(data_ctxt)
self.cond = ParameterDictionary()
self.cond.add_context(t_ctxt)
self.cond.add_context(lat_ctxt)
self.cond.add_context(lon_ctxt)
self.cond.add_context(height_ctxt)
self.cond.add_context(cond_ctxt)
self.cond.add_context(data_ctxt)
示例15: _make_coverage
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)