PyGeoFetch 2.6.7.0__py3-none-any.whl → 2.6.9.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
pygeofetch/__init__.py CHANGED
@@ -30,7 +30,7 @@ CLI::
30
30
  pygeofetch doctor
31
31
  """
32
32
 
33
- __version__ = "2.6.7.0.4"
33
+ __version__ = "2.6.9.0.4"
34
34
  __author__ = "PyGeoFetch Contributors"
35
35
  __license__ = "MIT"
36
36
 
@@ -1,22 +1,371 @@
1
1
  """
2
- PyGeoFetch Viz — optional visualization layer.
2
+ PyGeoFetch InSAR — a state-of-the-art Interferometric SAR processing chain.
3
3
 
4
- Install with: pip install "pygeofetch[viz]"
4
+ Install with: pip install "pygeofetch[insar]"
5
+ Adds time-series inversion: pip install "pygeofetch[insar-full]"
6
+
7
+ This module implements the full InSAR processing chain as practiced by
8
+ ASF HyP3, ISCE2/3, GAMMA, and SNAP, using pure-Python, pip-installable
9
+ components wherever a proven one exists:
10
+
11
+ 1. Coregistration — geometric (orbit + DEM) + Enhanced Spectral
12
+ Diversity (ESD) refinement to <0.001 px accuracy,
13
+ required for TOPS burst-overlap phase continuity
14
+ (Prats-Iraola et al. 2012; Yagüe-Martínez et al. 2016)
15
+ 2. Interferogram — complex conjugate multiplication + topographic
16
+ phase removal using a reference DEM
17
+ 3. Coherence — already implemented in pygeofetch.processing.sar
18
+ 4. Phase unwrapping — SNAPHU (Chen & Zebker 2001) via the official
19
+ snaphu-py bindings — the same algorithm used by
20
+ ASF, ISCE2/3, and GAMMA
21
+ 5. Atmospheric — ERA5-based tropospheric delay correction
22
+ correction (Jolivet et al. 2011, 2014 — the PyAPS method)
23
+ 6. Time series — Small BAseline Subset (SBAS) inversion
24
+ (Berardino et al. 2002), with optional weighted,
25
+ bridge-pair-aware inversion (invert_weighted) and
26
+ real, native phase-closure (Yunjun et al. 2019
27
+ style) and DEM-error correction — no external
28
+ MintPy installation required for either.
29
+ 7. PS-InSAR — Persistent Scatterer densification (Ferretti,
30
+ Prati & Rocca 2001): amplitude dispersion index
31
+ selection, post-inversion temporal coherence
32
+ refinement, and atmospheric phase screen (APS)
33
+ estimation. Tested against synthetic data with
34
+ known ground truth at every stage; not yet
35
+ validated against a real site's real PS
36
+ distribution.
37
+ 8. Offset tracking — amplitude cross-correlation for deformation
38
+ beyond phase's ambiguity limit, with sub-pixel
39
+ refinement, real SNR-based quality control, and
40
+ range/azimuth-to-ENU geometric decomposition. The
41
+ range-to-vertical sign convention has a dedicated
42
+ regression test (see geolocation.py); the ENU
43
+ solver's heading_angle_deg is NOT yet verified
44
+ against real product orbit metadata — see
45
+ offset_geometry.py's own docstring before using
46
+ this in production.
47
+
48
+ References:
49
+ Chen, C.W. & Zebker, H.A. (2001). Two-dimensional phase unwrapping with
50
+ use of statistical models for cost functions in a network programming
51
+ framework. J. Opt. Soc. Am. A, 18(2), 338-351.
52
+ Berardino, P., Fornaro, G., Lanari, R., & Sansosti, E. (2002). A new
53
+ algorithm for surface deformation monitoring based on small baseline
54
+ differential SAR interferograms. IEEE TGRS, 40(11), 2375-2383.
55
+ Ferretti, A., Prati, C., & Rocca, F. (2001). Permanent scatterers in
56
+ SAR interferometry. IEEE TGRS, 39(1), 8-20.
57
+ Yunjun, Z., Fattahi, H., Amelung, F. (2019). Small baseline InSAR time
58
+ series analysis: unwrapping error correction and noise reduction.
59
+ Computers & Geosciences, 133, 104331.
60
+ Prats-Iraola, P. et al. (2012). TOPS interferometry with TerraSAR-X.
61
+ IEEE TGRS, 50(8), 3179-3188.
62
+ Jolivet, R. et al. (2014). Improving InSAR geodesy using Global
63
+ Atmospheric Models. JGR Solid Earth, 119(3), 2019-2034.
5
64
 
6
65
  Usage::
7
66
 
8
- from pygeofetch.viz import MapViewer, Plotter
67
+ from pygeofetch.insar import InterferogramGenerator, PhaseUnwrapper
68
+
69
+ gen = InterferogramGenerator()
70
+ result = gen.process_pair(
71
+ reference="slc_20260601.tif",
72
+ secondary="slc_20260613.tif",
73
+ dem="dem.tif",
74
+ )
75
+
76
+ unwrapper = PhaseUnwrapper()
77
+ unwrapped = unwrapper.unwrap(result.interferogram, result.coherence)
78
+
79
+ Weighted, bridge-aware inversion with real native corrections::
9
80
 
10
- mv = MapViewer()
11
- mv.add_raster("ndvi.tif", colormap="RdYlGn")
12
- mv.show()
81
+ from pygeofetch.insar import DataValidator, SBASTimeSeries
13
82
 
14
- pl = Plotter()
15
- pl.plot_raster("ndvi.tif", title="NDVI", output="ndvi.png")
83
+ classification = DataValidator.classify_pairs(sbas_pairs, all_dates)
84
+ sbas = SBASTimeSeries(wavelength_m=0.05546576, reference_date=all_dates[0])
85
+ ts = sbas.invert_weighted(
86
+ sbas_pairs, classification=classification,
87
+ correct_unwrap=True, correct_dem=True, reference_pixel=(row, col),
88
+ )
89
+
90
+ PS-InSAR densification and offset tracking::
91
+
92
+ from pygeofetch.insar import select_persistent_scatterers, OffsetTracker
93
+
94
+ ps_result = select_persistent_scatterers(amplitude_stack)
95
+ tracker = OffsetTracker(search_window_size=64, step_size=16)
96
+ offsets = tracker.track(reference_amplitude, secondary_amplitude)
16
97
  """
17
98
 
18
- from pygeofetch.viz.map import MapViewer
19
- from pygeofetch.viz.plot import Plotter
20
- from pygeofetch.viz.insar import InSARFigures, SarGeometry
99
+ # Real, orbit-based coregistration components. All exported here are
100
+ # individually verified against known ground truth (see each module's
101
+ # docstring for specifics): annotation.py against ESA's own field-path
102
+ # spec; orbit parsing/interpolation against exact reference values;
103
+ # find_zero_doppler_time against known times from starting guesses up
104
+ # to 30 seconds off; geodetic_to_ecef via round-trip verification.
105
+ # solve_ground_point (in geolocation.py) is deliberately NOT exported
106
+ # here — it has a known, unresolved reliability gap and is not
107
+ # recommended as a primary coregistration path; use
108
+ # compute_offset_field_from_dem() instead, which avoids it entirely.
109
+ from pygeofetch.insar.annotation import (
110
+ BurstInfo,
111
+ SLCGeometry,
112
+ SwathTiming,
113
+ parse_burst_info,
114
+ parse_slc_geometry,
115
+ )
116
+ from pygeofetch.insar.atmosphere import AtmosphericCorrector
117
+ from pygeofetch.insar.atmosphere_core import (
118
+ estimate_height_slopes_per_date, fit_height_dependence, structure_function, variance_reduction,
119
+ )
120
+ from pygeofetch.insar.radar_geometry import GeometryNodes, PixelFrame, compute_geometry_nodes
121
+ from pygeofetch.insar.topo import apply_geometric_phase, heights_on_output_grid
122
+ from pygeofetch.insar.coregister import (
123
+ CoregistrationQuality,
124
+ collocate_by_geocoding,
125
+ compute_offset_field_from_dem,
126
+ fit_offset_polynomial,
127
+ fit_offset_polynomial_robust,
128
+ refine_offsets_by_coherence,
129
+ resample_with_offset_field,
130
+ )
131
+ from pygeofetch.insar.deburst import compute_burst_row_ranges, deburst_array
132
+ from pygeofetch.insar.esd import (
133
+ SENTINEL1_IW_DELTA_F_OVL_HZ,
134
+ compute_overlap_row_ranges,
135
+ estimate_esd_shift_per_burst_overlap,
136
+ )
137
+ from pygeofetch.insar.extraction import SLCExtractor
138
+ from pygeofetch.insar.flatearth import compute_flat_earth_phase
139
+ from pygeofetch.insar.geolocation import (
140
+ find_zero_doppler_time,
141
+ geodetic_to_ecef,
142
+ interpolate_orbit_state,
143
+ los_to_vertical_displacement,
144
+ parse_orbit_file,
145
+ range_offset_to_vertical_displacement,
146
+ )
147
+ from pygeofetch.insar.gpu import gpu_available
148
+ from pygeofetch.insar.errors import (
149
+ BurstProcessingError, CoregistrationError, CropError, FlatEarthError, InputError, ProcessingError,
150
+ QualityRecord, TopographicPhaseError, AtmosphereError, GeometryProcessingError,
151
+ )
152
+ from pygeofetch.insar.interferogram import InterferogramGenerator, InterferogramResult
153
+ from pygeofetch.insar.ionosphere import IonosphericCorrector, parse_ionex
154
+
155
+ # Range/azimuth pixel offsets to ground East/North/Up displacement. The
156
+ # math is verified (solve_enu_displacement agrees with
157
+ # range_offset_to_vertical_displacement to 9 decimal places on the same
158
+ # known scenario, in both operating modes). heading_angle_deg is NOT
159
+ # verified against any real product's orbit metadata — every test this
160
+ # session used a typical Sentinel-1 descending value (190 deg). Pull the
161
+ # real value from real product metadata before using this in production;
162
+ # see this module's own docstring for the full caveat.
163
+ from pygeofetch.insar.offset_geometry import (
164
+ pixel_to_physical_offsets,
165
+ solve_enu_displacement,
166
+ )
167
+
168
+ # Amplitude-based offset tracking. NCC verified to machine precision
169
+ # against the direct textbook definition; sub-pixel refinement verified
170
+ # to <0.06px on a blind synthetic shift; the full OffsetTracker windowing
171
+ # class verified on a spatially-VARYING synthetic field, not just a
172
+ # uniform shift.
173
+ from pygeofetch.insar.offset_tracking import (
174
+ OffsetTracker,
175
+ OffsetTrackingResult,
176
+ compute_snr,
177
+ normalized_cross_correlation,
178
+ subpixel_peak_offset,
179
+ )
180
+ from pygeofetch.insar.preflight import PreflightGate, PreflightIssue, PreflightReport
181
+ from pygeofetch.insar.provenance import write_provenance_manifest
182
+
183
+ # Persistent Scatterer InSAR (Ferretti, Prati & Rocca 2001). Real, tested
184
+ # against synthetic data with known ground truth at every stage (ADI
185
+ # correctly separates stable-vs-noisy and bright-vs-dim pixels; temporal
186
+ # coherence correctly demotes an amplitude-only false positive; APS
187
+ # recovery under 1% relative error from 0.5% real sparse coverage) — not
188
+ # yet validated against a real site's actual PS distribution.
189
+ from pygeofetch.insar.ps_selection import (
190
+ PSSelectionResult,
191
+ compute_amplitude_dispersion_index,
192
+ estimate_atmospheric_phase_screen,
193
+ refine_ps_mask_with_temporal_coherence,
194
+ select_persistent_scatterers,
195
+ temporal_coherence,
196
+ )
197
+ from pygeofetch.insar.ps_eval import boost_coherence_with_ps, compare_velocity_maps
198
+ from pygeofetch.insar.ps_stack import (
199
+ ADISelector,
200
+ PSSelection,
201
+ PSSelector,
202
+ PSStack,
203
+ build_ps_stack,
204
+ build_stack,
205
+ choose_master,
206
+ compare_selections,
207
+ holdout_stability,
208
+ residual_phase_coherence,
209
+ select_ps,
210
+ stability_weights,
211
+ )
212
+ from pygeofetch.insar.stack_selection import (
213
+ bbox_to_geojson_path,
214
+ preview_search_results,
215
+ search_and_select_consistent_stack,
216
+ select_burst_synchronized_dates,
217
+ select_consistent_geometry,
218
+ )
219
+ from pygeofetch.insar.synthetic import (
220
+ SyntheticInterferogramResult,
221
+ displacement_to_los,
222
+ generate_synthetic_interferogram,
223
+ okada_surface_deformation,
224
+ spatially_correlated_field,
225
+ )
226
+ from pygeofetch.insar.timeseries import (
227
+ BurstSyncResult,
228
+ InterferogramPair,
229
+ PairCandidate,
230
+ SBASTimeSeries,
231
+ TimeSeriesResult,
232
+ build_sbas_network,
233
+ despike_velocity,
234
+ generate_candidate_pairs,
235
+ screen_stack_burst_synchronization,
236
+ select_pairs_for_processing,
237
+ select_reliable_reference_pixel,
238
+ )
239
+ from pygeofetch.insar.unwrap import (
240
+ PhaseUnwrapper,
241
+ bridge_unwrap_regions,
242
+ goldstein_filter,
243
+ multilook,
244
+ )
245
+ from pygeofetch.insar.validate import (
246
+ DataValidator,
247
+ PairClassification,
248
+ ValidationResult,
249
+ )
250
+ from pygeofetch.insar.visualize import (
251
+ visualize_interferogram,
252
+ visualize_timeseries,
253
+ visualize_unwrapped,
254
+ )
255
+ from pygeofetch.insar.workflow import InSARProject
21
256
 
22
- __all__ = ["MapViewer", "Plotter", "InSARFigures", "SarGeometry"]
257
+ __all__ = [
258
+ "ProcessingError",
259
+ "InputError",
260
+ "CoregistrationError",
261
+ "BurstProcessingError",
262
+ "FlatEarthError",
263
+ "TopographicPhaseError",
264
+ "CropError",
265
+ "QualityRecord",
266
+ "PSStack",
267
+ "PSSelection",
268
+ "PSSelector",
269
+ "ADISelector",
270
+ "build_ps_stack",
271
+ "build_stack",
272
+ "select_ps",
273
+ "compare_selections",
274
+ "holdout_stability",
275
+ "residual_phase_coherence",
276
+ "stability_weights",
277
+ "choose_master",
278
+ "boost_coherence_with_ps",
279
+ "compare_velocity_maps",
280
+ "InterferogramGenerator",
281
+ "InterferogramResult",
282
+ "PhaseUnwrapper",
283
+ "multilook",
284
+ "goldstein_filter",
285
+ "bridge_unwrap_regions",
286
+ "okada_surface_deformation",
287
+ "displacement_to_los",
288
+ "spatially_correlated_field",
289
+ "generate_synthetic_interferogram",
290
+ "SyntheticInterferogramResult",
291
+ "SBASTimeSeries",
292
+ "PairCandidate",
293
+ "build_sbas_network",
294
+ "BurstSyncResult",
295
+ "generate_candidate_pairs",
296
+ "screen_stack_burst_synchronization",
297
+ "select_pairs_for_processing",
298
+ "select_reliable_reference_pixel",
299
+ "despike_velocity",
300
+ "InterferogramPair",
301
+ "TimeSeriesResult",
302
+ "AtmosphericCorrector",
303
+ "estimate_height_slopes_per_date",
304
+ "fit_height_dependence",
305
+ "structure_function",
306
+ "variance_reduction",
307
+ "GeometryNodes",
308
+ "PixelFrame",
309
+ "compute_geometry_nodes",
310
+ "apply_geometric_phase",
311
+ "heights_on_output_grid",
312
+ "AtmosphereError",
313
+ "GeometryProcessingError",
314
+ "SLCExtractor",
315
+ "DataValidator",
316
+ "ValidationResult",
317
+ "PairClassification",
318
+ "gpu_available",
319
+ "visualize_interferogram",
320
+ "visualize_unwrapped",
321
+ "visualize_timeseries",
322
+ "SLCGeometry",
323
+ "parse_slc_geometry",
324
+ "BurstInfo",
325
+ "SwathTiming",
326
+ "parse_burst_info",
327
+ "compute_burst_row_ranges",
328
+ "deburst_array",
329
+ "compute_overlap_row_ranges",
330
+ "estimate_esd_shift_per_burst_overlap",
331
+ "SENTINEL1_IW_DELTA_F_OVL_HZ",
332
+ "compute_flat_earth_phase",
333
+ "IonosphericCorrector",
334
+ "parse_ionex",
335
+ "InSARProject",
336
+ "geodetic_to_ecef",
337
+ "find_zero_doppler_time",
338
+ "parse_orbit_file",
339
+ "interpolate_orbit_state",
340
+ "los_to_vertical_displacement",
341
+ "range_offset_to_vertical_displacement",
342
+ "compute_offset_field_from_dem",
343
+ "fit_offset_polynomial",
344
+ "fit_offset_polynomial_robust",
345
+ "refine_offsets_by_coherence",
346
+ "resample_with_offset_field",
347
+ "collocate_by_geocoding",
348
+ "CoregistrationQuality",
349
+ "select_consistent_geometry",
350
+ "search_and_select_consistent_stack",
351
+ "select_burst_synchronized_dates",
352
+ "bbox_to_geojson_path",
353
+ "preview_search_results",
354
+ "PreflightGate",
355
+ "PreflightReport",
356
+ "PreflightIssue",
357
+ "write_provenance_manifest",
358
+ "PSSelectionResult",
359
+ "compute_amplitude_dispersion_index",
360
+ "select_persistent_scatterers",
361
+ "temporal_coherence",
362
+ "refine_ps_mask_with_temporal_coherence",
363
+ "estimate_atmospheric_phase_screen",
364
+ "OffsetTrackingResult",
365
+ "OffsetTracker",
366
+ "normalized_cross_correlation",
367
+ "subpixel_peak_offset",
368
+ "compute_snr",
369
+ "pixel_to_physical_offsets",
370
+ "solve_enu_displacement",
371
+ ]