pyroSAR is an open-source Python framework designed for large-scale Synthetic Aperture Radar (SAR) satellite data processing. Its core objective is to provide a complete and scalable solution for SAR data organization, processing, and analysis, integrating data acquisition, metadata management, preprocessing, and interaction with mainstream processing software like ESA SNAP. This significantly simplifies complex SAR data processing workflows.
Official Website: https://github.com/johntruckenbrodt/pyroSAR/
Main Features
Multi-source Data Support: Supports reading data from multiple past and present SAR satellite missions such as Sentinel-1, TerraSAR-X, ALOS-PALSAR, etc.
Metadata Management: Automatically extracts SAR image metadata and can store it in SpatiaLite or PostgreSQL databases for efficient querying and management.
Seamless Integration with Processing Software: Provides interfaces to ESA SNAP and GAMMA remote sensing software tools.
Standardized Processing Workflows: Employs consistent internal file naming conventions to track and manage processing results, ensuring clear and reproducible workflows.
Flexible Workflow Control: Breaks down complex processing workflows into sequential substeps, reducing single-process memory consumption and improving processing speed.
Automatic Auxiliary Data Processing: Includes built-in tools for downloading and managing auxiliary data (e.g., Digital Elevation Models and orbit state vector files).
Open Data Cube Compatibility: Exports preprocessed data in formats compatible with Open Data Cube (ODC) for time-series analysis and applications.
Installation
Verify system requirements before installation:
- Python ≥ 3.8
- SNAP and/or GAMMA (install as needed)
- Recommended: Linux/macOS (Windows supported but with lower parallel efficiency)
Complete dependency list: https://github.com/johntruckenbrodt/pyroSAR/blob/main/requirements.txt
For Conda installation, refer to: https://malagis.com/gis-tutorial-conda-base-work-flow.html
conda install -c conda-forge pyrosar
pip installation alternative:
pip install pyroSAR
# Install latest development version from GitHub
pip install git+https://github.com/johntruckenbrodt/pyroSAR.git
Verification:
>>> import pyroSAR
>>> pyroSAR.__version__
'0.30'
Core Functionality Demonstration
SAR Data Reading
from pyroSAR import identify
# Automatically identify data format
scene = identify('S1A_IW_GRDH_1SDV_20230715T043022.zip')
print(scene.metadata) # Output metadata summary
Metadata Processing
# Retrieve imaging geometry parameters
geometry = scene.getCorners()
print(f"Image Coverage: {geometry['extent']}")
# Parse acquisition timeline
timeline = scene.getTimeLine()
print(f"Acquisition Time: {timeline['start']} to {timeline['end']}")
Preprocessing Workflow
from pyroSAR import process
# Basic preprocessing configuration
process(
scene,
outdir='./results/',
resolution=20, # Output resolution (m)
scaling='linear', # Radiometric calibration method
terrain_correction=True # Enable terrain correction
)
Data Cube Export
Generate ODC-compatible formats:
from pyroSAR.datacube import prepare
prepare(
'./results/',
collection='SAR_Collection',
product='Sentinel1_RTC'
)
Batch Processing of Multiple Data
from pyroSAR import identify
import os
input_dir = '/path/to/sar/data'
output_dir = '/path/to/output'
for filename in os.listdir(input_dir):
if filename.endswith('.SAFE'):
sarfile = identify(os.path.join(input_dir, filename))
geocode_params['source'] = sarfile
geocode_params['target_dir'] = output_dir
geocode(**geocode_params)
SNAP Integration
from pyroSAR.snap import process_graph
process_graph('my_graph.xml')
Where my_graph.xml
is a SNAP processing graph file.
Summary & References
pyroSAR is a powerful and flexible SAR data processing tool, particularly suitable for automated and batch processing requirements. It combines Python's usability with SNAP's processing capabilities, making it an ideal choice for SAR data analysis.