Skip to main content

An intake adapter for building intake catalogs begining with SpatioTemporal Asset Catalogs (STAC)

Project description

Intake-stac

Binder Build Status Documentation Status codecov

This is an intake data source for STAC catalogs.

The SpatioTemporal Asset Catalog (STAC) specification provides a common language to describe a range of geospatial information, so it can more easily be indexed and discovered. A 'spatiotemporal asset' is any file that represents information about the earth captured in a certain space and time.

Two examples of these catalogs are:

Radient Earth keeps track of a more complete listing of STAC implementations here.

This project provides an opinionated way for users to load datasets from these catalogs into the scientific Python ecosystem. Currently it uses the intake-xarray pluging and support datatypes including GeoTIFF, netCDF, GRIB, and OpenDAP. Future formats could include plain shapefile data and more.

Requirements

intake >= 0.5.1
intake-xarray >= 0.3.0
sat-stac >= 0.1.3

Installation

intake-stac will eventually be published on PyPI. For now, you can point to xarray You can install it by running the following in your terminal:

pip install git+https://github.com/pangeo-data/intake-stac

You can test the functionality by opening the example notebooks in the examples/ directory:

Usage

The package can be imported using

from intake_stac import StacCatalog, StacCollection, StacItem

Loading a catalog

You can load data from a STAC catalog by providing the URL to valid STAC catalog entry:

catalog = StacCatalog('https://storage.googleapis.com/pdd-stac/disasters/catalog.json', 'planet-disaster-data')
list(catalog)

You can also point to STAC Collections or Items. Each constructor returns a Intake Catalog with the top level corresponding to the STAC object used for initialization.

stac_cat = StacCatalog('https://landsat-stac.s3.amazonaws.com/catalog.json', 'landsat-stac')
collection_cat = StacCollection('https://landsat-stac.s3.amazonaws.com/landsat-8-l1/catalog.json', 'landsat-8')
items_cat = StacItem('https://landsat-stac.s3.amazonaws.com/landsat-8-l1/111/111/2018-11-30/LC81111112018334LGN00.json', 'LC81111112018334LGN00')

Intake-Stac uses sat-stac to parse STAC objects. You can also pass satstac objects (e.g. satstac.Collection) directly to the Intake-Stac constructors:

import satstac
col = satstac.Collection.open('https://landsat-stac.s3.amazonaws.com/landsat-8-l1/catalog.json')
collection_cat = StacCollection(col, 'landsat-8')

Using the catalog

Once you have a catalog, you can display its entries by iterating through its contents:

for entry_id, entry in catalog.items():
    display(entry)

If the catalog has too many entries to comfortably print all at once, you can narrow it by searching for a term (e.g. 'thumbnail'):

for entry_id, entry in catalog.search('thumbnail').items():
  display(entry)

Loading a dataset

Once you have identified a dataset, you can load it into a xarray.DataArray using to_dask():

da = entry.to_dask()

Roadmap

This project is in its early days. We started with this design document and have been working from there.

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

intake_stac-0.1.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

intake_stac-0.1.0-py2.py3-none-any.whl (7.9 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: intake_stac-0.1.0.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

File hashes

Hashes for intake_stac-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d38d78ce0e3b173d9e9973df0cc899350dae71dbf2226b2bddf5e927c7082f0d
MD5 931d0adf148ce3a1d3baee3739193a68
BLAKE2b-256 f8ae628c28dbdf138a2f1c7117879a76ae8c496056f57b75cdb308695fb0000c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: intake_stac-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.7.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.8

File hashes

Hashes for intake_stac-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2103b55deb6c3d5e9931c90bac98371955625df0af88b3ebff7941aab9bc8814
MD5 f7d289c7d4f4c0e1816c5445d1a81fcb
BLAKE2b-256 e573ae946c524e75c3967abb38d133350990abef960701cdc5259f92bd9c677d

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