A Python implementation of the test suite for WMO Core Metadata Profile
Project description
pywcmp
WMO Core Metadata Profile Test Suite
pywcmp provides validation and quality assessment capabilities for the WMO WIS Core Metadata Profile (WCMP).
- validation against WCMP 1.3, specifically Part 2, Section 2, 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/wmo-im/pywcmp.git
cd pywcmp
pip3 install -r requirements.txt
python3 setup.py build
python3 setup.py install
Running
From command line:
# fetch version
pywcmp --version
# abstract test suite
# validate metadata against abstract test suite (file on disk)
pywcmp ats validate --file /path/to/file.xml
# validate metadata against abstract test suite (URL)
pywcmp ats validate --url http://example.org/path/to/file.xml
# adjust debugging messages (CRITICAL, ERROR, WARNING, INFO, DEBUG) to stdout
pywcmp ats validate --url http://example.org/path/to/file.xml --verbosity DEBUG
# write results to logfile
pywcmp ats validate --url http://example.org/path/to/file.xml --verbosity DEBUG --logfile /tmp/foo.txt
# key performance indicators
# all key performance indicators at once # note: running KPIs automatically runs the ats
pywcmp kpi validate --url http://example.org/path/to/file.xml --verbosity DEBUG
# all key performance indicators at once, in summary
pywcmp kpi validate --url http://example.org/path/to/file.xml --verbosity DEBUG --summary
# all key performance indicators at once, with scoring rubric grouping
pywcmp kpi validate --url http://example.org/path/to/file.xml --verbosity DEBUG --group
# selected key performance indicator
pywcmp kpi validate --kpi 4 -f /path/to/file.xml -v INFO
Using the API
>>> # test a file on disk
>>> from lxml import etree
>>> from pywcmp.ats import ats
>>> exml = etree.parse('/path/to/file.xml')
>>> # test ATS
>>> ts = ats.WMOCoreMetadataProfileTestSuite13(exml)
>>> ts.run_tests() # raises ValueError error stack on exception
>>> # test a URL
>>> from urllib2 import urlopen
>>> from StringIO import StringIO
>>> content = StringIO(urlopen('http://....').read())
>>> exml = etree.parse(content)
>>> ts = ats.WMOCoreMetadataProfileTestSuite13(exml)
>>> ts.run_tests() # raises ValueError error stack on exception
>>> # handle ats.TestSuiteError
>>> # ats.TestSuiteError.errors is a list of errors
>>> try:
... ts.run_tests()
... except ats.TestSuiteError as err:
... print('\n'.join(err.errors))
>>> ...
>>> # test KPI
>>> from pywcmp.kpi import WMOCoreMetadataProfileKeyPerformanceIndicators
>>> kpis = WMOCoreMetadataProfileKeyPerformanceIndicators(exml)
>>> results = kpis.evaluate()
>>> results['summary']
>>> # scoring rubric
>>> grouped = group_kpi_results(results)
Development
python3 -m venv pywcmp
cd pywcmp
source bin/activate
git clone https://github.com/wmo-im/pywcmp.git
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt
python3 setup.py install
Running tests
# via setuptools
python3 setup.py test
# manually
python3 tests/run_tests.py
Releasing
python3 setup.py sdist bdist_wheel --universal
twine upload dist/*
Code Conventions
Issues
Issues are managed at https://github.com/wmo-im/pywcmp/issues
Contact
Project details
Release history Release notifications | RSS feed
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.3.0.tar.gz
(22.4 kB
view details)
Built Distribution
File details
Details for the file pywcmp-0.3.0.tar.gz
.
File metadata
- Download URL: pywcmp-0.3.0.tar.gz
- Upload date:
- Size: 22.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae0c252d54da2ab20ff7356891b4c1cfe9ffba250375cf1680be9af4c14d2f7e |
|
MD5 | 54c2cebf1803dd72644bd85cc88e8b5b |
|
BLAKE2b-256 | 10afbb977539c31015f7e57d8decab642ba3857390253b665f9b081f9aa38053 |
File details
Details for the file pywcmp-0.3.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pywcmp-0.3.0-py2.py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d77b7d687fbbaf7b9dc9ecf26a21226a2fa7333379c5cb95a4473ee8127d8c57 |
|
MD5 | 8e766b6c4f5c9c03833798f61a297401 |
|
BLAKE2b-256 | 0b47dc9f42a8b584890a37dba44342d6367eba5f66575429cf93440faf9e803c |