Skip to content

Latest commit

 

History

History
187 lines (119 loc) · 5.07 KB

README.rst

File metadata and controls

187 lines (119 loc) · 5.07 KB

Thredds Client for Python

Travis Build Install with Conda Join the Chat

Installing Thredds Client

Anaconda

Version-GitHub Version-Anaconda Version-PyPI Downloads

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

conda install -c conda-forge threddsclient

From PyPI

Thredds Client is available from PyPI to install directly with pip or poetry.

pip install threddsclient
poetry add 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

Alternatively, you can also install it directly with pip using a virtual environment of your choice:

pip install "threddsclient @ git+https://github.com/bird-house/threddsclient.git"

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 recursion 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 {NEW_VERSION} patch
  • Do it: bumpversion --new-version {NEW_VERSION} patch
  • Push it: git push --tags

See the bumpversion documentation for details.

Examples with IPython Notebook