PyGeoFetch 2.7.0.5__py3-none-any.whl → 2.7.0.6__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.7.0.5.4"
33
+ __version__ = "2.7.0.6.4"
34
34
  __author__ = "PyGeoFetch Contributors"
35
35
  __license__ = "MIT"
36
36
 
@@ -512,6 +512,10 @@ class InterferogramGenerator:
512
512
  esd_field: After the constant ESD shift, also measure ESD per burst overlap and range block and
513
513
  remove a smoothly varying residual misregistration (constant + range + azimuth terms).
514
514
  TOPS pairs only (default True).
515
+ esd_ambiguity_scan: How to pick the whole number of ESD ambiguities (~0.11 px each) that ESD cannot see:
516
+ "auto" (default) keeps k = 0 when cross-correlation pins the first-stage offset to
517
+ better than a quarter ambiguity and runs the coherence scan otherwise; "always" or
518
+ "never" force it.
515
519
  use_gpu: Use CuPy GPU acceleration if available.
516
520
  memory_guard: "warn" (default) | "raise" | "off". Compares the estimated peak memory of a pair with the
517
521
  available memory before the SLCs are read; "raise" stops with MemoryError instead of
@@ -569,6 +573,7 @@ class InterferogramGenerator:
569
573
  dem_geoid_offset_m: float = 0.0,
570
574
  memory_guard: str = "warn",
571
575
  esd_field: bool = True,
576
+ esd_ambiguity_scan: str = "auto",
572
577
  ) -> None:
573
578
  # Added to every DEM height before use. Most DEMs are orthometric (Copernicus DEM: EGM2008) but the geometry
574
579
  # needs ellipsoidal heights; the difference (about +40 m in Silesia) shifts the geocoding by ~N/tan(incidence)
@@ -597,6 +602,9 @@ class InterferogramGenerator:
597
602
  self._coh_window_explicit = coherence_window
598
603
  self._esd_enabled = esd_enabled
599
604
  self._esd_field_enabled = bool(esd_field)
605
+ if esd_ambiguity_scan not in ("auto", "always", "never"):
606
+ raise ValueError(f"esd_ambiguity_scan must be 'auto', 'always' or 'never', got {esd_ambiguity_scan!r}")
607
+ self._esd_ambiguity_scan = esd_ambiguity_scan
600
608
  self._use_gpu = use_gpu
601
609
  if verbosity is not None:
602
610
  from pygeofetch.insar.logs import set_verbosity
@@ -620,7 +628,7 @@ class InterferogramGenerator:
620
628
  self._tops_ctx = None
621
629
  # Part of every pair fingerprint: results saved before TOPS deramping (0) or before resampling onto the
622
630
  # reference grid (1) are not reused.
623
- self._tops_deramp_version = 5
631
+ self._tops_deramp_version = 6
624
632
  # Automatic by default (None): on when the inputs exist, explicit
625
633
  # True/False always respected. It used to be opt-in and silent, which
626
634
  # left a full-width range ramp in every interferogram unless the caller
@@ -1446,8 +1454,15 @@ class InterferogramGenerator:
1446
1454
  if getattr(self, "_tops_ctx", None) is not None:
1447
1455
  _amb = 1.0 / ((_df if _df else 5200.0) * azimuth_time_interval_s)
1448
1456
  try:
1449
- sec_complex, _amb_info = self._resolve_esd_ambiguity(ref_complex, sec_complex, _amb)
1457
+ _scan, _why = self._esd_scan_needed(_amb)
1458
+ if _scan:
1459
+ sec_complex, _amb_info = self._resolve_esd_ambiguity(ref_complex, sec_complex, _amb)
1460
+ else:
1461
+ _amb_info = {"ambiguity_px": float(_amb), "k": 0, "scanned": False, "reason": _why}
1462
+ logger.info("ESD ambiguity: k = 0 kept without a coherence scan (%s)", _why)
1450
1463
  if _amb_info is not None:
1464
+ _amb_info.setdefault("scanned", True)
1465
+ _amb_info.setdefault("reason", _why)
1451
1466
  _total = esd_shift_px + _amb_info["k"] * _amb
1452
1467
  if _amb_info["k"] != 0:
1453
1468
  # ESD again, now within its unambiguous range of the true alignment: the first
@@ -3096,6 +3111,9 @@ class InterferogramGenerator:
3096
3111
  self._tops_ctx = {
3097
3112
  "ref_ramp": ref_ramp, "sec_ramp": sec_ramp, "row_fn": row_fn, "col_fn": col_fn,
3098
3113
  "ref_row_off": float(ref_row_off), "ref_col_off": float(ref_col_off),
3114
+ # how well the first stage pins the constant azimuth offset (decides the ESD ambiguity scan)
3115
+ "coreg_mode": coreg_quality.mode, "coreg_n": coreg_quality.n_gcps_final,
3116
+ "coreg_rms_px": coreg_quality.rms_mean,
3099
3117
  }
3100
3118
  return resampled, coreg_metadata
3101
3119
 
@@ -3399,6 +3417,32 @@ class InterferogramGenerator:
3399
3417
  f"; after correction {info['residual_rms_px']:.4f} px" if "residual_rms_px" in info else "")
3400
3418
  return sec_complex, info
3401
3419
 
3420
+ def _esd_scan_needed(self, ambiguity_px: float):
3421
+ """Whether to choose the ESD ambiguity k by the coherence scan, and why.
3422
+
3423
+ ``esd_ambiguity_scan``: "always", "never" or "auto" (default). The coherence scan is a weak criterion: the
3424
+ coherence changes by about 0.1 % per ambiguity near the optimum, and on Mexico City Sentinel-1 triplets it
3425
+ picked k = -2 and k = -1 where phase closure showed k = 0 was right (a wrong k leaves exactly k fringes per
3426
+ burst along track, invisible at the seams). "auto" therefore keeps k = 0 when the first-stage
3427
+ coregistration already pins the constant azimuth offset to well within half an ambiguity, i.e. when
3428
+ cross-correlation supports the fit and RMS / sqrt(n) < ambiguity / 4, and scans only otherwise
3429
+ (geometry-only first stage, or too few / too noisy cross-correlation points).
3430
+ """
3431
+ policy = getattr(self, "_esd_ambiguity_scan", "auto")
3432
+ if policy == "always":
3433
+ return True, "esd_ambiguity_scan='always'"
3434
+ if policy == "never":
3435
+ return False, "esd_ambiguity_scan='never'"
3436
+ ctx = getattr(self, "_tops_ctx", None) or {}
3437
+ mode, n, rms = ctx.get("coreg_mode"), ctx.get("coreg_n"), ctx.get("coreg_rms_px")
3438
+ if mode in (None, "geometry_only") or not n or rms is None:
3439
+ return True, f"first stage without cross-correlation support (mode {mode})"
3440
+ sigma = float(rms) / max(float(n), 1.0) ** 0.5
3441
+ if sigma < ambiguity_px / 4:
3442
+ return False, (f"first stage {mode} from {n} cross-correlation points pins the offset to "
3443
+ f"{sigma:.3f} px (< ambiguity/4 = {ambiguity_px / 4:.3f} px)")
3444
+ return True, f"first stage offset uncertain ({sigma:.3f} px >= ambiguity/4 = {ambiguity_px / 4:.3f} px)"
3445
+
3402
3446
  def _resolve_esd_ambiguity(self, ref_complex, sec_complex, ambiguity_px: float, k_max: int = 4,
3403
3447
  max_cols: int = 1536, k_limit: int = 15):
3404
3448
  """Pick the whole number of ESD ambiguities to add to the azimuth shift, by coherence.
pygeofetch/meta.yaml CHANGED
@@ -1,4 +1,4 @@
1
- {% set version = "2.7.0.5.4" %}
1
+ {% set version = "2.7.0.6.4" %}
2
2
 
3
3
  package:
4
4
  name: pygeofetch
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pygeofetch
3
- Version: 2.7.0.5
3
+ Version: 2.7.0.6
4
4
  Summary: Universal satellite data pipeline + geospatial processing platform
5
5
  Author-email: Samuel Appiah Kubi <appiahkubis14@gmail.com>
6
6
  License: MIT License
@@ -371,7 +371,7 @@ If you use PyGeoFetch in your research or operational work, please cite it using
371
371
  title = {PyGeoFetch: A Unified Python Framework for Multi-Provider Satellite Data Acquisition, Pre-download Quality Control, and Geospatial Processing},
372
372
  year = {2026},
373
373
  publisher = {Zenodo},
374
- version = {2.7.0.5.1},
374
+ version = {2.7.0.6.1},
375
375
  doi = {10.5281/zenodo.22087230},
376
376
  url = {https://doi.org/10.5281/zenodo.22087230}
377
377
  }
@@ -1,5 +1,5 @@
1
- pygeofetch/__init__.py,sha256=Snq0wetXZBT-0e3YegaJrytT-TInMBrYDZnzLagaLug,2107
2
- pygeofetch/meta.yaml,sha256=valtcUsECtsNF7WG8dLVS964_0Vylod-n0R81sGNLVE,1284
1
+ pygeofetch/__init__.py,sha256=O18_DPgWq5U5jEMmXFnCK8Bfp2Rrs6uOQ93W07Fmkhg,2107
2
+ pygeofetch/meta.yaml,sha256=sc3OupnE1gfT0Ns2pyT3QT8NJalX_h5heL4-8Um8AYI,1284
3
3
  pygeofetch/cli/__init__.py,sha256=QZMIIHEgmjGFieucqq9fZ5uephxP9-jdu1s8Q4qqw8o,30
4
4
  pygeofetch/cli/auth_commands.py,sha256=OUYbInPaERvAfNZ_NmAF3azHoJm14cGn_ZTQtxjjcs4,7871
5
5
  pygeofetch/cli/classify_commands.py,sha256=0att8QoTKPa-z24NXLTW-iXbpkBWZTxjoZkV1eNwHeU,4739
@@ -55,7 +55,7 @@ pygeofetch/insar/flatearth.py,sha256=gSUdDcHlxs3P2TrUkKFkIwq7GftKVOit0A47CaBKIvc
55
55
  pygeofetch/insar/geolocation.py,sha256=7T84uNHIXGmuOCvru9CJkFrnet4HX3t-thXXro2peRk,34163
56
56
  pygeofetch/insar/gpu.py,sha256=tMQSurv6EmmQMFU-e9--ssZo0YRUooPRHyU0V8jamIQ,5726
57
57
  pygeofetch/insar/hybrid_unwrap.py,sha256=PT4G9UPTrMqftaMjFd0i9DkwmtRZXAqN504eLYc22ds,18477
58
- pygeofetch/insar/interferogram.py,sha256=Y7ThJTUX5jbVQPNZwbSKXDhiHzjhb3fIDJCOvtzT6to,185120
58
+ pygeofetch/insar/interferogram.py,sha256=ib8bCmSLxQwqaX-rTlCXLWOsxYY86JtnNflhOFA2SU8,188375
59
59
  pygeofetch/insar/ionosphere.py,sha256=erfzXKGxWLcLvNZznBCx42t6V05oO3M9q-nbrGzrKyc,30987
60
60
  pygeofetch/insar/learned_unwrap.py,sha256=lSX_u-2U5mm8lRKhO0xBMk1dVYcR3wDh6pFWcPdR350,45950
61
61
  pygeofetch/insar/logs.py,sha256=lQliMDJmt15NTz8Xgqg1EzENA3WUFY48u2xRqvSoB1U,2453
@@ -170,7 +170,7 @@ pygeofetch/viz/__init__.py,sha256=bSgK_f_goAHVQOfYu2nbPFVushvsy2hVKBvIBoGonyk,53
170
170
  pygeofetch/viz/insar.py,sha256=SaHBsbmvxAF4dLYptePX3wvKWV8Y2Sxqn8pFDjvyXuk,56742
171
171
  pygeofetch/viz/map.py,sha256=f8whny5mnz7gDsStNdgtVSpqTNHSDhSZoRT2Qs-Lvos,16403
172
172
  pygeofetch/viz/plot.py,sha256=JybD4qElJBOTvWCu7VllL5DqkKFYf5ttJdFfsgApfLE,56601
173
- pygeofetch-2.7.0.5.dist-info/licenses/LICENSE,sha256=zavMyhODD6NvZTmmKFEtATrngwY4CU_NEtY7lhjxGnI,1075
173
+ pygeofetch-2.7.0.6.dist-info/licenses/LICENSE,sha256=zavMyhODD6NvZTmmKFEtATrngwY4CU_NEtY7lhjxGnI,1075
174
174
  pygeofetch_tops_fix_part4/files/pygeofetch/insar/coregister.py,sha256=bmM4tcAZiMDaqqwiPFyrGUFTJm_u5oDbOni6jOzPa0Q,74225
175
175
  pygeofetch_tops_fix_part4/files/pygeofetch/insar/interferogram.py,sha256=UQb_l3oOhxR_Dy-f1Uc3YoqlzFz6SPCTz89EiuKn-U0,178492
176
176
  pygeofetch_tops_fix_part4/files/pygeofetch/insar/tops.py,sha256=-yIthiWED20u7t10m8M3AHEBaa8PDS_rvS-oDnYevgM,18459
@@ -189,8 +189,14 @@ pygeofetch_tops_fix_part6/pygeofetch/insar/tops.py,sha256=ozA8SjgqO6bN8cwwQzKlJS
189
189
  pygeofetch_tops_fix_part6/tests/insar/_fake_safe.py,sha256=-ntqxg2Ln-8ZHxC3Waq1qTbVNAj5Iwj40Bc49Q9kD_A,3356
190
190
  pygeofetch_tops_fix_part6/tests/insar/_tops_sim.py,sha256=t6-ahcc9unf2aLqFTmdMWMeN9gGgU7bFG2ddWS5ZVzY,4776
191
191
  pygeofetch_tops_fix_part6/tests/insar/test_tops_deramp.py,sha256=qGYYoPsS09xEAry2s4jp0zeTxJVv5dDtnq6QNPce-rc,11571
192
- pygeofetch-2.7.0.5.dist-info/METADATA,sha256=2tXJ0pcpHt0Jmrg7_t7dgiQ-6Q1amJSSb0ReSkdPeDw,25014
193
- pygeofetch-2.7.0.5.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
194
- pygeofetch-2.7.0.5.dist-info/entry_points.txt,sha256=dHiUXLF5xNJ8vgtXZoUQNleEMQUeDPZiKQOE1tW8SDY,55
195
- pygeofetch-2.7.0.5.dist-info/top_level.txt,sha256=o7RexBBtK03A1-KjUIBT2urS70N5S60ETsOj_Smus5A,89
196
- pygeofetch-2.7.0.5.dist-info/RECORD,,
192
+ pygeofetch_tops_fix_part7/pygeofetch/insar/esd.py,sha256=PvvEUFPx1kvy6AI4pntowzUxssSeDK8FZfqw9nQhD2s,34392
193
+ pygeofetch_tops_fix_part7/pygeofetch/insar/interferogram.py,sha256=ib8bCmSLxQwqaX-rTlCXLWOsxYY86JtnNflhOFA2SU8,188375
194
+ pygeofetch_tops_fix_part7/pygeofetch/insar/tops.py,sha256=ozA8SjgqO6bN8cwwQzKlJS7sQqZmrabISBhRV8H_0hg,20847
195
+ pygeofetch_tops_fix_part7/tests/insar/_fake_safe.py,sha256=-ntqxg2Ln-8ZHxC3Waq1qTbVNAj5Iwj40Bc49Q9kD_A,3356
196
+ pygeofetch_tops_fix_part7/tests/insar/_tops_sim.py,sha256=t6-ahcc9unf2aLqFTmdMWMeN9gGgU7bFG2ddWS5ZVzY,4776
197
+ pygeofetch_tops_fix_part7/tests/insar/test_tops_deramp.py,sha256=vWorPj79Y0Zwd0_seEV-t8WYeXOH_5oCgW1zUfnnC3s,12633
198
+ pygeofetch-2.7.0.6.dist-info/METADATA,sha256=2dbyK0bAoDxCdoJkO10aVF5nxU6SK5nSCypefqgG_X4,25014
199
+ pygeofetch-2.7.0.6.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
200
+ pygeofetch-2.7.0.6.dist-info/entry_points.txt,sha256=dHiUXLF5xNJ8vgtXZoUQNleEMQUeDPZiKQOE1tW8SDY,55
201
+ pygeofetch-2.7.0.6.dist-info/top_level.txt,sha256=9eHek70wg-Vt21GG0ulmDtyOF9Aov2JqpGwmXvMUs9I,115
202
+ pygeofetch-2.7.0.6.dist-info/RECORD,,
@@ -2,3 +2,4 @@ pygeofetch
2
2
  pygeofetch_tops_fix_part4
3
3
  pygeofetch_tops_fix_part5
4
4
  pygeofetch_tops_fix_part6
5
+ pygeofetch_tops_fix_part7