Skip to main content

marinerg-schema

The MARINERG-i dataset metadata model, as a Python package.

marinerg_dataset.linkml.yaml, written in LinkML, defines the dataset fields and their controlled vocabularies. The CKAN catalogue's form and validators, and the facility client's checks, all take their fields and values from it. It's a package so that each of them uses the same version instead of a copy.

Install

pip install marinerg-schema

Use

from marinerg_schema import permitted_values, concept_uri, dataset_slots, slot, value_titles
from marinerg_schema.ckan import field_names

permitted_values("processing_level")   # frozenset({'L0', 'L1', 'L2', 'L3', 'L4'})
concept_uri("processing_level", "L1")  # 'http://vocab.nerc.ac.uk/collection/EPL/current/L1/'
value_titles("ProcessingLevelEnum")    # {'L0': 'L0 — Raw', ...}, for a form's choices
slot("device_trl")                     # its range, constraints and RDF predicate
dataset_slots()                        # the model's fields, in model order
field_names()                          # the keys a CKAN dataset takes top-level

The measured-parameter vocabulary says what a data channel measures. A facility template names each channel's parameter by its code:

from marinerg_schema import parameter, parameters

parameter("wind_speed").unit              # 'm s-1', as UDUNITS
parameter("wind_speed").cf_standard_name  # 'wind_speed'
parameter("roll").cf_standard_name        # None: no verified CF name

A CF or NERC mapping is filled only where the term was checked to exist. Lab and device quantities, such as mooring-line tension, often have none yet.

registry_path() returns the generated registry YAML for consumers that want a file rather than the API. vocab_path() returns our own vocabulary as SKOS Turtle: every term under https://vocab.marinerg-i.eu/, with its label, definition and close matches.

Consumers

Repo What it takes
ckanext-marinerg Vocabularies, titles and constraints for its form, validators and RDF export
marinerg-data Vocabularies to check a dataset before a DOI is minted, and the CKAN field list

Predecessor

This model follows on from MaRINET2's 2020 metadata schemas, at github.com/Marinet2/metadata-schema and FAIRsharing bsg-s001497. This package replaces its dataset schema. marinerg-data's run manifest replaces its datastream schema. "Marinet2 NetCDF 0.1" is still an allowed value in the conventions list.

The MaRINET2 repository still reads as current. Only its owners can add a notice there, or link this model from its FAIRsharing record.

Change the model

Edit the LinkML file, then regenerate the registry and the SKOS vocabulary. Never edit either by hand. The tests fail if they differ from the model.

uv run python -m marinerg_schema
uv run python -m marinerg_schema --check

Give every value a title, which forms show, and a meaning, its concept URI. Write NERC CURIEs with their trailing slash, such as nerc_epl:L1/, because NERC's concept URIs end in one. A value of our own also needs a description, which becomes its SKOS definition.

The package reads the model without LinkML, so it installs anywhere CKAN does. The tests run linkml-lint and check the package's reading against LinkML's own.

After a vocabulary change, cut a release, then move the pin in each consumer. The model's version is the package's.

Develop

uv sync --group dev
uv run pytest
uv run ruff check src tests
uv run mypy src

The package supports Python 3.10, because CKAN 2.11 runs on it. Ruff targets 3.10 for the same reason.

Licence

Copyright ICHEC. MIT. See LICENSE.

Metadata

Release files for marinerg-schema 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for marinerg-schema 0.4.0
File Size Uploaded
marinerg_schema-0.4.0.tar.gz 31.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for marinerg-schema 0.4.0
File Interpreter ABI Platform
marinerg_schema-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 60.6 kB

Release files / marinerg_schema-0.4.0.tar.gz

Download URL marinerg_schema-0.4.0.tar.gz
Size 31.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b7344c317fe1dcbaf81bd3902fce0aaa2f843d2bf8b21164123ff5cb762a9d00
BLAKE2b-256 checksum
How to use checksums
494bdea73555018bf87d3ec047a3f7bda762b9e5aa583f5c75983ded4e1c166b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / marinerg_schema-0.4.0-py3-none-any.whl

Download URL marinerg_schema-0.4.0-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
856636f079a89cd21b8c5b59ecf3cd0e2233396b859e0988c1e7f778202c2e6e
BLAKE2b-256 checksum
How to use checksums
3db8f9b20a001940cb2f353599e60fcb3bb5ad37d4ce9209d247c8b1a93b80cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release history Release notifications | RSS feed

0.6.0

2 release files

0.5.0

2 release files

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page