Skip to content

Commit

Permalink
handle opera platform
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewPlayer3 committed Jan 28, 2025
1 parent 86648c8 commit a4cd8d2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
24 changes: 15 additions & 9 deletions src/hyp3_autorift/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,16 @@ def get_datetime(scene_name):

def get_platform(scene: str) -> str:
if 'BURST' in scene:
return 'GS1'
if scene.startswith('S1') or scene.startswith('S2'):
return 'S1-BURST'
if 'OPERA' in scene:
return 'S1-OPERA'
if scene.startswith('S1'):
return 'S1-SLC'
if scene.startswith('S2'):
return scene[0:2]
elif scene.startswith('L') and scene[3] in ('4', '5', '7', '8', '9'):
if scene.startswith('L') and scene[3] in ('4', '5', '7', '8', '9'):
return scene[0] + scene[3]
else:
raise NotImplementedError(f'autoRIFT processing not available for this platform. {scene}')
raise NotImplementedError(f'autoRIFT processing not available for this platform. {scene}')


def create_filtered_filepath(path: str) -> str:
Expand Down Expand Up @@ -362,12 +365,15 @@ def process(

platform = get_platform(reference)

if platform == 'S1':
from hyp3_autorift.s1_isce3 import process_sentinel1_with_isce3_slc
netcdf_file = process_sentinel1_with_isce3_slc(reference, secondary)
elif platform == 'GS1':
if platform == 'S1-SLC':
from hyp3_autorift.s1_isce3 import process_sentinel1_slc_isce3
netcdf_file = process_sentinel1_slc_isce3(reference, secondary)
elif platform == 'S1-BURST':
from hyp3_autorift.s1_isce3 import process_sentinel1_burst_isce3
netcdf_file = process_sentinel1_burst_isce3(reference, secondary)
elif platform == 'S1-OPERA':
from hyp3_autorift.s1_isce3 import process_sentinel1_burst_isce3
netcdf_file = process_sentinel1_burst_isce3(reference, secondary, is_opera=True)
else:
# Set config and env for new CXX threads in Geogrid/autoRIFT
gdal.SetConfigOption('GDAL_DISABLE_READDIR_ON_OPEN', 'EMPTY_DIR')
Expand Down
6 changes: 3 additions & 3 deletions src/hyp3_autorift/s1_isce3.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def process_burst_radar(
return netcdf_file


def process_sentinel1_burst_isce3(burst_granule_ref, burst_granule_sec, do_geocode=False):
def process_sentinel1_burst_isce3(burst_granule_ref, burst_granule_sec, is_opera=False):
esa_username, esa_password = get_esa_credentials()
esa_credentials = (esa_username, esa_password)

Expand All @@ -131,7 +131,7 @@ def process_sentinel1_burst_isce3(burst_granule_ref, burst_granule_sec, do_geoco

get_dem_for_safes(safe_ref, safe_sec)

if do_geocode:
if is_opera:
burst_id_ref = get_burst_ids(safe_ref, orbit_ref)
burst_id_sec = get_burst_ids(safe_sec, orbit_sec)
# Use geographic CRS
Expand Down Expand Up @@ -177,7 +177,7 @@ def prepare_slcs(slc_ref, slc_sec):
return safe_ref, orbit_ref, safe_sec, orbit_sec


def process_sentinel1_with_isce3_slc(slc_ref, slc_sec):
def process_sentinel1_slc_isce3(slc_ref, slc_sec):
safe_ref, orbit_ref, safe_sec, orbit_sec = prepare_slcs(slc_ref, slc_sec)
get_dem_for_safes(safe_ref, safe_sec)

Expand Down

0 comments on commit a4cd8d2

Please sign in to comment.