Skip to main content

WMO WIS Catalogue analysis tool

Project description

pywiscat

Build Status

Pythonic API to WMO WIS Catalogue

pywiscat provides a Pythonic API atop the WMO WIS Catalogue in support of reporting and analysis of the WIS Catalogue and Metadata.

Installation

pip

Install latest stable version from PyPI.

pip3 install pywiscat

From source

Install latest development version.

python3 -m venv pywiscat
cd pywiscat
. bin/activate
git clone https://github.com/wmo-im/pywiscat.git
cd pywiscat
pip3 install -r requirements.txt
python3 setup.py build
python3 setup.py install

Running

The canonical URL for the GDC is 'https://api.weather.gc.ca/collections/wis2-discovery-metadata.

To use a different catalogue, set the PYWISCAT_GDC_URL environmnent variable before running pywiscat.

From command line:

# fetch version
pywiscat --version

## WIS 1.0 workflows

# catalogue management

# download bundle of WIS metadata to disk
pywiscat wis1 catalogue cache --directory /path/to/metadata/files

# search for terms (case-insensitive) and group by organization

# search for 'nwp'
pywiscat wis1 report terms-by-org --directory=/path/to/metadata/files --term nwp

# search for 'nwp' and 'model' (exclusive)
pywiscat wis1 report terms-by-org --directory=/path/to/metadata/files --term nwp --term model

# search for 'nwp' in verbose mode (Python logging levels)
pywiscat wis1 report terms-by-org --directory=/path/to/metadata/files --term nwp --verbosity DEBUG

# KPI assesment

# run KPI assesment (aka pywcmp) on all metadata files in a directory with default ("brief") output
pywiscat wis1 report kpi --directory /path/to/metadata/files

# run KPI assesment on selected metadata files printing out the "summary" section for each file
pywiscat wis1 report kpi --file-list /path/to/metadata/file_list.json --output-format summary

# run assesment of KPI 1 (ATS) on all metadata files in a directory with "full" output
pywiscat wis1 report kpi -k1 --directory /path/to/metadata/files --output-format full

# other reports

# list number of records per organization
pywiscat wis1 report records-by-org --directory=/path/to/metadata/files

## WIS2 workflows

# search the WIS2 Global Discovery Catalogue (GDC)
pywiscat wis2 search

# search the WIS2 Global Discovery Catalogue (GDC) with a full text query
pywiscat wis2 search -q radar

# search the WIS2 Global Discovery Catalogue (GDC) with a bounding box query
pywiscat wis2 search --bbox -142,42.-52,84

# get more information about a WIS2 GDC record
pywiscat wis2 get urn:x-wmo:md:can:eccc-msc:c7c9d726-c48a-49e3-98ab-78a1ab87cda8

Using the API

## WIS 1.0 workflows

from pywiscat.wis1.catalogue import cache_catalogue
from pywiscat.wis1.report import group_search_results_by_organization

# catalogue management
status = cache_catalogue('/path/to/directory')

# search for terms (case-insensitive) and group by organization
results_dict = group_search_results_by_organization('path/to/directory', terms=['nwp', 'model'])

## WIS2 workflows

from pywiscat.wis2.catalogue import search, get

# search catalogue
results = search(q='radar', bbox=[-142, 42, -52, 84]))

# get a single catalogue record
results = get('urn:x-wmo:md:can:eccc-msc:c7c9d726-c48a-49e3-98ab-78a1ab87cda8')

Development

python3 -m venv pywiscat
cd pywiscat
source bin/activate
git clone https://github.com/wmo-im/pywiscat.git
pip3 install -r requirements.txt
pip3 install -r requirements-dev.txt
python3 setup.py install

Running tests

# via setuptools
python3 setup.py test
# manually
python3 tests/run_tests.py

Releasing

python3 setup.py sdist bdist_wheel --universal
twine upload dist/*

Code Conventions

PEP8

Issues

Issues are managed at https://github.com/wmo-im/pywiscat/issues

Contact

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywiscat-0.1.0.tar.gz (12.3 kB view details)

Uploaded Source

Built Distribution

pywiscat-0.1.0-py2.py3-none-any.whl (17.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pywiscat-0.1.0.tar.gz.

File metadata

  • Download URL: pywiscat-0.1.0.tar.gz
  • Upload date:
  • Size: 12.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.4

File hashes

Hashes for pywiscat-0.1.0.tar.gz
Algorithm Hash digest
SHA256 771e4fe0e545c55280062bc3d31c184fae6f5612107700efe36fa774efc2a820
MD5 820d25752a82bb68f95c4696e2d03a2f
BLAKE2b-256 246cdd7e814922cf3ff8523058081d9426c56223d0e9060ee560ed463b2fb4c5

See more details on using hashes here.

File details

Details for the file pywiscat-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: pywiscat-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 17.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.4

File hashes

Hashes for pywiscat-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 65dfdab492d6099c733ba4c9ed15fda83248eb9bd56352c1918aaccc83874722
MD5 1e2763c89f9c7a857030a198f262e667
BLAKE2b-256 e87e3e35aa14a81fa8806cf166b1a1ee2cdcd00e249aa5627fbba105d7de1f89

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page