Skip to content

Instantly share code, notes, and snippets.

[project]
name = "mapping-313"
version = "0.1.0"
description = "Catch-all mapping env migrated from conda/mamba"
channels = ["conda-forge"]
platforms = ["osx-64"]
[dependencies]
python = "3.13.*"
h5netcdf = "*"
@scottstanie
scottstanie / baselines.py
Created April 15, 2023 01:57
isce3 CSLC baseline computation
import datetime
from pyproj import CRS, Transformer
import h5py
import isce3
import numpy as np
from dolphin._types import Filename
@scottstanie
scottstanie / create-water-mask.py
Created September 23, 2025 19:19
Create a water mask in EPSG:4326 using `esa_world_cover_2021` imagery
# /// script
# requires-python = ">=3.12"
# dependencies = [
# "tile-mate",
# "tyro",
# ]
# ///
"""Create a water mask in EPSG:4326 using `esa_world_cover_2021` imagery.
Examples
# /// 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
@scottstanie
scottstanie / show_h5_sizes.py
Created December 4, 2023 21:03
Pretty print the size on disk + compression ratio of HDF5 datasets with h5py and rich
#!/usr/bin/env python
# requirements: h5py, rich
import sys
import h5py
from rich.console import Console
from rich.table import Table
def _get_object_metadata(obj) -> tuple[str, float, float] | None: