Skip to content

Latest commit

 

History

History
160 lines (105 loc) · 4.27 KB

README.rst

File metadata and controls

160 lines (105 loc) · 4.27 KB

Thredds Client for Python

Travis Build Install with Conda Join the Chat

Installing Thredds Client

Anaconda

Version Downloads

Thredds client is available as Anaconda package. Install it with the following command:

$ conda install -c birdhouse -c conda-forge threddsclient

From github

Check out code from the birdy GitHub repo and start the installation:

$ git clone https://github.com/bird-house/threddsclient.git
$ cd threddsclient
$ conda env create -f environment.yml
$ source activate threddsclient
$ python setup.py develop

Using Thredds Client

Read the Thredds tutorial on catalogs: Thredds Catalog Primer

Get download URLs of a catalog

import threddsclient
urls = threddsclient.download_urls('http://example.com/thredds/catalog.xml')

Get OpenDAP URLs of a catalog

import threddsclient
urls = threddsclient.opendap_urls('http://example.com/thredds/catalog.xml')

Navigate in catalog

Start reading a catalog

import threddsclient
cat = threddsclient.read_url('http://example.com/thredds/catalog.xml')

Get a list of references to other catalogs & follow them

refs = cat.references

print refs[0].name
cat2 = refs[0].follow()

Get a list of datasets in this catalog

data  = cat.datasets

Get flat list of all direct datasets (data files) in the catalog

datasets = cat.flat_datasets()

Get flat list of all references in the catalog

references = cat.flat_references()

Crawl thredds catalog

Crawl recursive all direct datasets in catalog following the catalog references. Stop recusion at a given depth level.

import threddsclient
for ds in threddsclient.crawl('http://example.com/thredds/catalog.xml', depth=2):
    print ds.name

Development

Install sources

Check out code from the birdy GitHub repo and start the installation:

$ git clone https://github.com/bird-house/threddsclient.git
$ cd threddsclient
$ conda env create -f environment.yml
$ python setup.py develop

Install additional dependencies:

$ conda install pytest flake8 sphinx bumpversion
OR
$ pip install -r requirements_dev.txt

Bump a new version

Make a new version of Birdy in the following steps:

  • Make sure everything is commit to GitHub.
  • Update CHANGES.rst with the next version.
  • Dry Run: bumpversion --dry-run --verbose --new-version 0.3.4 patch
  • Do it: bumpversion --new-version 0.3.4 patch
  • ... or: bumpversion --new-version 0.4.0 minor
  • Push it: git push --tags

See the bumpversion documentation for details.

Examples with IPython Notebook