Skip to content

Instantly share code, notes, and snippets.

View jhamman's full-sized avatar
🔨
Building Earthmover!

Joe Hamman jhamman

🔨
Building Earthmover!
View GitHub Profile
In [7]: import satsearch
In [8]: results = satsearch.Search.search(
...: collection='landsat-8-l1',
...: bbox=[43.16, -11.32, 43.54, -11.96],
...: sort=['<datetime'], #earliest scene first
...: property=["landsat:tier=T1"])
...:
In [9]: catalog = intake.open_stac_item_collection(results.items())
In [10]: catalog
<satstac.itemcollection.ItemCollection at 0x7f96efe16828>
In [4]: tif = cat['Houston-East-20170831-103f-100d-0f4f-RGB']['thumbnail']
In [5]: tiff_da = tif.to_dask()
Out[5]:
<xarray.DataArray (y: 552, x: 549, channel: 3)>
dask.array<xarray-<this-array>, shape=(552, 549, 3), dtype=uint8, chunksize=(552, 549, 3), chunktype=numpy.ndarray>
Coordinates:
* y (y) int64 0 1 2 3 4 5 6 7 8 ... 543 544 545 546 547 548 549 550 551
* x (x) int64 0 1 2 3 4 5 6 7 8 ... 540 541 542 543 544 545 546 547 548
* channel (channel) int64 0 1 2
In [6]: tiff_da.plot.imshow(rgb='channel')
In [1]: import intake
In [2]: catalog = intake.open_stac_catalog(
...: 'https://storage.googleapis.com/pdd-stac/disasters/catalog.json',
...: name='planet-disaster-data')
...:
In [3]: list(catalog)
Out[3]:
['20170831_172754_101c',
'2017831_195552_SS02',
'20170831_195425_SS02',
@jhamman
jhamman / conway.py
Last active February 27, 2020 21:36
streaming-zarr-blog
store = zarr.RedisStore(port=args.port)
root = zarr.group(store=store, overwrite=True)
t = 0
while True:
arr = root.zeros(f"{t}", shape=grid.shape, chunks=(25, 25)) # create a new array for this timestep
arr[…] = grid # write data to zarr array
t += 1 # increment the time counter
time.sleep(update_interval)
grid = update(grid, N) # evolve the model one time step
@jhamman
jhamman / map_blocks_dataset_schema.ipynb
Last active February 24, 2020 23:43
Xarray map_blocks examples
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhamman
jhamman / apply_along_axis.ipynb
Created October 17, 2019 21:52
apply_along_axis (not working)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhamman
jhamman / bcsd_example.ipynb
Created October 15, 2019 17:56
xsd samples
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhamman
jhamman / xarray_and_mongodb.ipynb
Created October 7, 2019 23:26
Reading/writing xarray with mongodb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jhamman
jhamman / gmet_to_zarr.ipynb
Created March 22, 2019 00:06
GMET to Zarr Example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.