Example #1
0
def write_authority():
    """Writes ES-DOC authority.

    """
    return pyessv.load('esdoc', verbose=False) or pyessv.create_authority(
        'esdoc',
        'Earth System Documentation',
        label='ES-DOC',
        url='https://es-doc.org',
        create_date=CREATE_DATE)
Example #2
0
def _create_authority_ecmwf():
    """Writes ECMWF authority.

    """
    return pyessv.load('ecmwf', verbose=False) or pyessv.create_authority(
        'ECMWF',
        'European Center for Medium-Range Weather Forecasts',
        label='ECMWF',
        url='https://www.ecmwf.int',
        create_date=_CREATE_DATE)
Example #3
0
def create_authority():
    """Creates & returns a test authority.

    """
    global AUTHORITY

    if AUTHORITY is not None:
        return AUTHORITY

    AUTHORITY = LIB.create_authority(
        name=AUTHORITY_NAME,
        description=AUTHORITY_DESCRIPTION,
        alternative_names=AUTHORITY_ALTERNATIVE_NAMES,
        url=AUTHORITY_URL)
    create_scope()

    return AUTHORITY
Example #4
0
    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\-@\.]*$"
Example #5
0
_ARGS = argparse.ArgumentParser(
    'Maps raw vocab files to normalized pyessv CV format.')
_ARGS.add_argument('--source',
                   help='Path from which raw vocab files will be read.',
                   dest='source',
                   type=str)

COLLECTION_NAME_TMPL = "EUSTACE CV collection: "

# 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,
_ARGS = argparse.ArgumentParser(
    'Maps raw vocab files to normalized pyessv CV format.')
_ARGS.add_argument('--source',
                   help='Path from which raw vocab files will be read.',
                   dest='source',
                   type=str)

COLLECTION_NAME_TMPL = "UKCP UKCP18 CV collection: "

# 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,
Example #7
0
    type=str
    )

# Ensure we use fixed creation date.
_CREATE_DATE = arrow.get('2017-06-21 00:00:00.000000+0000').datetime

# CMIP6 insititutional data.
with open(os.path.join(os.path.dirname(__file__), 'institution_id.json')) as fstream:
    _INSTITUTIONAL_DATA = json.loads(fstream.read())
    _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,
# Define command line options.
_ARGS = argparse.ArgumentParser(
    "Maps raw WCRP CMIP6 vocab files to normalized pyessv CV format.")
_ARGS.add_argument(
    "--source",
    help="Path from which raw WCRP CMIP6 vocab files will be read.",
    dest="source",
    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",
_ARGS = argparse.ArgumentParser('Maps raw AtMoDat vocab files to normalized pyessv CV format.')
_ARGS.add_argument(
    '--source',
    help='Path from which raw AtMoDat vocab files will be read.',
    dest='source',
    type=str
    )

# Ensure we use fixed creation date.
_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.