Thredds catalog client
Project description
# Thredds Client for Python
[![Travis Build](https://travis-ci.org/bird-house/threddsclient.svg?branch=master)](https://travis-ci.org/bird-house/threddsclient)
[![Install with Conda](https://anaconda.org/birdhouse/threddsclient/badges/installer/conda.svg)](https://anaconda.org/birdhouse/threddsclient)
![License](https://anaconda.org/birdhouse/threddsclient/badges/license.svg)
## Installing Thredds Client
### Anaconda
[![Binstar Build](https://anaconda.org/birdhouse/threddsclient/badges/build.svg)](https://anaconda.org/birdhouse/threddsclient)
![Version](https://anaconda.org/birdhouse/threddsclient/badges/version.svg)
![Downloads](https://anaconda.org/birdhouse/threddsclient/badges/downloads.svg)
Thredds client is available as Anaconda package. Install it with the following command:
``` bash
$ conda install -c birdhouse threddsclient
```
### From github
Prepare a conda environment with the Python dependencies and activate it:
``` bash
$ conda create python=2.7 lxml beautiful-soup requests -n threddsclient
$ source activate threddsclient
```
Clone the threddslclient github repo and install the Python module:
``` bash
$ git clone https://github.com/bird-house/threddsclient.git
$ cd threddsclient
$ python setup.py develop
```
## Using Thredds Client
Read the Thredds tutorial on catalogs: [Thredds Catalog Primer](http://www.unidata.ucar.edu/software/thredds/current/tds/tutorial/CatalogPrimer.html)
### Get download URLs of a catalog
``` python
import threddsclient
urls = threddsclient.download_urls('http://example.com/thredds/catalog.xml')
```
### Get OpenDAP URLs of a catalog
``` python
import threddsclient
urls = threddsclient.opendap_urls('http://example.com/thredds/catalog.xml')
```
### Navigate in catalog
Start reading a catalog
``` python
import threddsclient
cat = threddsclient.read_url('http://example.com/thredds/catalog.xml')
```
Get a list of references to other catalogs & follow them
``` python
refs = cat.references
print refs[0].name
cat2 = refs[0].follow()
```
Get a list of datasets in this catalog
```python
data = cat.datasets
```
Get flat list of all direct datasets (data files) in the catalog
```python
datasets = cat.flat_datasets()
```
Get flat list of all references in the catalog
```python
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.
```python
import threddsclient
for ds in threddsclient.crawl('http://example.com/thredds/catalog.xml', depth=2):
print ds.name
```
## Examples with IPython Notebook
* [NOAA Thredds Catalog](http://nbviewer.ipython.org/github/bird-house/threddsclient/blob/master/examples/noaa_example.ipynb)
/n/nChanges
-------
### 0.3.2 (2015-07-15)
* append catalog.xml to catalog url if missing
* crawl method added
### 0.3.1 (2015-06-14)
* fixed catalog.follow()
* using dataset.download_url()
* added ipython example
* cleaned up Readme
### 0.3.0 (2015-06-13)
* Refactored
* added catalog.opendap_urls()
### 0.2.0 (2015-06-08)
* Refactored
* using CollectionDataset
* added catalog.download_urls()
### 0.1.1 (2015-06-05)
* Fixed catalog generation.
* added pytest dependency.
### 0.1.0 (2015-03-13)
* Version by https://github.com/ScottWales/threddsclient.
[![Travis Build](https://travis-ci.org/bird-house/threddsclient.svg?branch=master)](https://travis-ci.org/bird-house/threddsclient)
[![Install with Conda](https://anaconda.org/birdhouse/threddsclient/badges/installer/conda.svg)](https://anaconda.org/birdhouse/threddsclient)
![License](https://anaconda.org/birdhouse/threddsclient/badges/license.svg)
## Installing Thredds Client
### Anaconda
[![Binstar Build](https://anaconda.org/birdhouse/threddsclient/badges/build.svg)](https://anaconda.org/birdhouse/threddsclient)
![Version](https://anaconda.org/birdhouse/threddsclient/badges/version.svg)
![Downloads](https://anaconda.org/birdhouse/threddsclient/badges/downloads.svg)
Thredds client is available as Anaconda package. Install it with the following command:
``` bash
$ conda install -c birdhouse threddsclient
```
### From github
Prepare a conda environment with the Python dependencies and activate it:
``` bash
$ conda create python=2.7 lxml beautiful-soup requests -n threddsclient
$ source activate threddsclient
```
Clone the threddslclient github repo and install the Python module:
``` bash
$ git clone https://github.com/bird-house/threddsclient.git
$ cd threddsclient
$ python setup.py develop
```
## Using Thredds Client
Read the Thredds tutorial on catalogs: [Thredds Catalog Primer](http://www.unidata.ucar.edu/software/thredds/current/tds/tutorial/CatalogPrimer.html)
### Get download URLs of a catalog
``` python
import threddsclient
urls = threddsclient.download_urls('http://example.com/thredds/catalog.xml')
```
### Get OpenDAP URLs of a catalog
``` python
import threddsclient
urls = threddsclient.opendap_urls('http://example.com/thredds/catalog.xml')
```
### Navigate in catalog
Start reading a catalog
``` python
import threddsclient
cat = threddsclient.read_url('http://example.com/thredds/catalog.xml')
```
Get a list of references to other catalogs & follow them
``` python
refs = cat.references
print refs[0].name
cat2 = refs[0].follow()
```
Get a list of datasets in this catalog
```python
data = cat.datasets
```
Get flat list of all direct datasets (data files) in the catalog
```python
datasets = cat.flat_datasets()
```
Get flat list of all references in the catalog
```python
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.
```python
import threddsclient
for ds in threddsclient.crawl('http://example.com/thredds/catalog.xml', depth=2):
print ds.name
```
## Examples with IPython Notebook
* [NOAA Thredds Catalog](http://nbviewer.ipython.org/github/bird-house/threddsclient/blob/master/examples/noaa_example.ipynb)
/n/nChanges
-------
### 0.3.2 (2015-07-15)
* append catalog.xml to catalog url if missing
* crawl method added
### 0.3.1 (2015-06-14)
* fixed catalog.follow()
* using dataset.download_url()
* added ipython example
* cleaned up Readme
### 0.3.0 (2015-06-13)
* Refactored
* added catalog.opendap_urls()
### 0.2.0 (2015-06-08)
* Refactored
* using CollectionDataset
* added catalog.download_urls()
### 0.1.1 (2015-06-05)
* Fixed catalog generation.
* added pytest dependency.
### 0.1.0 (2015-03-13)
* Version by https://github.com/ScottWales/threddsclient.
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
threddsclient-0.3.2.tar.gz
(5.8 kB
view hashes)