/pypi-github-test

Primary LanguagePythonOtherNOASSERTION

CoverageJSON Pydantic

Test Coverage Package version Downloads License

This repository contains the coveragejson-pydantic Python package. It provides Pydantic models for CoverageJSON. This can, for example, be used to develop an API using FastAPI serving or receiving CoverageJSON.

Install

pip install covjson-pydantic

Or install from source:

pip install git+https://github.com/KNMI/covjson-pydantic.git

Usage

from covjson_pydantic import Domain
from covjson_pydantic import ValuesAxis

axis1 = ValuesAxis(values=[1.23])
d1 = Domain(
    domainType="PointSeries",
    axes={
        "x": axis1,
        "y": axis1,
        "t": {"values": [2.0]}
    }
)
print(d1.json())

See example.py for more examples.

Contributing

Make an editable install from within the repository root

pip install -e '.[test]'

Running tests

pytest tests/

License

Apache License, Version 2.0

Copyright

Koninklijk Nederlands Meteorologisch Instituut (KNMI)