Skip to content

Instantly share code, notes, and snippets.

@scottstanie
scottstanie / demo-plot-nisar.py
Last active January 23, 2026 23:22
Fetch a remote subset from a NISAR GSLC, plot
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "h5py",
# "matplotlib",
# "rich",
# "opera-utils[all]",
# ]
# ///
import time
@scottstanie
scottstanie / get_capella_orbit_stats.py
Last active January 14, 2026 19:09
Print the orbit source and stats for a set of Capella SLCs
#!/usr/bin/env python
# /// script
# requires-python = ">=3.13"
# dependencies = [
# "capella-reader",
# ]
# ///
import sys
from typing import Literal
[project]
name = "mapping-313"
description = "Catch-all mapping env migrated from conda/mamba"
requires-python = "== 3.13"
version = "0.1.0"
[build-system]
build-backend = "hatchling.build"
requires = ["hatchling"]
@scottstanie
scottstanie / create-water-mask-natural-earth.py
Last active January 30, 2026 15:53
Create a water mask in EPSG:4326 using `esa_world_cover_2021` imagery or Natural Earth land polygons.
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "geopandas",
# "rasterio",
# "tyro",
# "requests",
# ]
# ///
"""Create a water mask in EPSG:4326 using Natural Earth land polygons.
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "numpy",
# "pyproj",
# "rioxarray",
# "tyro",
# ]
# ///
"""Stand-alone plate-motion utilities and CLI.
@scottstanie
scottstanie / build_virtual_reference.py
Last active September 8, 2025 16:35
Create a reference parquet file for one OPERA DISP-S1 frame
#!/usr/bin/env python
import argparse
import multiprocessing
import warnings
import xarray as xr
from dask import compute, delayed
from dask.distributed import Client
from obstore.store import S3Store
@scottstanie
scottstanie / create-disp-s1-subset.sh
Last active June 26, 2025 22:37
Download and reformat OPERA DISP-S1 data
#!/bin/bash
set -eo pipefail
# Go to https://conda-forge.org/download/ and download mamba the installer
mamba create -n opera-utils-env pip scipy opera-utils
# (will be unnecessary once version rolls into conda-forge from pypi)
mamba run -n opera-utils-env pip install "opera-utils[disp]>=0.23.3"
# Small machine: use only 4 workers
# Large: can use more
#!/usr/bin/bash
set -e
# uv can be set up with:
# curl -LsSf https://astral.sh/uv/install.sh | sh
# Credientials must be set as AWS_* env vars, or with ~/.netrc, or with EARTHDATA_USERNAME and EARTHDATA_PASSWORD
uvx --with "rasterio,opera-utils[disp]>=0.23.1" \
@scottstanie
scottstanie / plot-disp-s1-priority-frames.ipynb
Last active April 11, 2025 17:49
Plot the DISP-S1 frame priorities
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env python
# /// script
# dependencies = ["pillow", "numpy", "networkx", "scikit-image", "tyro"]
# ///
from pathlib import Path
import networkx as nx
import numpy as np
import tyro
from numpy.typing import ArrayLike