Skip to content

Commit

Permalink
insar_roi is now the corner of the burst
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewPlayer3 committed Dec 20, 2023
1 parent 6cf9ad1 commit 1a15579
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
13 changes: 7 additions & 6 deletions src/hyp3_isce2/burst.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class BurstParams:
swath: str
polarization: str
burst_number: int
extent: List[int]


class BurstMetadata:
Expand Down Expand Up @@ -248,7 +249,7 @@ def get_isce2_burst_bbox(params: BurstParams, base_dir: Optional[Path] = None) -


def get_region_of_interest(
ref_bbox: geometry.Polygon, sec_bbox: geometry.Polygon, is_ascending: bool = True
ref_extent: geometry.Polygon, sec_extent: geometry.Polygon, is_ascending: bool = True
) -> Tuple[float]:
"""Get the region of interest for two bursts that will lead to single burst ISCE2 processing.
Expand All @@ -263,11 +264,10 @@ def get_region_of_interest(
Returns:
The region of interest as a tuple of (minx, miny, maxx, maxy).
"""
intersection = ref_bbox.intersection(sec_bbox)
bounds = intersection.bounds

x, y = (0, 1) if is_ascending else (2, 1)
roi = geometry.Point(bounds[x], bounds[y]).buffer(0.005)
intersection = ref_extent.intersection(sec_extent)
exterior_coords = intersection.exterior.coords[:]
idx = 5 if is_ascending else 3
roi = geometry.Point(exterior_coords[idx]).buffer(0.005)
return roi.bounds


Expand Down Expand Up @@ -379,6 +379,7 @@ def get_burst_params(scene_name: str) -> BurstParams:
swath=results[0].properties['burst']['subswath'],
polarization=results[0].properties['polarization'],
burst_number=results[0].properties['burst']['burstIndex'],
extent=results[0].geometry['coordinates'][0]
)


Expand Down
5 changes: 4 additions & 1 deletion src/hyp3_isce2/insar_tops_burst.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from lxml import etree
from osgeo import gdal
from pyproj import CRS
from shapely.geometry import Polygon

import hyp3_isce2
import hyp3_isce2.metadata.util
Expand Down Expand Up @@ -92,8 +93,10 @@ def insar_tops_burst(
is_ascending = ref_metadata.orbit_direction == 'ascending'
ref_footprint = get_isce2_burst_bbox(ref_params)
sec_footprint = get_isce2_burst_bbox(sec_params)
ref_extent = Polygon(ref_params.extent)
sec_extent = Polygon(sec_params.extent)

insar_roi = get_region_of_interest(ref_footprint, sec_footprint, is_ascending=is_ascending)
insar_roi = get_region_of_interest(ref_extent, sec_extent, is_ascending=is_ascending)
dem_roi = ref_footprint.intersection(sec_footprint).bounds
log.info(f'InSAR ROI: {insar_roi}')
log.info(f'DEM ROI: {dem_roi}')
Expand Down

0 comments on commit 1a15579

Please sign in to comment.