Skip to content

Commit

Permalink
remove opera support
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewPlayer3 committed Jan 28, 2025
1 parent a4cd8d2 commit ab7facd
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 85 deletions.
5 changes: 0 additions & 5 deletions src/hyp3_autorift/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,6 @@ def get_datetime(scene_name):
def get_platform(scene: str) -> str:
if 'BURST' in scene:
return 'S1-BURST'
if 'OPERA' in scene:
return 'S1-OPERA'
if scene.startswith('S1'):
return 'S1-SLC'
if scene.startswith('S2'):
Expand Down Expand Up @@ -371,9 +369,6 @@ def process(
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
112 changes: 32 additions & 80 deletions src/hyp3_autorift/s1_isce3.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,50 +32,7 @@
ESA_HOST = 'dataspace.copernicus.eu'


def get_granule_name(safe_name):
return os.path.basename(safe_name).split('.')[0]


def process_burst_geo(
safe_ref,
safe_sec,
orbit_ref,
orbit_sec,
granule_ref,
granule_sec,
burst_id_ref,
burst_id_sec
):
write_yaml(safe_ref, orbit_ref, burst_id_ref)
run_rtc()
ref = correct_geocode_slc(safe_ref, granule_ref, orbit_ref)
remove_temp_files(only_rtc=True)

write_yaml(safe_sec, orbit_sec, burst_id_sec)
run_rtc()
sec = correct_geocode_slc(safe_sec, granule_sec, orbit_sec)

remove_temp_files()

bbox = process.get_raster_bbox(ref)
y_limits = (bbox[1], bbox[3])
x_limits = (bbox[0], bbox[2])

scene_poly = geometry.polygon_from_bbox(x_limits, y_limits)
parameter_info = utils.find_jpl_parameter_info(scene_poly, parameter_file=DEFAULT_PARAMETER_FILE)

meta_r, meta_s = coregisterLoadMetadata(ref, sec)

geogrid_info = runGeogrid(meta_r, meta_s, epsg=parameter_info['epsg'], **parameter_info['geogrid'])

generateAutoriftProduct(
ref, sec, nc_sensor='GS1', optical_flag=True, ncname=None,
geogrid_run_info=geogrid_info, **parameter_info['autorift'],
parameter_file=DEFAULT_PARAMETER_FILE.replace('/vsicurl/', ''),
)


def process_burst_radar(
def process_burst(
safe_ref,
safe_sec,
orbit_ref,
Expand Down Expand Up @@ -128,39 +85,23 @@ def process_sentinel1_burst_isce3(burst_granule_ref, burst_granule_sec, is_opera
safe_granule_sec = os.path.basename(safe_sec).split('.')[0]
orbit_ref, _ = downloadSentinelOrbitFile(safe_granule_ref, esa_credentials=esa_credentials)
orbit_sec, _ = downloadSentinelOrbitFile(safe_granule_sec, esa_credentials=esa_credentials)
burst_id_ref = get_burst_id(safe_ref, burst_granule_ref, orbit_ref)
burst_id_sec = get_burst_id(safe_sec, burst_granule_sec, orbit_sec)

get_dem_for_safes(safe_ref, safe_sec)

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
return process_burst_geo(
safe_ref,
safe_sec,
orbit_ref,
orbit_sec,
burst_granule_ref,
burst_granule_sec,
burst_id_ref,
burst_id_sec
)
else:
burst_id_ref = get_burst_id(safe_ref, burst_granule_ref, orbit_ref)
burst_id_sec = get_burst_id(safe_sec, burst_granule_sec, orbit_sec)
# Use radar geometry
return process_burst_radar(
safe_ref,
safe_sec,
orbit_ref,
orbit_sec,
burst_granule_ref,
burst_id_ref,
burst_id_sec
)
return process_burst(
safe_ref,
safe_sec,
orbit_ref,
orbit_sec,
burst_granule_ref,
burst_id_ref,
burst_id_sec
)


def prepare_slcs(slc_ref, slc_sec):
def process_sentinel1_slc_isce3(slc_ref, slc_sec):
esa_username, esa_password = get_esa_credentials()
esa_credentials = (esa_username, esa_password)

Expand All @@ -170,20 +111,31 @@ def prepare_slcs(slc_ref, slc_sec):

safe_ref = sorted(glob.glob('./*.zip'))[0]
safe_sec = sorted(glob.glob('./*.zip'))[1]

orbit_ref, _ = downloadSentinelOrbitFile(slc_ref, esa_credentials=esa_credentials)
orbit_sec, _ = downloadSentinelOrbitFile(slc_sec, esa_credentials=esa_credentials)
burst_ids_ref = get_burst_ids(safe_ref, orbit_ref)
burst_ids_sec = get_burst_ids(safe_sec, orbit_sec)

return safe_ref, orbit_ref, safe_sec, orbit_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)

burst_ids_ref = get_burst_ids(safe_ref, orbit_ref)
burst_ids_sec = get_burst_ids(safe_sec, orbit_sec)
return process_slc(
safe_ref,
safe_sec,
orbit_ref,
orbit_sec,
burst_ids_ref,
burst_ids_sec
)


def process_slc(
safe_ref,
safe_sec,
orbit_ref,
orbit_sec,
burst_ids_ref,
burst_ids_sec
):
write_yaml_radar(safe_ref, orbit_ref)
s1_cslc.run('s1_cslc.yaml', 'radar')
print('Bursts ref', burst_ids_ref)
Expand Down

0 comments on commit ab7facd

Please sign in to comment.