This library implements validation against WMO Core Metadata Profile 1.3, specifically Part 2, Section 2.
virtualenv wmo-cmp-ts
cd wmo-cmp-ts
. bin/activate
git clone [email protected]:OGCMetOceanDWG/wmo-cmp-ts.git
cd wmo-cmp-ts
pip install -r requirements.txt
python setup.py build
python setup.py install
From command line:
wmo-metadata-validate.py /path/to/file.xml
# test a file on disk
>>> from lxml import etree
>>> from wmo_cmp_ts import test_suite
>>> exml = etree.parse('/path/to/file.xml')
>>> ts = test_suite.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 = test_suite.WMOCoreMetadataProfileTestSuite13(exml)
>>> ts.run_tests() # raises ValueError error stack on exception
# handle test_suite.TestSuiteError
# test_suite.TestSuiteError.errors is a list of errors
>>> try:
... ts.run_tests()
... except test_suite.TestSuiteError as err:
... print(err.message)
... '\n'.join(err.errors)
>>> ...
virtualenv wmo-cmp-ts
cd wmo-cmp-ts
source bin/activate
git clone [email protected]:OGCMetOceanDWG/wmo-cmp-ts.git
# via distutils
python setup.py test
# manually
python tests/run_tests.py
wmo-cmp-ts code conventions are as per PEP8
Issues are managed at https://github.com/OGCMetOceanDWG/wmo-cmp-ts/issues