PyGeoFetch 2.7.0.3__py3-none-any.whl → 2.7.0.4__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.3.4"
33
+ __version__ = "2.7.0.4.4"
34
34
  __author__ = "PyGeoFetch Contributors"
35
35
  __license__ = "MIT"
36
36
 
@@ -1443,8 +1443,20 @@ class InterferogramGenerator:
1443
1443
  _amb = 1.0 / ((_df if _df else 5200.0) * azimuth_time_interval_s)
1444
1444
  sec_complex, _amb_info = self._resolve_esd_ambiguity(ref_complex, sec_complex, _amb)
1445
1445
  if _amb_info is not None:
1446
+ _total = esd_shift_px + _amb_info["k"] * _amb
1447
+ if _amb_info["k"] != 0:
1448
+ # ESD again, now within its unambiguous range of the true alignment: the first
1449
+ # estimate was made far from it, where the overlaps decorrelate and bias ESD.
1450
+ _r2, _ = estimate_esd_shift_per_burst_overlap(
1451
+ ref_complex, sec_complex, ref_burst_info, azimuth_time_interval_s,
1452
+ row_offset=int(ref_row_off), **_esd_kwargs,
1453
+ )
1454
+ if _r2 is not None and abs(_r2 / azimuth_time_interval_s) > 1e-4:
1455
+ sec_complex = self._apply_azimuth_shift(sec_complex, _r2 / azimuth_time_interval_s)
1456
+ _total += _r2 / azimuth_time_interval_s
1457
+ _amb_info["esd_refinement_px"] = float(_r2 / azimuth_time_interval_s)
1446
1458
  metadata["esd_ambiguity"] = _amb_info
1447
- metadata["esd_total_shift_px"] = esd_shift_px + _amb_info["k"] * _amb
1459
+ metadata["esd_total_shift_px"] = _total
1448
1460
  except Exception as exc: # noqa: BLE001
1449
1461
  logger.warning("ESD ambiguity scan failed: %s", exc)
1450
1462
  else:
@@ -3315,7 +3327,7 @@ class InterferogramGenerator:
3315
3327
  return content_phase
3316
3328
 
3317
3329
  def _resolve_esd_ambiguity(self, ref_complex, sec_complex, ambiguity_px: float, k_max: int = 4,
3318
- max_cols: int = 1536):
3330
+ max_cols: int = 1536, k_limit: int = 15):
3319
3331
  """Pick the whole number of ESD ambiguities to add to the azimuth shift, by coherence.
3320
3332
 
3321
3333
  ESD measures the azimuth misregistration only modulo ``1 / (delta_f_ovl * dt_az)`` (about 0.1 px for IW):
@@ -3323,7 +3335,8 @@ class InterferogramGenerator:
3323
3335
  ramps the TOPS phase through every burst (about 3 rad/km per pixel) and steps it at burst edges. The
3324
3336
  interferometric coherence of a TOPS pair peaks at zero misregistration (the burst spectra overlap best),
3325
3337
  so the secondary is shifted by k ambiguities, k = -k_max..k_max, on a central block of columns, and the
3326
- k with the highest coherence is kept. Returns the (possibly shifted) secondary and the scan.
3338
+ k with the highest coherence is kept; when the best k is at an end of the scan the scan is extended (up
3339
+ to +-k_limit, i.e. about 1.5 px). Returns the (possibly shifted) secondary and the scan.
3327
3340
  """
3328
3341
  np = self._np()
3329
3342
  ctx = getattr(self, "_tops_ctx", None)
@@ -3348,21 +3361,36 @@ class InterferogramGenerator:
3348
3361
  ok = den > 0
3349
3362
  return float(np.mean(num[ok] / den[ok])) if ok.any() else float("nan")
3350
3363
 
3351
- ks = list(range(-k_max, k_max + 1))
3352
- scores = []
3353
- for k in ks:
3354
- shifted = sec_s if k == 0 else shift_azimuth_tops(sec_s.copy(), k * ambiguity_px, content_phase, lpb, r_off)
3355
- scores.append(coherence(ref_s, shifted))
3356
- best = int(np.nanargmax(scores))
3357
- k_best = ks[best]
3364
+ cache = {}
3365
+
3366
+ def score(k):
3367
+ if k not in cache:
3368
+ shifted = sec_s if k == 0 else shift_azimuth_tops(sec_s.copy(), k * ambiguity_px, content_phase, lpb, r_off)
3369
+ cache[k] = coherence(ref_s, shifted)
3370
+ return cache[k]
3371
+
3372
+ for k in range(-k_max, k_max + 1):
3373
+ score(k)
3374
+ # If the peak sits at an end of the scan, keep extending in that direction (up to k_limit ambiguities).
3375
+ while True:
3376
+ ks_now = sorted(cache)
3377
+ k_best = max(ks_now, key=lambda k: cache[k])
3378
+ if k_best == ks_now[-1] and k_best < k_limit:
3379
+ score(k_best + 1)
3380
+ elif k_best == ks_now[0] and k_best > -k_limit:
3381
+ score(k_best - 1)
3382
+ else:
3383
+ break
3384
+ ks = sorted(cache)
3385
+ scores = [cache[k] for k in ks]
3358
3386
  info = {"ambiguity_px": float(ambiguity_px), "k": int(k_best),
3359
- "coherence_scan": [round(float(v), 5) for v in scores],
3360
- "at_scan_edge": best in (0, len(ks) - 1)}
3387
+ "coherence_scan": {int(k): round(float(cache[k]), 5) for k in ks},
3388
+ "at_scan_edge": abs(k_best) >= k_limit}
3361
3389
  logger.info("ESD ambiguity scan (coherence for k = %d..%d ambiguities of %.4f px): %s -> k = %+d",
3362
3390
  ks[0], ks[-1], ambiguity_px, ", ".join(f"{v:.4f}" for v in scores), k_best)
3363
3391
  if info["at_scan_edge"]:
3364
- logger.warning("ESD ambiguity scan peaks at the edge of the scan (k = %+d): the first-stage "
3365
- "coregistration is off by more than %d ambiguities", k_best, k_max)
3392
+ logger.warning("ESD ambiguity scan peaks at its limit (k = %+d): the first-stage coregistration is off "
3393
+ "by more than %d ambiguities", k_best, k_limit)
3366
3394
  if k_best != 0:
3367
3395
  sec_complex = self._apply_azimuth_shift(sec_complex, k_best * ambiguity_px)
3368
3396
  return sec_complex, info
pygeofetch/meta.yaml CHANGED
@@ -1,4 +1,4 @@
1
- {% set version = "2.7.0.3.4" %}
1
+ {% set version = "2.7.0.4.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.3
3
+ Version: 2.7.0.4
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.3.1},
374
+ version = {2.7.0.4.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=Fem0OJ0xQQGtpm5lEITEzBDmRdylNC2V8qnN41bRblc,2107
2
- pygeofetch/meta.yaml,sha256=24phHRh8swIoZ3adMfJMmQYndJ_MOLDIz8ZAzJT8JaA,1284
1
+ pygeofetch/__init__.py,sha256=PWgaPdphhZB3iQq6he8iWgqrwfK-CizJXSBJzh94xpQ,2107
2
+ pygeofetch/meta.yaml,sha256=UgcwTzv2cO9lxfHHelmZv7gaYQx3ptNyL4w8lGYzEmU,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=UQb_l3oOhxR_Dy-f1Uc3YoqlzFz6SPCTz89EiuKn-U0,178492
58
+ pygeofetch/insar/interferogram.py,sha256=NcqtSp7qu9Gf38wjr9d7qWTrKX1IM1Lz3q9sZQp7hCY,180215
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,15 +170,21 @@ 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.3.dist-info/licenses/LICENSE,sha256=zavMyhODD6NvZTmmKFEtATrngwY4CU_NEtY7lhjxGnI,1075
173
+ pygeofetch-2.7.0.4.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
177
177
  pygeofetch_tops_fix_part4/files/tests/insar/_fake_safe.py,sha256=-ntqxg2Ln-8ZHxC3Waq1qTbVNAj5Iwj40Bc49Q9kD_A,3356
178
178
  pygeofetch_tops_fix_part4/files/tests/insar/_tops_sim.py,sha256=t6-ahcc9unf2aLqFTmdMWMeN9gGgU7bFG2ddWS5ZVzY,4776
179
179
  pygeofetch_tops_fix_part4/files/tests/insar/test_tops_deramp.py,sha256=oqiRB6__-jhcG56D3ATMGiVhoiIpooFQA6UsRGC8A2k,9355
180
- pygeofetch-2.7.0.3.dist-info/METADATA,sha256=yGKULRvSIcheQvJbHh-tSWE_8GAKKAX-XzSR4uBjAvc,25014
181
- pygeofetch-2.7.0.3.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
182
- pygeofetch-2.7.0.3.dist-info/entry_points.txt,sha256=dHiUXLF5xNJ8vgtXZoUQNleEMQUeDPZiKQOE1tW8SDY,55
183
- pygeofetch-2.7.0.3.dist-info/top_level.txt,sha256=zTWa3p-2jFCZxSdZz4QmEuGaRK4oVksDIRi63lz5tOo,37
184
- pygeofetch-2.7.0.3.dist-info/RECORD,,
180
+ pygeofetch_tops_fix_part5/files/pygeofetch/insar/coregister.py,sha256=bmM4tcAZiMDaqqwiPFyrGUFTJm_u5oDbOni6jOzPa0Q,74225
181
+ pygeofetch_tops_fix_part5/files/pygeofetch/insar/interferogram.py,sha256=NcqtSp7qu9Gf38wjr9d7qWTrKX1IM1Lz3q9sZQp7hCY,180215
182
+ pygeofetch_tops_fix_part5/files/pygeofetch/insar/tops.py,sha256=-yIthiWED20u7t10m8M3AHEBaa8PDS_rvS-oDnYevgM,18459
183
+ pygeofetch_tops_fix_part5/files/tests/insar/_fake_safe.py,sha256=-ntqxg2Ln-8ZHxC3Waq1qTbVNAj5Iwj40Bc49Q9kD_A,3356
184
+ pygeofetch_tops_fix_part5/files/tests/insar/_tops_sim.py,sha256=t6-ahcc9unf2aLqFTmdMWMeN9gGgU7bFG2ddWS5ZVzY,4776
185
+ pygeofetch_tops_fix_part5/files/tests/insar/test_tops_deramp.py,sha256=o5rv3Zd5cqogO_RZRkmmaKqx7W9PvkIBWBLYcNz3oR8,9358
186
+ pygeofetch-2.7.0.4.dist-info/METADATA,sha256=vN38qz7JsgERW2mDxG9u8Rxs821tFhMDQPXvlLFVM9Q,25014
187
+ pygeofetch-2.7.0.4.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
188
+ pygeofetch-2.7.0.4.dist-info/entry_points.txt,sha256=dHiUXLF5xNJ8vgtXZoUQNleEMQUeDPZiKQOE1tW8SDY,55
189
+ pygeofetch-2.7.0.4.dist-info/top_level.txt,sha256=S1tdXb-n2dy3gOtW1MRr5ZhE-Cj2BWpddP-tZLZ16kE,63
190
+ pygeofetch-2.7.0.4.dist-info/RECORD,,
@@ -1,2 +1,3 @@
1
1
  pygeofetch
2
2
  pygeofetch_tops_fix_part4
3
+ pygeofetch_tops_fix_part5