def _create_scope(authority, project): """Factory method to return vocabulary scope. """ return pyessv.create_scope( authority, project, description='ESGF publisher controlled Vocabularies (CVs) for use in {}' .format(project.upper()), label=project.upper(), url='https://esgf.llnl.gov')
def _write_scope(authority): """Writes ES-DOC cmip6 scope. """ scope = pyessv.load('esdoc:cmip6', verbose=False) or pyessv.create_scope( authority, 'cmip6', 'ES-DOC controlled Vocabularies (CVs) for use in cmip6', create_date=utils.CREATE_DATE, label='CMIP6', url='https://github.com/ES-DOC') _write_model_topic(scope) return scope
def create_scope(): """Creates & returns a test scope. """ global SCOPE if SCOPE is not None: return SCOPE SCOPE = LIB.create_scope(authority=AUTHORITY or create_authority(), name=SCOPE_NAME, description=SCOPE_DESCRIPTION, alternative_names=SCOPE_ALTERNATIVE_NAMES, url=SCOPE_URL) create_collection_01() create_collection_02() create_collection_03() return SCOPE
def _write_scope(authority): """Writes ES-DOC errata scope. """ scope = pyessv.load('esdoc:errata', verbose=False) or pyessv.create_scope( authority, 'errata', 'Controlled Vocabularies (CVs) for use in dataset errata', create_date=utils.CREATE_DATE, label='Dataset Errata', url='https://github.com/ES-DOC/esdoc-errata-ws') _write_projects(scope) _write_issue_severity(scope) _write_issue_status(scope) _write_pid_task_action(scope) _write_pid_task_status(scope) return scope
def __init__(self, pyessv_root=None): self._written = [] if pyessv_root: os.environ["PYESSV_ARCHIVE_HOME"] = pyessv_root # Not normally good to import modules anywhere except top of the file, # but pyessv loads archive directory from an environment variable when # the module is imported. This means we cannot change the archive # directory from the code unless it is imported afterwards... # # This also prevents cluttering output with pyessv's logs even when CVs # are not being generated import pyessv self._pyessv = pyessv self.create_date = datetime(year=2018, month=7, day=9, hour=13, minute=9) self.authority = pyessv.create_authority( "NCAS", "NCAS Atmospheric Measurement Facility CVs", label="NCAS", url="https://www.ncas.ac.uk/en/about-amf", create_date=self.create_date) self.scope_amf = pyessv.create_scope( self.authority, "AMF", "Controlled Vocabularies (CVs) for use in AMF", label="AMF", url="https://github.com/ncasuk/AMF_CVs", create_date=self.create_date) # Make sure to include '@' for email addresses self.term_regex = r"^[a-z0-9\-@\.]*$"
# Ensure we use fixed creation date. _CREATE_DATE = datetime.datetime.now() # CV authority. _AUTHORITY = pyessv.create_authority('eustace-team', 'UK Climate Projections', label='EUSTACE', url='https://tba.tba.com/tba', create_date=_CREATE_DATE) # CV scope. _SCOPE_eustace = pyessv.create_scope( _AUTHORITY, 'eustace', 'Controlled Vocabularies (CVs) for use in eustace', label='eustace', url='https://github.com/eustace-data/EUSTACE_CVs', create_date=_CREATE_DATE) # CV scope = GLOBAL. _SCOPE_GLOBAL = pyessv.create_scope( _AUTHORITY, 'GLOBAL', 'Global controlled Vocabularies (CVs)', url='https://github.com/eustace-data/EUSTACE_CVs', create_date=_CREATE_DATE) # Map of scopes to collections. _SCOPE_COLLECTIONS = { _SCOPE_eustace: {
# Ensure we use fixed creation date. _CREATE_DATE = datetime.datetime.now() # CV authority. _AUTHORITY = pyessv.create_authority('UKCP', 'UK Climate Projections', label='UKCP', url='https://tba.tba.com/tba', create_date=_CREATE_DATE) # CV scope. _SCOPE_UKCP18 = pyessv.create_scope( _AUTHORITY, 'UKCP18', 'Controlled Vocabularies (CVs) for use in UKCP18', label='UKCP18', url='https://github.com/ukcp-data/UKCP18_CVs', create_date=_CREATE_DATE) # CV scope = GLOBAL. _SCOPE_GLOBAL = pyessv.create_scope( _AUTHORITY, 'GLOBAL', 'Global controlled Vocabularies (CVs)', url='https://github.com/ukcp-data/UKCP18_CVs', create_date=_CREATE_DATE) # Map of scopes to collections. _SCOPE_COLLECTIONS = { _SCOPE_UKCP18: {
_INSTITUTIONAL_DATA = {i['code']: i for i in _INSTITUTIONAL_DATA} # CV authority = WCRP. _AUTHORITY = pyessv.create_authority( 'WCRP', 'World Climate Research Program', label='WCRP', url='https://www.wcrp-climate.org/wgcm-overview', create_date=_CREATE_DATE ) # CV scope = CMIP6. _SCOPE_CMIP6 = pyessv.create_scope(_AUTHORITY, 'CMIP6', 'Controlled Vocabularies (CVs) for use in CMIP6', label='CMIP6', url='https://github.com/WCRP-CMIP/CMIP6_CVs', create_date=_CREATE_DATE ) # CV scope = GLOBAL. _SCOPE_GLOBAL = pyessv.create_scope(_AUTHORITY, 'GLOBAL', 'Global controlled Vocabularies (CVs)', url='https://github.com/WCRP-CMIP/CMIP6_CVs', create_date=_CREATE_DATE ) # Map of scopes to collections. _SCOPE_COLLECTIONS = { _SCOPE_CMIP6: {
type=str) # Ensure we use fixed creation date. _CREATE_DATE = arrow.get("2017-03-21 00:00:00.000000+0000").datetime # CV authority = WCRP. _AUTHORITY = pyessv.create_authority( name="WCRP", description="World Climate Research Program", url="https://www.wcrp-climate.org/wgcm-overview", create_date=_CREATE_DATE) # CV scope = CMIP6. _SCOPE_CMIP6 = pyessv.create_scope( authority=_AUTHORITY, name="CMIP6", description="Controlled Vocabularies (CVs) for use in CMIP6", url="https://github.com/WCRP-CMIP/CMIP6_CVs", create_date=_CREATE_DATE) # CV scope = GLOBAL. _SCOPE_GLOBAL = pyessv.create_scope( authority=_AUTHORITY, name="GLOBAL", description="Global controlled Vocabularies (CVs)", url="https://github.com/WCRP-CMIP/CMIP6_CVs", create_date=_CREATE_DATE) # Map of CMIP6 collections to data factories. _COLLECTIONS_CMIP6 = { 'activity_id': None, 'experiment_id': lambda obj, name: obj[name],
_CREATE_DATE = dt.datetime.today() # CV authority = AtMoDat. _AUTHORITY = pyessv.create_authority( 'AtMoDat', 'AtMoDat', label='AtMoDat', url='https://www.atmodat.de/', create_date=_CREATE_DATE ) # CV scope = AtMoDat. _SCOPE_ATMODAT = pyessv.create_scope( _AUTHORITY, 'AtMoDat', 'Controlled Vocabularies (CVs) for use with AtMoDat', label='AtMoDat', url='https://github.com/AtMoDat/AtMoDat_CVs', create_date=_CREATE_DATE ) # Map of scopes to collections. _SCOPE_COLLECTIONS = { _SCOPE_ATMODAT: { 'realm': { 'cim_document_type': None, 'cim_document_type_alternative_name': None, 'data_factory': lambda obj, name: {'description': obj[name]}, 'is_virtual': False, 'label': None, 'ommitted': [], 'term_regex': None