Skip to main content

The EASIER Data Initiative's Python Client

Features

  • Simple CID Data Retrieval
  • CID CSV To Dataframe Object
  • Querying EASIER STAC API by Bounding Box
    • Single Band Retrieval
    • Multi Band Retrieval

Installation

The client can be installed through pip

$ pip install ipfs-stac

Language Support

The client currently supports Python versions 3+

Usage

Create a client object

from ipfs_stac import client

# Create a new client object
easier = client.web3(local_gateway="", stac="")

Fetch a CID from IPFS

# Simple hello world example
data = easier.getFromCID("QmZ4tDuvesekSs4qM5ZBKpXiZGun7S2CYtEZRB3DYXkjGx")
print(data)

"""
hello worlds
"""

Get CID CSV Data to Pandas Dataframe

df = easier.getCSVDataframeFromCID("bafybeifw6kcodgxnamtuvhkxgaf4ep2rwscjae3gnzxb3zj5c6zyea2nri")
print(f"Data frame length: {len(df)}")

"""
Data frame length: 3510
"""

Query STAC API By Bounding Box

easier = client.web3(local_gateway="", stac="<YOUR STAC ENDPOINT GOES HERE>")

"""
The searchSTACByBox by method takes 3 arguments
1. Coordinates for the bounding box
2. Name of the STAC collection to query
3. Index of the item you want to retrieve
"""
item = easier.searchSTACByBox([-76.964657, 38.978967, -76.928008, 39.002783], ["<STAC COLLECTION GOES HERE>"], 0)
band = easier.getBandFromItem(item, 'BAND NAME GOES HERE') # Returns band object

# Optionally, you can fetch multiple bands by the getBandsFromItem Method
bands = easier.getBandsFromItem(item, ["blue", "red"]) # Returns array of bands

The band object

# This snippet extends the previous under "Query STAC API By Bounding Box"

# The band object, when printed, will return the CID
print(band) # QmNddx9BvBsQMXgwp6a83D2wiLrmovgCpRKVYKSJoWNNbx

# You can fetch the band bytes through the fetch method
data = band.fetch()

Attributions

This project was made possible by the following

Download files

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

Source Distribution

ipfs_stac-0.1.6.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ipfs_stac-0.1.6-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file ipfs_stac-0.1.6.tar.gz.

File metadata

  • Download URL: ipfs_stac-0.1.6.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for ipfs_stac-0.1.6.tar.gz
Algorithm Hash digest
SHA256 f09cf34c8f642ce5efcbf01cd5125af46d00eaec860544183065e4bbc13431a1
MD5 d7bc75b3356e80a3be4125e7f87c2f86
BLAKE2b-256 7d51eb1606d8bdc3cd1059d58d7cbc09dcced5801935a888d32e9c15e476b4fb

See more details on using hashes here.

File details

Details for the file ipfs_stac-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: ipfs_stac-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for ipfs_stac-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 0867fd08d420393b9e22fe5663cf6860232c08cf4ea683cf99ce8f0425394fb7
MD5 cd0fdae4932970feb25b02aff96c7a30
BLAKE2b-256 1e14c4637b35c6911bc1e71be6ac6b3bd2c90d069e08107eeeeae842e5425266

See more details on using hashes here.

Supported by

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