Package: pygeometa
pygeometapygeometais a Python package to
generate metadata for geospatial datasets.Installationpygeometa is best installed and used within a Python virtualenv.RequirementsPython 3 and abovePythonvirtualenvpackageDependenciesDependencies are listed inrequirements.txt. Dependencies
are automatically installed during pygeometa's installation.Installing the Packagepython3-mvenvmy-envcdmy-env
.bin/activate
gitclonehttps://github.com/geopython/pygeometa.gitcdpygeometa
python3setup.pybuild
python3setup.pyinstallRunningFrom the command line# show all subcommandspygeometa# show all supported schemaspygeometametadataschemas# provide a basic sanity check/report on an MCFpygeometametadatainfopath/to/file.yml# generate an ISO 19139 document to stdoutpygeometametadatageneratepath/to/file.yml--schema=iso19139# generate an ISO 19139 document to diskpygeometametadatageneratepath/to/file.yml--schema=iso19139--output=some_file.xml# generate an ISO 19139 document to disk with debugging (ERROR, WARNING, INFO, DEBUG)pygeometametadatageneratepath/to/file.yml--schema=iso19139--output=some_file.xml--verbosity=DEBUG# add verbose (ERROR, WARNING, INFO, DEBUG)# use your own defined schemapygeometametadatageneratepath/to/file.yml--schema_local=/path/to/my-schema--output=some_file.xml# to file# validate your MCFpygeometametadatavalidatepath/to/file.yml# import a metadata document to MCFpygeometametadataimportpath/to/file.xml--schema=iso19139# transform from one metadata representation to anotherpygeometametadatatransformpath/to/file.xml--input-schema=iso19139--output-schema=oarec-recordSupported schemasSchemas supported by pygeometa:dcat,referenceiso19139,referenceiso19139-hnap,referenceOGC API - Records - Part 1: Core, record model,referenceSpatioTemporal Asset Catalog(STAC)iso19139-2,referencewmo-cmp,referencewmo-wcmp2,referencewmo-wigos,referenceLocal schema, specified with--schema_local=/path/to/my-schemaUsing the API from Pythonfrompygeometa.coreimportread_mcf,render_j2_template# read from diskmcf_dict=read_mcf('/path/to/file.yml')# read from stringmcf_dict=read_mcf(mcf_string)# choose ISO 19139 output schemafrompygeometa.schemas.iso19139importISO19139OutputSchemaiso_os=ISO19139OutputSchema()# default schemaxml_string=iso_os.write(mcf_dict)# user-defined schemaxml_string=render_j2_template(mcf_dict,template_dir='/path/to/new-schema')# write to diskwithopen('output.xml','wb')asff:ff.write(xml_string)DevelopmentSetting up a Development EnvironmentSame as installing a package.  Use a virtualenv.  Also install developer
requirements:pip3install-rrequirements-dev.txtAdding a Metadata Schema to the CoreAdding an output metadata schemas to pygeometa involves extendingpygeometa.schemas.base.BaseOutputSchemaand supporting thewritefunction to return a string of exported metadata content.  If you are using
Jinja2 templates, see the next section.  If you are using another means of
generating metadata (lxml, xml.etree, json, etc.), override the ABSwriteclass to emit a string using your tooling/workflow accordingly.  See the
below sections for examples.Once you have added your metadata schema, you need to register it with
pygeometa's schema registry:vipygeometa/schemas/__init__.py# edit the SCHEMAS dict with the metadata schema name and dotted path of classJinja2 templatesTo add support for a new metadata schema using Jinja2 templates:cp-rpygeometa/schemas/iso19139pygeometa/schemas/new-schemaThen modify*.j2files in the newpygeometa/schemas/new-schemadirectory
to comply to new metadata schema.Custom toolingTo add support for a new metadata schemas using other tooling/workflow:mkdirpygeometa/schemas/foo
cppygeometa/schemas/iso19139/__init__.pypygeometa/schemas/foo
vipygeometa/schemas/foo/__init__.py# update class name and super().__init__() function accordingly### Running Tests```bash# via setuptoolspython3setup.pytest# manuallycdtests
python3run_tests.pyReleasing# update versionvipygeometa/__init__.py
videbian/changelog# add changelog entry and summary of updatesgitcommit-m'update release version'pygeometa/__init__.pydebian/changelog# push changesgitpushoriginmaster
gittag-ax.y.z-m'tagging release x.y.z'# push taggitpush--tags
rm-frbuilddist*.egg-info
python3setup.pysdistbdist_wheel--universal
twineuploaddist/*Code ConventionsPEP8Bugs and IssuesAll bugs, enhancements and issues are managed onGitHub.ContactTom KralidisAlexandre Leroux