Skip to main content

Open source Python tools for working with NISAR datasets

Project description

nisar_pytools

Open source Python tools for working with NISAR datasets.

About

nisar_pytools provides utilities for searching, downloading, reading, and processing data products from NASA's NISAR (NASA-ISRO Synthetic Aperture Radar) mission.

Supported Products

  • GSLC - Geocoded Single Look Complex
  • GUNW - Geocoded Unwrapped Interferogram

Additional NISAR product types will be added over time.

Getting Started

Prerequisites

  • Python 3.10+
  • Miniforge (recommended)
  • NASA Earthdata login (for downloading from ASF)

Installation

From PyPI:

pip install nisar-pytools

With optional extras:

pip install nisar-pytools[dem]       # DEM fetching (dem_stitcher)
pip install nisar-pytools[viz]       # Visualization (matplotlib)
pip install nisar-pytools[all]       # Everything

From source (for development):

git clone https://github.com/zmhoppinen/nisar_pytools.git
cd nisar_pytools
mamba env create -f environment.yml
conda activate nisar_pytools

Usage

Search and Download

from nisar_pytools import find_nisar, download_urls

# Search ASF for GSLC products over an area of interest
urls = find_nisar(
    aoi=[-115, 43, -114, 44],
    start_date="2025-06-01",
    end_date="2025-12-01",
    product_type="GSLC",
    path_number=77,
    direction="ASCENDING",
)

# Download in parallel with automatic validation
fps = download_urls(urls, "local/gslcs/")

Read a Single File

from nisar_pytools import open_nisar

dt = open_nisar("NISAR_L2_PR_GSLC_...h5")

# Access a frequency/polarization group
freq_a = dt["science/LSAR/GSLC/grids/frequencyA"].dataset
hh = freq_a["HH"]  # lazy dask-backed DataArray with CRS set

# Coordinates and CRS are assigned automatically
print(hh.rio.crs)  # e.g. EPSG:32611

Stack GSLCs into a Time Series

from nisar_pytools import stack_gslcs

# Stack multiple same-track GSLCs into a (time, y, x) DataArray
stack = stack_gslcs(
    ["gslc_date1.h5", "gslc_date2.h5", "gslc_date3.h5"],
    frequency="frequencyA",
    polarization="HH",
)
# Sorted by time, grid-validated, dask-backed, CRS assigned

SAR Processing

from nisar_pytools.processing import (
    interferogram, coherence, multilook, unwrap, calculate_phase
)

# Interferogram (validates matching grids)
ifg = interferogram(slc1, slc2)

# Multilooked interferogram
ml_ifg = multilook(ifg, looks_y=4, looks_x=4)

# Coherence estimation
coh = coherence(slc1, slc2, window_size=11)

# Phase unwrapping with SNAPHU
unw, conncomp = unwrap(ifg, coh, nlooks=20.0)

Phase Linking

from nisar_pytools.processing import phase_link

# EMI phase linking on a GSLC stack
linked, temporal_coh = phase_link(stack, window_size=11, confidence=0.95)

Polarimetric Decomposition

from nisar_pytools.processing import h_a_alpha

# H-A-alpha decomposition from quad-pol SLC channels
ds = h_a_alpha(hh, hv, vv)
# Returns Dataset with: entropy, anisotropy, alpha, mean_alpha

Local Incidence Angle

from nisar_pytools.utils.local_incidence_angle import local_incidence_angle

lia = local_incidence_angle(dem, los_x, los_y, los_z, heights, x_rg, y_rg, epsg=32611)

Roadmap

  • Lazy HDF5 reader returning xarray DataTree with CRS
  • GSLC and GUNW support
  • ASF search and parallel download with validation
  • GSLC time-series stacking
  • Interferogram, coherence, multilooking, phase extraction
  • Phase unwrapping (SNAPHU)
  • Phase linking (EMI with SHP selection)
  • Polarimetric decomposition (H-A-alpha)
  • Local incidence angle computation
  • Visualization helpers (amplitude, phase, interferogram, coherence)
  • Support for additional NISAR product types

Contributing

Contributions are welcome! Please fork the repo and open a pull request, or open an issue to suggest improvements.

License

Distributed under the MIT License. See LICENSE.txt for more information.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nisar_pytools-0.1.1.tar.gz (55.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nisar_pytools-0.1.1-py3-none-any.whl (37.7 kB view details)

Uploaded Python 3

File details

Details for the file nisar_pytools-0.1.1.tar.gz.

File metadata

  • Download URL: nisar_pytools-0.1.1.tar.gz
  • Upload date:
  • Size: 55.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nisar_pytools-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7b0299c9d3ecc151435564fb779759dc452689cf438aac71fdb1239f80863677
MD5 18d5ae653b910b4582ab660d07e8f005
BLAKE2b-256 d5fa118aee49fc0e03848fd6e407644b7a08a1f5282994c89c3bbdcd479356b0

See more details on using hashes here.

Provenance

The following attestation bundles were made for nisar_pytools-0.1.1.tar.gz:

Publisher: publish.yml on ZachHoppinen/nisar_pytools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nisar_pytools-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nisar_pytools-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 37.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for nisar_pytools-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d1c0053e30be8f453ff4220c210c218aef63ee32563fbf55ea5ac22d0e5bca40
MD5 d6e21ac34a77ff9059d79677f3ea1878
BLAKE2b-256 f25ce082e04cda83d3399828eee652b2f00fffb0f576d88d3c8db16b376f1949

See more details on using hashes here.

Provenance

The following attestation bundles were made for nisar_pytools-0.1.1-py3-none-any.whl:

Publisher: publish.yml on ZachHoppinen/nisar_pytools

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page