pywcmp
WMO Core Metadata Profile Test Suite
pywcmp provides validation and quality assessment capabilities for the WMO WIS Core Metadata Profile (WCMP).
- validation against WCMP2, specifically Annex A: Conformance Class Abstract Test Suite), implementing an executable test suite against the ATS
- quality assessement against the WCMP Key Performance Indicators
Installation
pip
Install latest stable version from PyPI.
pip3 install pywcmp
From source
Install latest development version.
python3 -m venv pywcmp
cd pywcmp
. bin/activate
git clone https://github.com/World-Meteorological-Organization/pywcmp.git
cd pywcmp
pip3 install .
Running
From command line:
# fetch version
pywcmp --version
# sync supporting configuration bundle (schemas, topics, etc.)
pywcmp bundle sync
# abstract test suite
# validate WCMP2 metadata against abstract test suite (file on disk)
pywcmp ets validate /path/to/file.json
# validate WCMP2 metadata against abstract test suite (URL)
pywcmp ets validate https://example.org/path/to/file.json
# validate WCMP2 metadata against abstract test suite (URL), but turn JSON Schema validation off
pywcmp ets validate https://example.org/path/to/file.json --no-fail-on-schema-validation
# adjust debugging messages (CRITICAL, ERROR, WARNING, INFO, DEBUG) to stdout
pywcmp ets validate https://example.org/path/to/file.json --verbosity DEBUG
# write results to logfile
pywcmp ets validate https://example.org/path/to/file.json --verbosity DEBUG --logfile /tmp/foo.txt
# key performance indicators
# all key performance indicators at once
pywcmp kpi validate https://example.org/path/to/file.json --verbosity DEBUG
# all key performance indicators at once, but turn ETS validation off
pywcmp kpi validate https://example.org/path/to/file.json --no-fail-on-ets --verbosity DEBUG
# all key performance indicators at once, in summary
pywcmp kpi validate https://example.org/path/to/file.json --verbosity DEBUG --summary
# selected key performance indicator
pywcmp kpi validate --kpi title /path/to/file.json -v INFO
Using the API
>>> # test a file on disk
>>> import json
>>> from pywcmp.wcmp2.ets import WMOCoreMetadataProfileTestSuite2
>>> from pywcmp.errors import TestSuiteError
>>> with open('/path/to/file.json') as fh:
... data = json.load(fh)
>>> # test ETS
>>> ts = WMOCoreMetadataProfileTestSuite2(data)
>>> ts.run_tests()
>>> ts.raise_for_status() # raises pywcmp.errors.TestSuiteError on exception with list of errors captured in .errors property
>>> # test a URL
>>> from urllib2 import urlopen
>>> from StringIO import StringIO
>>> content = StringIO(urlopen('https://....').read())
>>> data = json.loads(content)
>>> ts = WMOCoreMetadataProfileTestSuite2(data)
>>> ts.run_tests()
>>> ts.raise_for_status() # raises pywcmp.errors.TestSuiteError on exception with list of errors captured in .errors property
>>> # test KPI
>>> from pywcmp.wcmp2.kpi import WMOCoreMetadataProfileKeyPerformanceIndicators
>>> kpis = WMOCoreMetadataProfileKeyPerformanceIndicators(data)
>>> results = kpis.evaluate()
>>> results['summary']
Development
python3 -m venv pywcmp
cd pywcmp
source bin/activate
git clone https://github.com/World-Meteorological-Organization/pywcmp.git
cd pywcmp
pip3 install .
pip3 install ".[dev]"
Running tests
python3 tests/run_tests.py
Releasing
# create release (x.y.z is the release version)
vi pyproject.toml # update [project]/version
git commit -am 'update release version x.y.z'
git push origin master
git tag -a x.y.z -m 'tagging release version x.y.z'
git push --tags
# upload to PyPI
rm -fr build dist *.egg-info
python3 -m build
twine upload dist/*
# publish release on GitHub (https://github.com/World-Meteorological-Organization/pywcmp/releases/new)
# bump version back to dev
vi pyproject.toml # update [project]/version
git commit -am 'back to dev'
git push origin master
Code Conventions
Issues
Issues are managed at https://github.com/World-Meteorological-Organization/pywcmp/issues
Contact
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pywcmp-0.14.4.tar.gz
(22.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
pywcmp-0.14.4-py3-none-any.whl
(29.5 kB
view details)
File details
Details for the file pywcmp-0.14.4.tar.gz.
File metadata
- Download URL: pywcmp-0.14.4.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
904f25894af090449624409ce5f86a1aaa13a063cfe7c338645ee9dbe01b5d87
|
|
| MD5 |
3bc5de55d1ed4181abe57a891b3330e3
|
|
| BLAKE2b-256 |
6d303e6ed80cdadc3c333c350eb168a4d83e4947b039b9bdcc1daf878ae8326e
|
File details
Details for the file pywcmp-0.14.4-py3-none-any.whl.
File metadata
- Download URL: pywcmp-0.14.4-py3-none-any.whl
- Upload date:
- Size: 29.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b38a21c9fa5c6a552155c68f516bf4ba76fed41fe2f109f84de5173904f5f12
|
|
| MD5 |
23538c5b7e933cae2937b78f5e7ecb3a
|
|
| BLAKE2b-256 |
3047dd45f08714ae7cf01f16d10be0cea45bb7114d88d5cb0e17d3290908df54
|