Pythonic API to WMO OSCAR Web Services
Project description
pyoscar
Pythonic API to WMO OSCAR
Overview
pyoscar provides a Pythonic API atop the WMO OSCAR HTTP API.
Installation
Requirements
- Python 3
- virtualenv or Conda
Dependencies
Dependencies are listed in requirements.txt. Dependencies are automatically installed during pyoscar installation.
Installing pyoscar
For users
pip install pyoscar
For developers
# setup virtualenv
python3 -m venv pyoscar
cd pyoscar
source bin/activate
# clone codebase and install
git clone https://github.com/wmo-cop/pyoscar.git
cd pyoscar
python setup.py build
python setup.py install
Running pyoscar via the Command Line
# help
pyoscar --help
# get version
pyoscar --version
# all subcommands support the following options:
# --env (depl or prod, default depl)
# --verbosity (ERROR, WARNING, INFO, DEBUG, default NONE)
# get all station identifiers
pyoscar stations
# get all station identifiers by country
pyoscar stations --country=CAN
# get all station identifiers by program affiliation
pyoscar stations --program=GAW
# get a single station by WMO identifier
pyoscar station --identifier 71151
# get a single station by WIGOS identifier
pyoscar station --identifier 0-20000-0-71151
# get a single station by WIGOS identifier in WIGOS XML format
pyoscar station --identifier 0-20000-0-71151 --format=XML
# add verbose mode (ERROR, WARNING, INFO, DEBUG)
pyoscar station --identifier 0-20000-0-71151 --verbosity=DEBUG
# get contact by country
pyoscar contact -c Canada
# get contact by surname
pyoscar contact -s Karn
# get contact by organization
pyoscar contact -o "Environment Canada"
# upload WMDR XML (to production environment)
pyoscar upload -x /path/to/wmdr.xml -at API_TOKEN -e prod
Using the pyoscar API
from pyoscar import OSCARClient
client = OSCARClient()
# get all Canadian stations
stations = client.get_stations(country='CAN')
# get all Canadian stations
stations = client.get_stations(program='GAW')
# get invididual station report
stn_leo = client.get_station_report('LEO')
Development
Running Tests
# install dev requirements
pip install -r requirements-dev.txt
# run tests like this:
cd pyoscar/tests
python run_tests.py
# or like this:
python setup.py test
# measure code coverage
coverage run --source=pyoscar -m unittest pyoscar.tests.run_tests
coverage report -m
Releasing
python setup.py sdist bdist_wheel --universal
twine upload dist/*
Code Conventions
Bugs and Issues
All bugs, enhancements and issues are managed on GitHub.
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
pyoscar-0.1.0.tar.gz
(6.4 kB
view details)
Built Distributions
pyoscar-0.1.0-py3.7.egg
(9.4 kB
view details)
File details
Details for the file pyoscar-0.1.0.tar.gz
.
File metadata
- Download URL: pyoscar-0.1.0.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | da165874f7ef7257fee7550e87f40f8812818a481b981232239f7fd9d3c6cee7 |
|
MD5 | 6a0c244db548f6eee27cf217690f9aca |
|
BLAKE2b-256 | 6dd7795491f001ce0ceba5765396fc203252e3f64e2cf56dd6f2933920c0d17d |
File details
Details for the file pyoscar-0.1.0-py3.7.egg
.
File metadata
- Download URL: pyoscar-0.1.0-py3.7.egg
- Upload date:
- Size: 9.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7466dcb077e9e72205ec8144367ca5ec541a69d9359e9db1bfe19030aceb2a24 |
|
MD5 | 9ac6684cef281897c425504a8227dde1 |
|
BLAKE2b-256 | 1e177c6a053bf32a7b679197a7058bae7c2f15dcea13f107cb8bbef8ebbf9378 |
File details
Details for the file pyoscar-0.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pyoscar-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e22aece69a05da5df7c1d7d214e3491c4e9914e2f2bbd9341902988789f470f8 |
|
MD5 | 3abf6cb8f9991d44cad60f1d4d71f627 |
|
BLAKE2b-256 | 7e915f325308308862b4554c93fdfd4d9e2f7156ff0722296da699f55ec4b51e |