Skip to content

Instantly share code, notes, and snippets.

@sgillies
sgillies / cfrw.py
Last active April 26, 2023 08:37
Rasterio concurrency example
"""Concurrent read-process-write example"""
import concurrent.futures
from itertools import islice
from time import sleep
import rasterio
CHUNK = 100
@jqtrde
jqtrde / maptime.md
Last active July 31, 2020 15:09
Maptime Presentation

Hi, and welcome!

We love pixels. We build our tools such that they allow us to work with pixels at a wide range of scales, from individual landsat scenes, to global mosaics, via command line programs or as python libraries we can integrate into large processing pipelines.

Today we'll walk through:

  • processing an individual Landsat scene using rasterio, a tool which serves as the foundation for most of our work
  • uploading the outputs of ^ to Mapbox, where we can visualize it on top of mapbox.satellite, and serve it globally at crazy speed
@sgillies
sgillies / advanced_rasterio_features.ipynb
Last active April 16, 2024 21:39
Advanced Rasterio features notebook
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sgillies
sgillies / README.md
Last active April 6, 2020 12:53
Get raster value at a point using a tiny window

A Rasterio dataset's index() method gives you the row, col index of the pixel containing the point x, y (in the dataset's CRS units).

Define a 1x1 pixel read window starting at that index (see the tiny_window() function below) and use it to read an ndarray. The one in this case has shape (3, 1, 1): 3 bands, 1 row, and 1 column. The values of the 3 bands at the point x, y for this case are 28, 29, and 27.

@friggeri
friggeri / haiku
Created October 6, 2011 07:30
random heroku-like name generator
haiku = ->
adjs = [
"autumn", "hidden", "bitter", "misty", "silent", "empty", "dry", "dark",
"summer", "icy", "delicate", "quiet", "white", "cool", "spring", "winter",
"patient", "twilight", "dawn", "crimson", "wispy", "weathered", "blue",
"billowing", "broken", "cold", "damp", "falling", "frosty", "green",
"long", "late", "lingering", "bold", "little", "morning", "muddy", "old",
"red", "rough", "still", "small", "sparkling", "throbbing", "shy",
"wandering", "withered", "wild", "black", "young", "holy", "solitary",
"fragrant", "aged", "snowy", "proud", "floral", "restless", "divine",