azayaka package
Submodules
azayaka.fileformat module
- Azayaka:
SAR/InSAR Format Module. - JAXA CEOS Format
- ALOS PALSAR
L1.0 RAW, L1.1 SLC
- ALOS-2 PALSAR-2
L1.1 SLC
- ALOS-4 PALSAR-3
L1.2 RAW, L1.1 SLC
- ESA SAFE Format (TODO 3)
Sentinel-1
- NGA Fromat (TODO 1)
SICD CPHD
- NASA/ISRO CEOS Format (TODO 2)
- NISAR
RAW, SLC
Copyright (c) 2026 Syusuke Yasui, Yutaka Yamamoto, and contributors. Licensed under the APGL-3.0 License.
Equation - Condition: No 2.xxx File.
- class azayaka.fileformat.CEOS_PALSAR2_L11_SLC(PATH_CEOS_FOLDER: str, POLARIMETORY: str = 'HH', ORBIT_NAME: str = 'A')[source]
Bases:
objectALOS-2 PALSAR-2 Level 1.1 CEOS Format Reader
IMG: SAR image file (single-look complex, slant range, REAL*4 I/Q)
LED: SAR leader file (orbit, attitude, radiometric info)
- BYTE1 = 1
- BYTE2 = 2
- DIGIT4 = 1000.0
- FLOAT16 = 16
- FLOAT22 = 22
- FLOAT32 = 32
- FLOAT64 = 64
- INTERGER4 = 4
- INTERGER6 = 6
- NUM_VELOCITY_CALC_SPAN_COUNT: int = 4
- SOL = 299792458.0
- TIME_DAY_HOUR = 24
- TIME_DAY_MINITE = 60
- TIME_DAY_SEC = 86400
- TIME_MINITE_SEC = 60
- __init__(PATH_CEOS_FOLDER: str, POLARIMETORY: str = 'HH', ORBIT_NAME: str = 'A')[source]
Initialize CEOS Format Reader (ALOS-2 PALSAR-2 Level 1.1)
- Parameters:
PATH_CEOS_FOLDER (str) – CEOS プロダクトが展開されているフォルダ 例: ALOS2267860740-150210/
POLARIMETORY (str, optional) – 偏波名 ‘HH’, ‘HV’, ‘VV’, ‘VH’.
ORBIT_NAME (str, optional) – 軌道名 ‘A’ or ‘D’.
- class azayaka.fileformat.CEOS_PALSAR3_L11_SLC(PATH_CEOS_FOLDER: str, POLARIMETORY: str = 'HH', ORBIT_NAME: str = 'A')[source]
Bases:
objectALOS-4 PALSAR-3 Level 1.1 CEOS Format Reader
IMG: SAR image file (single-look complex, slant range, REAL*4 I/Q)
LED: SAR leader file (orbit, attitude, radiometric info)
ALOS-2 PALSAR-2 の CEOS フォーマットを踏襲した ALOS-4 PALSAR-3 標準プロダクトフォーマット (FTR-240031A) に対応。
- BYTE1 = 1
- BYTE2 = 2
- DIGIT4 = 1000.0
- FLOAT16 = 16
- FLOAT22 = 22
- FLOAT32 = 32
- FLOAT64 = 64
- INTERGER4 = 4
- INTERGER6 = 6
- NUM_VELOCITY_CALC_SPAN_COUNT: int = 4
- SOL = 299792458.0
- TIME_DAY_HOUR = 24
- TIME_DAY_MINITE = 60
- TIME_DAY_SEC = 86400
- TIME_MINITE_SEC = 60
- __init__(PATH_CEOS_FOLDER: str, POLARIMETORY: str = 'HH', ORBIT_NAME: str = 'A')[source]
Initialize CEOS Format Reader (ALOS-4 PALSAR-3 Level 1.1)
- Parameters:
PATH_CEOS_FOLDER (str) – CEOS プロダクトが展開されているフォルダ 例: ALOS4xxxxxx…/
POLARIMETORY (str, optional) – 偏波名 ‘HH’, ‘HV’, ‘VV’, ‘VH’.
ORBIT_NAME (str, optional) – 軌道名 ‘A’ or ‘D’(ALOS-4 では ProductID 内に 含まれるが、互換のためパラメータとして残す)。
- class azayaka.fileformat.CEOS_PALSAR_L10_RAW(PATH_CEOS_FOLDER: str, POLARIMETORY: str = 'HH', ORBIT_NAME: str = 'A')[source]
Bases:
objectCEOS PALSAR Level 1.0 RAW reader.
Parses JAXA CEOS records and exposes acquisition metadata and raw signal data.
- BYTE1 = 1
- BYTE2 = 2
- DIGIT4 = 1000.0
- FLOAT16 = 16
- FLOAT22 = 22
- FLOAT32 = 32
- FLOAT64 = 64
- INTERGER4 = 4
- INTERGER6 = 6
- NUM_TMP_SAMPLE: int = 36
- NUM_VELOCITY_CALC_SAMPLE: int = 4
- NUM_VELOCITY_CALC_SPAN_COUNT: int = 4
- SOL = 299792458.0
- TIME_DAY_HOUR = 24
- TIME_DAY_MINITE = 60
- TIME_DAY_SEC = 86400
- TIME_MINITE_SEC = 60
- classmethod __init__(PATH_CEOS_FOLDER: str, POLARIMETORY: str = 'HH', ORBIT_NAME: str = 'A')[source]
Initialize CEOS Format Reader :param PATH_CEOS_FOLDER: Path to CEOS folder :type PATH_CEOS_FOLDER: str :param POLARIMETORY: Polarimetry mode. Defaults to ‘HH’, ‘HV’, ‘VV’, ‘VH’. :type POLARIMETORY: str, optional :param ORBIT_NAME: Orbit name, ‘A’ or ‘D’. Defaults to ‘A’. :type ORBIT_NAME: str, optional
- execute_focus(ground_velocity=None, PATH_OUTPUT: str = './output')[source]
フォーカシングの実行(チャープスケーリング法)。
SAR の生データに対してチャープスケーリング(Chirp Scaling, CS)アルゴリズムを適用し、 レンジ方向とアジマス方向の補正・圧縮を行って複素画像を生成します。
処理の流れ(概要): 1. 観測ジオメトリを準備し、衛星位置・速度から中心時刻の速度を推定します
(ground_velocity が指定されている場合はその値で上書き)。
レンジ時間軸 TAU とドップラ中心 F_DOPPLER_CENTROID を定義します。
H1: チャープスケーリングによるレンジ方向の位相補正。
H2: バルク RCMC とレンジ圧縮。
H3: 角度補正(位相誤差補正)。
H4: アジマス圧縮。
FFT/IFFT を用いて周波数領域と時刻領域を往復し、最終的な複素画像を返します。
- Parameters:
ground_velocity (Optional[float]) – 地上速度の手動指定。None の場合は推定値を使用します。
PATH_OUTPUT (str) – ジオメトリ生成時の出力先フォルダ。
- Returns:
フォーカシング後の複素画像 (azimuth x range)。
- Return type:
np.ndarray
- class azayaka.fileformat.CEOS_PALSAR_L11_SLC(PATH_CEOS_FOLDER: str, POLARIMETORY: str = 'HH', ORBIT_NAME: str = 'A')[source]
Bases:
objectCEOS PALSAR Level 1.1 SLC reader.
Parses ALOS PALSAR Level 1.1 CEOS products and exposes SLC data and metadata.
- BYTE1 = 1
- BYTE2 = 2
- DIGIT4 = 1000.0
- FLOAT16 = 16
- FLOAT22 = 22
- FLOAT32 = 32
- FLOAT64 = 64
- INTERGER4 = 4
- INTERGER6 = 6
- NUM_VELOCITY_CALC_SPAN_COUNT: int = 4
- SOL = 299792458.0
- TIME_DAY_HOUR = 24
- TIME_DAY_MINITE = 60
- TIME_DAY_SEC = 86400
- TIME_MINITE_SEC = 60
- __init__(PATH_CEOS_FOLDER: str, POLARIMETORY: str = 'HH', ORBIT_NAME: str = 'A')[source]
Initialize CEOS Format Reader (PALSAR Level 1.1/1.5)
- Parameters:
PATH_CEOS_FOLDER (str) – CEOS プロダクトが展開されているフォルダ 例: ALPSRP021160650-L1.1/
POLARIMETORY (str, optional) – 偏波名 ‘HH’, ‘HV’, ‘VV’, ‘VH’.
ORBIT_NAME (str, optional) – 軌道名 ‘A’ or ‘D’.
- azayaka.fileformat._write_observation_json(obj, output_path: str)[source]
Write a JSON summary of observation geometry and metadata.
- Parameters:
obj (object) – Reader instance containing observation attributes.
output_path (str) – Output JSON file path.
- azayaka.fileformat.check_ceos_polarization_orbit_exists(path_ceos_folder: str, polarimetry: str, orbit_name: str) None[source]
Check if IMG/LED files matching the given polarization and orbit exist in the CEOS folder. Raises FileNotFoundError if not found.
- Parameters:
path_ceos_folder – CEOS product folder
polarimetry – 偏波名 ‘HH’, ‘HV’, ‘VV’, ‘VH’
orbit_name – 軌道名 ‘A’ or ‘D’
- Raises:
FileNotFoundError – If the IMG/LED files matching the given polarization and orbit do not exist
azayaka.geocode module
- Azayaka:
SAR/InSAR Geocoding Module. This module provides functionalities for geocoding SAR/InSAR outputs data.
Copyright (c) 2026 Syusuke Yasui, Yutaka Yamamoto, and contributors. Licensed under the APGL-3.0 License.
Equation - Condition: No 3.xxx File.
- class azayaka.geocode.GRS80[source]
Bases:
objectGRS80 (Geodetic Reference System 1980) 測地基準系のパラメータ
- AE = 6378137.0
- AM = 6370994.431619486
- AMSQ = 40589570047726.49
- AP = 6356752.314140356
- FFACT = -0.006694380022900792
- FLAT = 0.003352810681182319
- GM = 398600.436
- OMFSQ = 0.9933056199770992
- class azayaka.geocode.Geocode(sar, dem_path: str = None, dem_bounds: Tuple[float, float, float, float] = None, dem_shape: Tuple[int, int] = None, dem_transform: Affine = None, dem_crs: str | CRS = 'EPSG:4326', buffer_sample: int = 0, look_direction: str = 'R')[source]
Bases:
objectSAR/InSAR geocoding workflow.
This class manages DEM loading/creation and provides utilities to map radar-domain data onto geographic coordinates using range-Doppler geometry.
- __init__(sar, dem_path: str = None, dem_bounds: Tuple[float, float, float, float] = None, dem_shape: Tuple[int, int] = None, dem_transform: Affine = None, dem_crs: str | CRS = 'EPSG:4326', buffer_sample: int = 0, look_direction: str = 'R')[source]
Initialize the geocoding helper with SAR metadata and DEM settings.
- Parameters:
sar (object) – SAR reader instance with geometry attributes (orbit, slant range, etc.).
dem_path (str, optional) – Path to an existing DEM GeoTIFF. If not provided, an empty DEM is created.
dem_bounds (tuple of float, optional) – DEM bounds as (min_lon, min_lat, max_lon, max_lat) in degrees.
dem_shape (tuple of int, optional) – DEM shape as (height, width) in pixels.
dem_transform (rasterio.Affine, optional) – Raster transform for DEM creation.
dem_crs (str or rasterio.crs.CRS, optional) – Coordinate reference system for the DEM.
buffer_sample (int, optional) – Margin in radar samples to include when cropping for registration.
look_direction (str, optional) – Look direction (“R” or “L”) used for range-Doppler back-geocoding.
- static _apply_shift_map(image, h_shift_map, w_shift_map)[source]
Apply per-pixel shifts to an image.
- Parameters:
image (np.ndarray) – Input image.
h_shift_map (np.ndarray) – Per-pixel shift in the vertical direction.
w_shift_map (np.ndarray) – Per-pixel shift in the horizontal direction.
- Returns:
Shifted image.
- Return type:
np.ndarray
- static _build_geokey_tags(crs)[source]
Build GeoTIFF key tags from a CRS.
- Parameters:
crs (rasterio.crs.CRS or str) – CRS to convert into GeoTIFF tags.
- Returns:
GeoTIFF key tags, or empty dict if CRS is invalid.
- Return type:
dict
- _compute_dem_geometry()[source]
Compute DEM geometry and radar index mappings.
- Returns:
xyz_dem (np.ndarray) – DEM points in ECEF coordinates with shape (H, W, 3).
idx_azimuth (np.ndarray) – Azimuth indices for each DEM pixel.
idx_range (np.ndarray) – Range indices for each DEM pixel.
idx_invalid (np.ndarray) – Boolean mask of invalid indices.
- _compute_scene_corners(max_iter: int = 1000, look_direction: str = 'R')[source]
Compute scene footprint corners via range-Doppler back-geocoding.
- Parameters:
max_iter (int, optional) – Maximum iterations for the solver.
look_direction (str, optional) – Look direction (“R” or “L”).
- Returns:
Corner coordinates as (lat, lon) in degrees.
- Return type:
list[tuple[float, float]]
- classmethod _coregistration_fine_correlation_vectorized(clx_m, clx_s, window_size=32, shift_range_min=-5, shift_range_max=5, stride=8)[source]
Estimate fine coregistration shifts by maximizing correlation.
- Parameters:
clx_m (np.ndarray) – Main complex image.
clx_s (np.ndarray) – Secondary complex image to be shifted.
window_size (int, optional) – Window size for correlation computation.
shift_range_min (int, optional) – Minimum shift to test (pixels).
shift_range_max (int, optional) – Maximum shift to test (pixels).
stride (int, optional) – Sampling stride for sparse shift estimation.
- Returns:
clx_s_reg (np.ndarray) – Coregistered secondary image.
coh_best (np.ndarray) – Best correlation map.
shift_map (tuple[np.ndarray, np.ndarray]) – (azimuth_shift_map, range_shift_map).
- static _correlation_vectorized(clx_m, clx_s, window_size, mean_m_squared=None)[source]
Compute normalized correlation between two complex arrays.
- Parameters:
clx_m (np.ndarray) – Main complex image.
clx_s (np.ndarray) – Secondary complex image.
window_size (int) – Window size for local averaging.
mean_m_squared (np.ndarray, optional) – Precomputed local mean of |clx_m|^2 for reuse.
- Returns:
Correlation (coherence-like) map.
- Return type:
np.ndarray
- static _fill_nan_values_simple(data, fill_value=0.0)[source]
Replace NaN values with a constant fill value.
- Parameters:
data (np.ndarray) – Input array possibly containing NaNs.
fill_value (float, optional) – Value to replace NaNs with.
- Returns:
Array with NaNs replaced.
- Return type:
np.ndarray
- classmethod _geocode_dem_to_radar_smooth(dem, idx_azimuth, idx_range, num_aperture_sample, num_pixel)[source]
Map DEM into radar coordinates and fill gaps smoothly.
- Parameters:
dem (np.ndarray) – DEM in geographic grid.
idx_azimuth (np.ndarray) – Azimuth index map.
idx_range (np.ndarray) – Range index map.
num_aperture_sample (int) – Number of azimuth samples.
num_pixel (int) – Number of range pixels.
- Returns:
dem_radar_smooth (np.ndarray) – DEM resampled to radar coordinates.
valid_mask (np.ndarray) – Boolean mask of valid samples.
- _geocode_radar_to_geo(radar_image, top_az, left_rg, po_shift_azimuth, po_shift_range, use_count=True)[source]
Map a radar image to geographic grid using precomputed indices.
- Parameters:
radar_image (np.ndarray) – Radar-domain image to geocode.
top_az (int) – Top azimuth index for cropping.
left_rg (int) – Left range index for cropping.
po_shift_azimuth (float) – Azimuth shift to apply before mapping.
po_shift_range (float) – Range shift to apply before mapping.
use_count (bool, optional) – Whether to average overlapping samples.
- Returns:
Geocoded image in DEM grid coordinates.
- Return type:
np.ndarray
- classmethod _interpolate_with_spline_fixed(dem_sparse, valid_mask, height, width)[source]
Interpolate DEM data using a coarse spline, with fallback interpolation.
- Parameters:
dem_sparse (np.ndarray) – Sparse DEM in radar coordinates.
valid_mask (np.ndarray) – Boolean mask of valid samples.
height (int) – Output height.
width (int) – Output width.
- Returns:
Interpolated DEM array.
- Return type:
np.ndarray
- _load_or_create_dem()[source]
Load a DEM from disk or create an empty DEM grid.
- Returns:
dem (np.ndarray) – DEM height array in meters.
transform (rasterio.Affine) – Affine transform for the DEM grid.
crs (rasterio.crs.CRS or str) – Coordinate reference system for the DEM.
bounds (rasterio.coords.BoundingBox) – Bounding box of the DEM.
- Raises:
ValueError – If required DEM metadata is missing when dem_path is not provided.
- _range_doppler_back_geocode(sat_pos: ndarray, sat_vel: ndarray, slant_range: float, max_iter: int = 50, tol: float = 1e-06, look_direction: str = 'R') Tuple[float, float][source]
Solve range-Doppler equations to obtain ground coordinates.
- Parameters:
sat_pos (np.ndarray) – Satellite position (ECEF) as a length-3 vector.
sat_vel (np.ndarray) – Satellite velocity (ECEF) as a length-3 vector.
slant_range (float) – Slant range distance in meters.
max_iter (int, optional) – Maximum number of Newton iterations.
tol (float, optional) – Convergence tolerance for the Newton solver.
look_direction (str, optional) – Look direction (“R” or “L”) used to select the cross-track direction.
- Returns:
lat (float) – Geodetic latitude in degrees.
lon (float) – Geodetic longitude in degrees.
- static _save_geotiff(path, data, crs, transform)[source]
Save a single-band GeoTIFF with basic geokeys.
- Parameters:
path (str) – Output file path.
data (np.ndarray) – 2D array to write.
crs (rasterio.crs.CRS or str) – Coordinate reference system.
transform (rasterio.Affine) – Affine transform for the raster.
- static _save_jpg(path, data)[source]
Save a normalized grayscale JPEG representation of data.
- Parameters:
path (str) – Output JPEG path.
data (np.ndarray) – Input data array.
- static _save_multiband_geotiff(path, layers, crs, transform, metadata)[source]
Save a multi-band GeoTIFF with metadata.
- Parameters:
path (str) – Output file path.
layers (list of dict) – Layer descriptors with keys: data, layer_name, process_name, format, scene_id.
crs (rasterio.crs.CRS or str) – Coordinate reference system.
transform (rasterio.Affine) – Affine transform for the raster.
metadata (dict) – Global metadata to store as tags.
- Raises:
ValueError – If no layers are provided.
- static _simple_interpolation(dem_sparse, valid_mask, height, width)[source]
Fill sparse DEM data using nearest-neighbor interpolation.
- Parameters:
dem_sparse (np.ndarray) – Sparse DEM in radar coordinates.
valid_mask (np.ndarray) – Boolean mask of valid samples.
height (int) – Output height.
width (int) – Output width.
- Returns:
Interpolated DEM array.
- Return type:
np.ndarray
- geocode(signal: ndarray, phase: ndarray = None, output_intensity_path: str = None, output_phase_path: str = None, register: bool = True)[source]
Geocode radar-domain data to the DEM grid.
- Parameters:
signal (np.ndarray) – Complex SAR image in radar coordinates.
phase (np.ndarray, optional) – Optional phase or complex data to geocode alongside intensity.
output_intensity_path (str, optional) – Output GeoTIFF path for intensity products.
output_phase_path (str, optional) – Output GeoTIFF path for phase products.
register (bool, optional) – Whether to perform DEM-to-image registration before geocoding.
- Returns:
Dictionary of geocoded products and registration outputs.
- Return type:
dict
- Raises:
ValueError – If the input signal is smaller than the SAR geometry.
- save_scene_kml(output_kml_path: str, max_iter: int = 1000, look_direction: str = None, include_overlay: bool = True, overlay_size: int = 1024)[source]
Save a scene footprint KML for the current SAR acquisition.
- Parameters:
output_kml_path (str) – Output path for the KML file.
max_iter (int, optional) – Maximum iterations for range-Doppler solver.
look_direction (str, optional) – Look direction (“R” or “L”). If None, uses the class default.
include_overlay (bool, optional) – Whether to include an intensity overlay.
overlay_size (int, optional) – Size of the overlay image (pixels).
- Returns:
Scene corners as (lat, lon) in degrees.
- Return type:
list[tuple[float, float]]
- azayaka.geocode.geocen(lat: float | ndarray, height: float | ndarray) Tuple[ndarray, ndarray][source]
測地緯度から地心緯度と地心距離を計算する。
測地緯度(地表面の法線が赤道面となす角)を地心緯度(地心から見た角度)に変換し、 地心からの距離を計算します。
- Parameters:
lat (float or array_like) – 測地緯度 (ラジアン)。スカラー値またはn次元配列。
height (float or array_like) – GRS80楕円体からの高度 (m)。latと同じ形状である必要があります。
- Returns:
latc (ndarray) – 地心緯度 (ラジアン)
r (ndarray) – 地心からの距離 (m)
Notes
この関数は、楕円体上の点から地心座標系への変換において、 緯度の補正と実際の地心距離を計算します。
- azayaka.geocode.geoxyz(lat: float | ndarray, lon: float | ndarray, height: float | ndarray) Tuple[ndarray, ndarray][source]
測地座標から地心直交座標(ECEF)への変換。
GRS80測地基準系における測地緯度、経度、楕円体高から、 地球中心を原点とする地心直交座標系(Earth Centered Earth Fixed: ECEF)の XYZ座標を計算します。
- Parameters:
lat (float or array_like) – 測地緯度 (ラジアン)。-π/2 ≤ lat ≤ π/2
lon (float or array_like) – 測地経度 (ラジアン)。-π ≤ lon ≤ π
height (float or array_like) – GRS80楕円体からの高度 (m)
- Returns:
xyz (ndarray) – 地心直交座標 [X, Y, Z] (m)。 - X軸: グリニッジ子午線と赤道の交点方向 - Y軸: 東経90度と赤道の交点方向 - Z軸: 地球の自転軸(北極方向が正)
r (ndarray) – 地心からの距離 (m)
See also
xyz2geo逆変換(地心直交座標から測地座標への変換)
- azayaka.geocode.polcar(lat: float | ndarray, lon: float | ndarray, r: float | ndarray) ndarray[source]
極座標(球座標)から直交座標への変換。
地心距離と地心緯度・経度から、地心直交座標系(ECEF: Earth Centered Earth Fixed) のXYZ座標を計算します。
- Parameters:
lat (float or array_like) – 地心緯度 (ラジアン)
lon (float or array_like) – 経度 (ラジアン)
r (float or array_like) – 地心からの距離 (m)
- Returns:
xyz – 地心直交座標 [X, Y, Z] (m)。 入力が配列の場合、最後の次元が3要素の座標になります。 例:入力が(M, N)の場合、出力は(M, N, 3)
- Return type:
ndarray
- azayaka.geocode.xyz2geo(xyz: ndarray | Tuple[float, float, float]) Tuple[ndarray, ndarray, ndarray][source]
地心直交座標(ECEF)から測地座標への逆変換。
- Parameters:
xyz (array_like) – 地心直交座標 [X, Y, Z] (m)。 形状は(…, 3)である必要があります。
- Returns:
lat (ndarray) – 測地緯度 (ラジアン)
lon (ndarray) – 測地経度 (ラジアン)
height (ndarray) – 楕円体高 (m)
Notes
Bowringの反復法を使用した逆変換アルゴリズムを実装しています。
azayaka.interferometry module
- Azayaka:
Interferometry SAR Module. This module provides functionalities for SAR interferometric processing and filtering.
Copyright (c) 2026 Syusuke Yasui, Yutaka Yamamoto, and contributors. Licensed under the APGL-3.0 License.
Equation - Condition: No 1.xxx File.
- class azayaka.interferometry.Interferometry(main, sub)[source]
Bases:
objectSAR interferometry processing pipeline.
Provides coregistration, interferogram generation, filtering, and geocoding utilities for a main/sub SLC pair.
- __init__(main, sub)[source]
Initialize the interferometry workflow with main and sub SLC data.
- Parameters:
main (object) – Primary SAR reader instance.
sub (object) – Secondary SAR reader instance.
- _align_signals_to_main() None[source]
Align main and sub signals by cropping to the common shape.
- Return type:
None
- static _apply_geocode_registration(geocoder: Geocode, radar_image: ndarray, registration: Dict) ndarray[source]
Apply registration parameters and geocode a radar image.
- Parameters:
geocoder (Geocode) – Geocode helper instance.
radar_image (np.ndarray) – Radar-domain image to transform.
registration (dict) – Registration metadata from _prepare_geocode_registration.
- Returns:
Geocoded image.
- Return type:
np.ndarray
- static _apply_geocode_registration_cropped(geocoder: Geocode, radar_crop: ndarray, registration: Dict) ndarray[source]
Apply registration to a pre-cropped radar image and geocode.
- Parameters:
geocoder (Geocode) – Geocode helper instance.
radar_crop (np.ndarray) – Cropped radar-domain image.
registration (dict) – Registration metadata from _prepare_geocode_registration.
- Returns:
Geocoded image.
- Return type:
np.ndarray
- static _coherence_vectorized(clx_m: ndarray, clx_s: ndarray, window_size: int, mean_m_squared: ndarray | None = None) ndarray[source]
Compute local interferometric coherence.
- Parameters:
clx_m (np.ndarray) – Main complex image.
clx_s (np.ndarray) – Secondary complex image.
window_size (int) – Window size for local averaging.
mean_m_squared (np.ndarray, optional) – Precomputed mean of |clx_m|^2 for reuse.
- Returns:
Coherence map.
- Return type:
np.ndarray
- _compute_topography_phase(dem_radar: ndarray) ndarray[source]
Simulate topography phase for the full radar grid.
- Parameters:
dem_radar (np.ndarray) – DEM resampled to radar coordinates.
- Returns:
Complex topography phase screen.
- Return type:
np.ndarray
- _compute_topography_phase_cropped(dem_radar_crop: ndarray, top_az: int, left_rg: int) ndarray[source]
Simulate topography phase for a cropped radar window.
- Parameters:
dem_radar_crop (np.ndarray) – Cropped DEM in radar coordinates.
top_az (int) – Top azimuth index of the crop in the full grid.
left_rg (int) – Left range index of the crop in the full grid.
- Returns:
Complex topography phase screen for the crop.
- Return type:
np.ndarray
- static _convolve2d(image: ndarray, kernel: ndarray) ndarray[source]
Perform a valid 2D convolution using stride tricks.
- Parameters:
image (np.ndarray) – Input image.
kernel (np.ndarray) – Convolution kernel.
- Returns:
Convolved output.
- Return type:
np.ndarray
- classmethod _convolve2d_safe(image: ndarray, kernel: ndarray, boundary: str = 'edge') ndarray[source]
Convolve with padding to preserve size.
- Parameters:
image (np.ndarray) – Input image.
kernel (np.ndarray) – Convolution kernel.
boundary (str, optional) – Padding mode. If empty, no padding is applied.
- Returns:
Convolved output.
- Return type:
np.ndarray
- _coregister_slc(slc_main: ndarray, slc_sub: ndarray, fine: bool = True, coherence_window: int = 4, fine_shift_range: int = 2, fine_stride: int = 1, coarse_downsample: int = 1) Tuple[ndarray, ndarray, Tuple[float, float], Tuple[ndarray, ndarray]][source]
Coregister a secondary SLC to the main SLC.
- Parameters:
slc_main (np.ndarray) – Main SLC image.
slc_sub (np.ndarray) – Secondary SLC image.
fine (bool, optional) – Whether to perform fine coregistration.
coherence_window (int, optional) – Window size for coherence computation.
fine_shift_range (int, optional) – Search range (pixels) for fine shifts.
fine_stride (int, optional) – Stride for fine shift search.
coarse_downsample (int, optional) – Downsample factor for coarse phase correlation.
- Returns:
slc_sub_reg (np.ndarray) – Coregistered secondary SLC.
coherence_reg (np.ndarray) – Coherence after registration.
coarse_shift (tuple[float, float]) – Coarse (range, azimuth) shift estimate.
shift_map (tuple[np.ndarray, np.ndarray]) – Fine per-pixel shift maps (azimuth, range).
- classmethod _coregistration_fine_coherence_vectorized(clx_m: ndarray, clx_s: ndarray, window_size: int = 4, shift_range_min: int = -2, shift_range_max: int = 2, stride: int = 1) Tuple[ndarray, ndarray, Tuple[ndarray, ndarray]][source]
Estimate fine shifts by maximizing coherence.
- Parameters:
clx_m (np.ndarray) – Main complex image.
clx_s (np.ndarray) – Secondary complex image.
window_size (int, optional) – Window size for coherence computation.
shift_range_min (int, optional) – Minimum shift (pixels).
shift_range_max (int, optional) – Maximum shift (pixels).
stride (int, optional) – Sampling stride for sparse search.
- Returns:
clx_s_reg (np.ndarray) – Coregistered secondary image.
coh_best (np.ndarray) – Best coherence map.
shift_map (tuple[np.ndarray, np.ndarray]) – (azimuth_shift_map, range_shift_map).
- static _create_averaging_kernel(size: Tuple[int, int]) ndarray[source]
Create a normalized averaging kernel.
- Parameters:
size (tuple[int, int]) – Kernel size.
- Returns:
Averaging kernel.
- Return type:
np.ndarray
- static _earth_sign(x_main, y_main, x_sub, y_sub, orbit_name: str, sign: int = 1) int[source]
Determine the sign for baseline orientation.
- Parameters:
x_main (np.ndarray) – Main satellite ECEF coordinates.
y_main (np.ndarray) – Main satellite ECEF coordinates.
x_sub (np.ndarray) – Sub satellite ECEF coordinates.
y_sub (np.ndarray) – Sub satellite ECEF coordinates.
orbit_name (str) – Orbit direction label (e.g., “A”, “D”).
sign (int, optional) – Initial sign value.
- Returns:
Sign adjusted by orbit direction and relative longitude.
- Return type:
int
- classmethod _goldstein_filter_patch(patch: ndarray, alpha: float, filter_kernel: ndarray) ndarray[source]
Apply Goldstein phase filtering to a single patch.
- Parameters:
patch (np.ndarray) – Complex input patch.
alpha (float) – Goldstein filter exponent.
filter_kernel (np.ndarray) – Smoothing kernel in frequency domain.
- Returns:
Filtered patch.
- Return type:
np.ndarray
- classmethod _goldstein_phase_filter(image: ndarray, alpha: float = 0.4, patch_size: int = 64, step: int = 8, filter_size: int = 3) ndarray[source]
Apply Goldstein phase filtering over an image.
- Parameters:
image (np.ndarray) – Complex interferogram or phase image.
alpha (float, optional) – Goldstein exponent.
patch_size (int, optional) – Patch size for local filtering.
step (int, optional) – Step size for patch traversal.
filter_size (int, optional) – Size of averaging kernel for smoothing.
- Returns:
Filtered image.
- Return type:
np.ndarray
- _init_baseline_geometry(baseline_offset=0.0) None[source]
Compute baseline geometry between main and sub orbits.
- Parameters:
baseline_offset (float, optional) – Offset added to the perpendicular baseline component.
- Return type:
None
- static _multilook_filter(image: ndarray, looks_azimuth: int, looks_range: int) ndarray[source]
Apply multilook averaging in azimuth and range.
- Parameters:
image (np.ndarray) – Input image.
looks_azimuth (int) – Number of looks in azimuth.
looks_range (int) – Number of looks in range.
- Returns:
Filtered image.
- Return type:
np.ndarray
- static _pad_singlechannel_image(image: ndarray, kernel_shape: Tuple[int, int], boundary: str) ndarray[source]
Pad a single-channel image for convolution.
- Parameters:
image (np.ndarray) – Input image.
kernel_shape (tuple[int, int]) – Kernel shape.
boundary (str) – Padding mode passed to np.pad.
- Returns:
Padded image.
- Return type:
np.ndarray
- static _pad_to_shape(data: ndarray, target_shape: Tuple[int, int], fill_value) ndarray[source]
Pad an array to a target shape.
- Parameters:
data (np.ndarray) – Input array.
target_shape (tuple[int, int]) – Desired output shape.
fill_value (scalar) – Fill value for padded regions.
- Returns:
Padded array.
- Return type:
np.ndarray
- _prepare_geocode_registration(geocoder: Geocode, signal: ndarray, dem_coreg_window_size: int, dem_coreg_shift_range: int, dem_coreg_stride: int)[source]
Compute DEM-based registration parameters for geocoding.
- Parameters:
geocoder (Geocode) – Geocode helper instance.
signal (np.ndarray) – Radar-domain signal used for registration.
dem_coreg_window_size (int) – Window size for DEM-to-image correlation.
dem_coreg_shift_range (int) – Search range (pixels) for DEM registration.
dem_coreg_stride (int) – Sampling stride for the correlation search.
- Returns:
Registration metadata including crop window and shift maps.
- Return type:
dict
- static _save_histogram_jpg(values: ndarray, path: str, bins: int = 256, vmin: float = 0.0, vmax: float = 1.0, threshold: float | None = None) None[source]
Save a histogram plot to JPEG.
- Parameters:
values (np.ndarray) – Input values for histogram.
path (str) – Output file path.
bins (int, optional) – Number of histogram bins.
vmin (float, optional) – Minimum histogram range.
vmax (float, optional) – Maximum histogram range.
threshold (float, optional) – Optional threshold indicator to draw on the histogram.
- static _save_jpg(image: ndarray, path: str, vmin: float | None = None, vmax: float | None = None, cmap: str | None = None) None[source]
Save an image to JPEG with optional colormap.
- Parameters:
image (np.ndarray) – Input image.
path (str) – Output file path.
vmin (float, optional) – Minimum value for normalization.
vmax (float, optional) – Maximum value for normalization.
cmap (str, optional) – Matplotlib colormap name. If None, saves grayscale.
- process(output_dir: str, dem_path: str | None = None, dem_bounds: Tuple[float, float, float, float] | None = None, dem_shape: Tuple[int, int] | None = None, dem_transform=None, dem_crs: str = 'EPSG:4326', buffer_sample: int = 0, look_direction: str = 'R', output_prefix: str = 'interferometry', fine_registration: bool = True, coherence_window: int = 4, fine_shift_range: int = 2, fine_stride: int = 1, multilook_azimuth: int = 3, multilook_range: int = 4, goldstein_alpha: float = 0.4, goldstein_patch_size: int = 64, goldstein_step: int = 16, goldstein_filter_size: int = 3, coherence_threshold_quantile: float | None = 0.3333333333333333, coherence_histogram_threshold: float | None = None, dem_coreg_window_size: int = 128, dem_coreg_shift_range: int = 1, dem_coreg_stride: int = 2, slc_coreg_coarse_downsample: int = 1, sub_buffer: int = 1000) Dict[str, str][source]
Run the full interferometry processing pipeline and save outputs.
- Parameters:
output_dir (str) – Output directory for GeoTIFF/JPEG products.
dem_path (str, optional) – Path to DEM GeoTIFF.
dem_bounds (tuple[float, float, float, float], optional) – DEM bounds (min_lon, min_lat, max_lon, max_lat).
dem_shape (tuple[int, int], optional) – DEM shape (height, width).
dem_transform (rasterio.Affine, optional) – DEM affine transform.
dem_crs (str, optional) – DEM CRS (e.g., “EPSG:4326”).
buffer_sample (int, optional) – Cropping buffer in radar samples.
look_direction (str, optional) – Look direction (“R” or “L”).
output_prefix (str, optional) – Prefix for output filenames.
fine_registration (bool, optional) – Enable fine SLC coregistration.
coherence_window (int, optional) – Window size for coherence estimation.
fine_shift_range (int, optional) – Search range for fine SLC shifts.
fine_stride (int, optional) – Stride for fine shift search.
multilook_azimuth (int, optional) – Multilook factor in azimuth.
multilook_range (int, optional) – Multilook factor in range.
goldstein_alpha (float, optional) – Goldstein filter exponent.
goldstein_patch_size (int, optional) – Patch size for Goldstein filtering.
goldstein_step (int, optional) – Patch step for Goldstein filtering.
goldstein_filter_size (int, optional) – Filter kernel size for Goldstein filtering.
coherence_threshold_quantile (float, optional) – Quantile to threshold coherence.
coherence_histogram_threshold (float, optional) – Explicit threshold for coherence masking.
dem_coreg_window_size (int, optional) – Window size for DEM coregistration.
dem_coreg_shift_range (int, optional) – Shift range for DEM coregistration.
dem_coreg_stride (int, optional) – Stride for DEM coregistration.
slc_coreg_coarse_downsample (int, optional) – Downsample factor for coarse SLC coregistration.
sub_buffer (int, optional) – Buffer margin for sub-image cropping.
- Returns:
Mapping of output product names to file paths.
- Return type:
dict[str, str]
azayaka.processing module
- Azayaka:
SAR/InSAR Processing Handler Module. Summary module for various SAR/InSAR data processing tasks.
Copyright (c) 2026 Syusuke Yasui, Yutaka Yamamoto, and contributors. Licensed under the APGL-3.0 License.
azayaka.utils module
Azayaka utility functions.
- azayaka.utils.save_scene_kml(geocoder, output_kml_path: str, max_iter: int = 1000, look_direction: str = None, include_overlay: bool = True, overlay_size: int = 1024, xyz2geo_func: Callable[[ndarray], Tuple[ndarray, ndarray, ndarray]] = None)[source]
Export the SAR scene footprint to a KML file.
- Parameters:
geocoder (Geocode) – Geocode instance containing SAR geometry and orbit information.
output_kml_path (str) – Output path for the KML file.
max_iter (int, optional) – Maximum iterations for the range-Doppler back-geocoding solver.
look_direction (str, optional) – Look direction override (“R” or “L”). If None, uses the geocoder setting.
include_overlay (bool, optional) – Whether to embed a downsampled intensity overlay.
overlay_size (int, optional) – Output overlay size in pixels for both width and height.
xyz2geo_func (callable, optional) – Function to convert ECEF XYZ to (lat, lon, height) in radians/meters.
- Returns:
Scene corners as (lat, lon) in degrees, ordered around the footprint.
- Return type:
list[tuple[float, float]]
- Raises:
ValueError – If xyz2geo_func is not provided or computed corners are out of bounds.
Module contents
- Azayaka:
SAR/InSAR Python Package. It includes various utilities for SAR/InSAR data processing and analysis.
QGIS Plugin “Azayaka” is also provided for easy access to some functionalities.
Copyright (c) 2026 Syusuke Yasui, Yutaka Yamamoto, and contributors. Licensed under the APGL-3.0 License.