The EASIER Data Initiative's Python Client
View source on GitHub
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ipfs_stac-0.1.4-py3-none-any.whl.
File metadata
- Download URL: ipfs_stac-0.1.4-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4dc31091b6be03a91b1565acbec892841a0a4f5c8682bf373910143c4d1ae51
|
|
| MD5 |
3d9f2d9e886d142d4ae7ebe2612545ac
|
|
| BLAKE2b-256 |
ade19ae820baa39e5138fcb352e42270a6d85bd0e841ba140b8caba19d6d39fd
|