rgd-client 0.2.2
pip install rgd-client==0.2.2
Newer version available (0.3.11)
Released:
Make web requests to a ResonantGeoData instance.
Navigation
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: Apache Software License (Apache 2.0)
- Author: Kitware, Inc.
- Requires: Python >=3.8
Classifiers
- Development Status
- License
- Programming Language
Project description
rgd_client - ResonantGeoDataClient
The rgd_client Python package allows users to make web requests to a ResonantGeoData instance within a Python script.
Installation
pip install rgd-client
Usage
Search and display results
import json
import matplotlib.pyplot as plt
import numpy as np
from rgd_client import Rgdc
def plot_geojson(gjs, *args, **kwargs):
points = np.array(gjs['coordinates'])
if points.ndim == 3:
points = points[0]
if points.ndim == 1:
points = points.reshape((1, points.size, ))
return plt.plot(points[:,0], points[:,1], *args, **kwargs)
client = Rgdc(username='username', password='password')
bbox = {
"type":"Polygon",
"coordinates":[
[
[-105.45091240368326,39.626245373878696],
[-105.45091240368326,39.929904289147274],
[-104.88775649170178,39.929904289147274],
[-104.88775649170178,39.626245373878696],
[-105.45091240368326,39.626245373878696]
]
]
}
q = client.search(query=json.dumps(bbox), predicate='intersects')
for s in q:
print(s['subentry_name'])
plot_geojson(bbox, 'k--', label='Search Region')
for s in q:
plot_geojson(s['footprint'], label=s['subentry_name'])
plt.legend()
plt.title(f'Count: {len(q)}')
Inspect raster
Preview thumbnails of the raster
import imageio
from io import BytesIO
raster = client.get_raster(q[0])
plot_geojson(bbox, 'k--')
plot_geojson(raster['outline'], 'r')
load_image = lambda imbytes: imageio.imread(BytesIO(imbytes))
count = len(raster['parent_raster']['image_set']['images'])
for i in range(count):
thumb_bytes = client.download_raster_thumbnail(q[0], band=i)
thumb = load_image(thumb_bytes)
plt.subplot(1, count, i+1)
plt.imshow(thumb)
plt.tight_layout()
plt.show()
Download Raster
Download the entire image set of the raster
import rasterio
from rasterio.plot import show
paths = client.download_raster(q[0])
rasters = [rasterio.open(im) for im in paths.images]
for i, src in enumerate(rasters):
plt.subplot(1, len(rasters), i+1)
ax = plt.gca()
show(src, ax=ax)
plt.tight_layout()
plt.show()
Project details
Unverified details
These details have not been verified by PyPIProject links
Meta
- License: Apache Software License (Apache 2.0)
- Author: Kitware, Inc.
- Requires: Python >=3.8
Classifiers
- Development Status
- License
- Programming Language
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
Built Distribution
File details
Details for the file rgd-client-0.2.2.tar.gz
.
File metadata
- Download URL: rgd-client-0.2.2.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08f17896bb3712c7e588e5fd1d3570bffd23ae6445ae8a7df0ac72e10f6f5fe7 |
|
MD5 | ad53f3f07c798db301c7f879b91bc8f2 |
|
BLAKE2b-256 | b17c0552270e8c9c1f0a22e21ba9e10c16a228630f3ba08e78ee87a1a493b023 |
File details
Details for the file rgd_client-0.2.2-py3-none-any.whl
.
File metadata
- Download URL: rgd_client-0.2.2-py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfdd24510921cb59687bc5b24dcdff6da10022613bd71a62bc37ca5292897e34 |
|
MD5 | 04c4fda75a6a3b020cb02bac84b75a47 |
|
BLAKE2b-256 | e5ed3faa2d25942dd3a56ae8410b23a89848fcaab672f6b4f39a78f5f9a35d98 |