Skip to content

Instantly share code, notes, and snippets.

View conorssmith's full-sized avatar

Conor Smith conorssmith

View GitHub Profile
@perrette
perrette / Raster mask on regular grid from shapely Polygon
Last active December 16, 2023 18:01
vector outline to raster mask
import numpy as np
def outline_to_mask(line, x, y):
"""Create mask from outline contour
Parameters
----------
line: array-like (N, 2)
x, y: 1-D grid coordinates (input for meshgrid)