pyoscar


Namepyoscar JSON
Version 0.6.4 PyPI version JSON
download
home_pagehttps://github.com/wmo-cop/pyoscar
SummaryPythonic API to WMO OSCAR Web Services
upload_time2023-09-19 14:14:14
maintainerMeteorological Service of Canada
docs_urlNone
authorMeteorological Service of Canada
requires_python
licenseMIT
keywords wmo oscar wigos station metadata gawsis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # pyoscar

Pythonic API to WMO OSCAR

[![Build Status](https://github.com/wmo-cop/pyoscar/workflows/build%20%E2%9A%99%EF%B8%8F/badge.svg)](https://github.com/wmo-cop/pyoscar/actions)

# Overview

pyoscar provides a Pythonic API atop the WMO [OSCAR](https://oscar.wmo.int/surface/index.html) HTTP API.

# Installation

## Requirements
- Python 3
- [virtualenv](https://virtualenv.pypa.io/) or [Conda](https://docs.conda.io)

### Dependencies
Dependencies are listed in [requirements.txt](requirements.txt). Dependencies
are automatically installed during pyoscar installation.

## Installing pyoscar

### For users

To install the latest stable version:

```bash
pip3 install pyoscar
```

To keep up to date with stable updates:

```bash
pip3 install pyoscar -U
```

### For developers

```bash
# 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
python3 setup.py build
python3 setup.py install
```

## Running pyoscar via the Command Line

```bash
# 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 WIGOS identifier
pyoscar station 0-20000-0-71151

# get a single station by WIGOS identifier in summary mode
pyoscar station 0-20000-0-71151 --summary

# get a single station by WIGOS identifier in WIGOS XML format
pyoscar station 0-20000-0-71151 --format=XML

# get a single station by WIGOS identifier in WIGOS XML format in summary mode
pyoscar station 0-20000-0-71151 --format=XML --summary

# add verbose mode (ERROR, WARNING, INFO, DEBUG)
pyoscar station 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

# upload WMDR XML (to production environment) and save results to file
pyoscar upload -x /path/to/wmdr.xml -at API_TOKEN -e prod -l results.log

# use only GML ids is TRUE by default; use --no-gml-ids to set to FALSE
pyoscar upload -x /path/to/wmdr.xml -at API_TOKEN -e prod -l results.log --no-gml-ids

# harvest all records
pyoscar harvest --env=prod --directory=/path/to/dir
```

## Using the pyoscar API

```python
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('0-20000-0-71758')

# get invididual station report in summary mode
stn_leo = client.get_station_report('0-20000-0-71758', summary=True)

# upload WMDR XML

## instantiate client to OSCAR DEPL (default)
client = OSCARClient(api_token='foo')

## ...or to OSCAR production
client = OSCARClient(api_token='foo', env='prod')

with open('some-wmdr-file.xml') as fh:
    data = fh.read()

response = client.upload(data)
```

## Development

### Running Tests

```bash
# install dev requirements
pip3 install -r requirements-dev.txt

# run tests like this:
cd tests
python3 run_tests.py

# or like this:
python3 setup.py test

# measure code coverage
coverage run --source pyoscar setup.py test
coverage report -m
```

# create release (x.y.z is the release version)
vi pyoscar/__init__.py  # update __version__
git commit -am 'update release version x.y.z'
git push origin master
git tag -a x.y.z -m 'tagging release version x.y.z'
git push --tags

# upload to PyPI
rm -fr build dist *.egg-info
python3 setup.py sdist bdist_wheel --universal
twine upload dist/*

# publish release on GitHub (https://github.com/wmo-cop/pyoscar/releases/new)

# bump version back to dev
vi pyoscar/__init__.py  # update __version__
git commit -am 'back to dev'
git push origin master

### Code Conventions

* [PEP8](https://www.python.org/dev/peps/pep-0008)

### Bugs and Issues

All bugs, enhancements and issues are managed on [GitHub](https://github.com/wmo-cop/pyoscar/issues).

## Contact

* [Tom Kralidis](https://github.com/tomkralidis)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/wmo-cop/pyoscar",
    "name": "pyoscar",
    "maintainer": "Meteorological Service of Canada",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "tomkralidis@gmail.com",
    "keywords": "wmo oscar wigos station metadata gawsis",
    "author": "Meteorological Service of Canada",
    "author_email": "tomkralidis@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c2/6e/018dbbc6e83dbc099b8e4db13b6103751f52eb147a0b51293c1482cb37e5/pyoscar-0.6.4.tar.gz",
    "platform": "all",
    "description": "# pyoscar\n\nPythonic API to WMO OSCAR\n\n[![Build Status](https://github.com/wmo-cop/pyoscar/workflows/build%20%E2%9A%99%EF%B8%8F/badge.svg)](https://github.com/wmo-cop/pyoscar/actions)\n\n# Overview\n\npyoscar provides a Pythonic API atop the WMO [OSCAR](https://oscar.wmo.int/surface/index.html) HTTP API.\n\n# Installation\n\n## Requirements\n- Python 3\n- [virtualenv](https://virtualenv.pypa.io/) or [Conda](https://docs.conda.io)\n\n### Dependencies\nDependencies are listed in [requirements.txt](requirements.txt). Dependencies\nare automatically installed during pyoscar installation.\n\n## Installing pyoscar\n\n### For users\n\nTo install the latest stable version:\n\n```bash\npip3 install pyoscar\n```\n\nTo keep up to date with stable updates:\n\n```bash\npip3 install pyoscar -U\n```\n\n### For developers\n\n```bash\n# setup virtualenv\npython3 -m venv pyoscar\ncd pyoscar\nsource bin/activate\n\n# clone codebase and install\ngit clone https://github.com/wmo-cop/pyoscar.git\ncd pyoscar\npython3 setup.py build\npython3 setup.py install\n```\n\n## Running pyoscar via the Command Line\n\n```bash\n# help\npyoscar --help\n\n# get version\npyoscar --version\n\n# all subcommands support the following options:\n# --env (depl or prod, default depl)\n# --verbosity (ERROR, WARNING, INFO, DEBUG, default NONE)\n\n# get all station identifiers\npyoscar stations\n\n# get all station identifiers by country\npyoscar stations --country=CAN\n\n# get all station identifiers by program affiliation\npyoscar stations --program=GAW\n\n# get a single station by WIGOS identifier\npyoscar station 0-20000-0-71151\n\n# get a single station by WIGOS identifier in summary mode\npyoscar station 0-20000-0-71151 --summary\n\n# get a single station by WIGOS identifier in WIGOS XML format\npyoscar station 0-20000-0-71151 --format=XML\n\n# get a single station by WIGOS identifier in WIGOS XML format in summary mode\npyoscar station 0-20000-0-71151 --format=XML --summary\n\n# add verbose mode (ERROR, WARNING, INFO, DEBUG)\npyoscar station 0-20000-0-71151 --verbosity=DEBUG\n\n# get contact by country\npyoscar contact -c Canada\n\n# get contact by surname\npyoscar contact -s Karn\n\n# get contact by organization\npyoscar contact -o \"Environment Canada\"\n\n# upload WMDR XML (to production environment)\npyoscar upload -x /path/to/wmdr.xml -at API_TOKEN -e prod\n\n# upload WMDR XML (to production environment) and save results to file\npyoscar upload -x /path/to/wmdr.xml -at API_TOKEN -e prod -l results.log\n\n# use only GML ids is TRUE by default; use --no-gml-ids to set to FALSE\npyoscar upload -x /path/to/wmdr.xml -at API_TOKEN -e prod -l results.log --no-gml-ids\n\n# harvest all records\npyoscar harvest --env=prod --directory=/path/to/dir\n```\n\n## Using the pyoscar API\n\n```python\nfrom pyoscar import OSCARClient\n\nclient = OSCARClient()\n\n# get all Canadian stations\nstations = client.get_stations(country='CAN')\n\n# get all Canadian stations\nstations = client.get_stations(program='GAW')\n\n# get invididual station report\nstn_leo = client.get_station_report('0-20000-0-71758')\n\n# get invididual station report in summary mode\nstn_leo = client.get_station_report('0-20000-0-71758', summary=True)\n\n# upload WMDR XML\n\n## instantiate client to OSCAR DEPL (default)\nclient = OSCARClient(api_token='foo')\n\n## ...or to OSCAR production\nclient = OSCARClient(api_token='foo', env='prod')\n\nwith open('some-wmdr-file.xml') as fh:\n    data = fh.read()\n\nresponse = client.upload(data)\n```\n\n## Development\n\n### Running Tests\n\n```bash\n# install dev requirements\npip3 install -r requirements-dev.txt\n\n# run tests like this:\ncd tests\npython3 run_tests.py\n\n# or like this:\npython3 setup.py test\n\n# measure code coverage\ncoverage run --source pyoscar setup.py test\ncoverage report -m\n```\n\n# create release (x.y.z is the release version)\nvi pyoscar/__init__.py  # update __version__\ngit commit -am 'update release version x.y.z'\ngit push origin master\ngit tag -a x.y.z -m 'tagging release version x.y.z'\ngit push --tags\n\n# upload to PyPI\nrm -fr build dist *.egg-info\npython3 setup.py sdist bdist_wheel --universal\ntwine upload dist/*\n\n# publish release on GitHub (https://github.com/wmo-cop/pyoscar/releases/new)\n\n# bump version back to dev\nvi pyoscar/__init__.py  # update __version__\ngit commit -am 'back to dev'\ngit push origin master\n\n### Code Conventions\n\n* [PEP8](https://www.python.org/dev/peps/pep-0008)\n\n### Bugs and Issues\n\nAll bugs, enhancements and issues are managed on [GitHub](https://github.com/wmo-cop/pyoscar/issues).\n\n## Contact\n\n* [Tom Kralidis](https://github.com/tomkralidis)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Pythonic API to WMO OSCAR Web Services",
    "version": "0.6.4",
    "project_urls": {
        "Homepage": "https://github.com/wmo-cop/pyoscar"
    },
    "split_keywords": [
        "wmo",
        "oscar",
        "wigos",
        "station",
        "metadata",
        "gawsis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b11d9955ca56bbd21bca08b2ed7e52ff321fb7e7d0af338d99f731082a169d3d",
                "md5": "d632a753ea8489c585f7d21996533613",
                "sha256": "3e25a018c564ec3652acc8a6271d9f6de24abc72abc365748a59309fd4d6afeb"
            },
            "downloads": -1,
            "filename": "pyoscar-0.6.4-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d632a753ea8489c585f7d21996533613",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 11078,
            "upload_time": "2023-09-19T14:14:12",
            "upload_time_iso_8601": "2023-09-19T14:14:12.726009Z",
            "url": "https://files.pythonhosted.org/packages/b1/1d/9955ca56bbd21bca08b2ed7e52ff321fb7e7d0af338d99f731082a169d3d/pyoscar-0.6.4-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c26e018dbbc6e83dbc099b8e4db13b6103751f52eb147a0b51293c1482cb37e5",
                "md5": "858646dcdd4fad5c459ba84dd0e90d44",
                "sha256": "9f1082238748a7f6c216be9b089d4922a16a3cf377e397346a954eeed99988b1"
            },
            "downloads": -1,
            "filename": "pyoscar-0.6.4.tar.gz",
            "has_sig": false,
            "md5_digest": "858646dcdd4fad5c459ba84dd0e90d44",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11512,
            "upload_time": "2023-09-19T14:14:14",
            "upload_time_iso_8601": "2023-09-19T14:14:14.482457Z",
            "url": "https://files.pythonhosted.org/packages/c2/6e/018dbbc6e83dbc099b8e4db13b6103751f52eb147a0b51293c1482cb37e5/pyoscar-0.6.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-19 14:14:14",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "wmo-cop",
    "github_project": "pyoscar",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "lcname": "pyoscar"
}
        
Elapsed time: 0.17679s