Skip to content

Commit c97a3a1

Browse files
committed
Hack: always project GeocodedFile to EPSG:4326
Rest of the code is not properly set up to handle GeocodedFile AOIs that are not in EPSG:4326, which causes problems with EPSG:32617 interferograms from ASF On Demand. I personally lack the time to fix this properly, but I did end up doing this much so that RAiDER would work with my code for the gemlab ASF On Demand notebook Maurer-GEMLab/gemlab#11. In the case when the user inputs a geocoded file with projection other than EPSG:4326, this change fixes a crash, at the cost of probably more projection conversion artifacts than necessary from a more in-depth solution. In all other cases (other projections, other input AOI types), nothing is changed/affected.
1 parent 64b57ac commit c97a3a1

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

tools/RAiDER/llreader.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import pyproj
1515
import xarray as xr
1616

17+
from RAiDER.utilFcns import transform_bbox
18+
1719

1820
try:
1921
import pandas as pd
@@ -330,14 +332,11 @@ def __init__(self, path: Path, is_dem=False, cube_spacing_in_m: Optional[float]=
330332

331333
self._filename = path
332334
self.p = rio_profile(path)
333-
self._bounding_box = rio_extents(self.p)
335+
self._bounding_box = transform_bbox(rio_extents(self.p), dest_crs=4326, src_crs=32617)
334336
self._is_dem = is_dem
335337
_, self._proj, self._geotransform = rio_stats(path)
336338
self._type = 'geocoded_file'
337-
try:
338-
self.crs = self.p['crs']
339-
except KeyError:
340-
self.crs = None
339+
self.crs = CRS.from_epsg(4326)
341340

342341
def readLL(self) -> tuple[np.ndarray, np.ndarray]:
343342
# ll_bounds are SNWE

tools/RAiDER/utilFcns.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import pathlib
55
import re
66
from pathlib import Path
7-
from typing import Any, Optional, Union, cast
7+
from typing import TYPE_CHECKING, Any, Optional, Union, cast
88

99
import numpy as np
1010
import numpy.typing as npt
@@ -20,11 +20,15 @@
2020
from RAiDER.constants import _THRESHOLD_SECONDS
2121
from RAiDER.constants import _g0 as G0
2222
from RAiDER.constants import _g1 as G1
23-
from RAiDER.llreader import AOI
2423
from RAiDER.logger import logger
2524
from RAiDER.types import BB, RIO, CRSLike, FloatArray2D, FloatArray3D
2625

2726

27+
# Only used for type annotations
28+
if TYPE_CHECKING:
29+
from RAiDER.llreader import AOI
30+
31+
2832
# Optional imports
2933
try:
3034
import pandas as pd
@@ -420,7 +424,7 @@ def round_time(datetime: dt.datetime, roundTo: int=60) -> dt.datetime:
420424

421425

422426
def writeDelays(
423-
aoi: AOI, #: AOI,
427+
aoi: 'AOI',
424428
wetDelay: ndarray,
425429
hydroDelay: ndarray,
426430
wet_path: Path,

0 commit comments

Comments
 (0)