Skip to content

Commit 5b1a350

Browse files
gshiromaLiang Yu
authored andcommitted
Expose interpolation options to GCOV SAS (#743)
* add interp options to GCOV runconfig YAMLs and to GCOV SAS * add algorithms/demInterpolation dataset to GCOV products * update convertion of the DEM interp method string to enum * update convertion of the DEM interp method string to enum (2) * move enum declaration of Geocoding parameters from gcov.py to gcov_runconfig.py; move the setting of geocoding HDF5 parameters to h5_prep.py * move enum declaration of Geocoding parameters from gcov.py to gcov_runconfig.py; move the setting of geocoding HDF5 parameters to h5_prep.py (2) * Update python/packages/pybind_nisar/workflows/h5_prep.py Co-Authored-By: Liang Yu <[email protected]> * Update python/packages/pybind_nisar/workflows/gcov_runconfig.py Co-Authored-By: Liang Yu <[email protected]> * Update python/packages/pybind_nisar/workflows/h5_prep.py (2) Co-authored-by: Liang Yu <[email protected]>
1 parent b65ea63 commit 5b1a350

File tree

5 files changed

+62
-7
lines changed

5 files changed

+62
-7
lines changed

python/packages/pybind_nisar/workflows/gcov.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,15 @@ def run(cfg):
3636
radar_grid_cubes_geogrid = cfg['processing']['radar_grid_cubes']['geogrid']
3737
radar_grid_cubes_heights = cfg['processing']['radar_grid_cubes']['heights']
3838

39+
# DEM parameters
3940
dem_file = cfg['DynamicAncillaryFileGroup']['DEMFile']
4041
dem_margin = cfg['processing']['dem_margin']
42+
dem_interp_method_enum = cfg['processing']['dem_interpolation_method_enum']
4143

4244
# unpack geocode run parameters
4345
geocode_dict = cfg['processing']['geocode']
44-
output_mode = geocode_dict['algorithm_type']
46+
geocode_algorithm = geocode_dict['algorithm_type']
47+
output_mode = geocode_dict['output_mode']
4548
flag_apply_rtc = geocode_dict['apply_rtc']
4649
memory_mode = geocode_dict['memory_mode']
4750
geogrid_upsampling = geocode_dict['geogrid_upsampling']
@@ -155,6 +158,10 @@ def run(cfg):
155158
geo.numiter_geo2rdr = maxiter
156159
geo.dem_block_margin = dem_margin
157160

161+
# set data interpolator based on the geocode algorithm
162+
if output_mode == isce3.geocode.GeocodeOutputMode.INTERP:
163+
geo.data_interpolator = geocode_algorithm
164+
158165
geo.geogrid(geogrid.start_x, geogrid.start_y,
159166
geogrid.spacing_x, geogrid.spacing_y,
160167
geogrid.width, geogrid.length, geogrid.epsg)
@@ -247,6 +254,7 @@ def run(cfg):
247254
out_geo_dem=out_geo_dem_obj,
248255
input_rtc=None,
249256
output_rtc=None,
257+
dem_interp_method=dem_interp_method_enum,
250258
memory_mode=memory_mode)
251259

252260
del output_raster_obj

python/packages/pybind_nisar/workflows/gcov_runconfig.py

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,13 @@ def load(self):
4949
else:
5050
rtc_dict['output_type'] = isce.geometry.RtcOutputTerrainRadiometry.GAMMA_NAUGHT
5151

52-
if geocode_dict['algorithm_type'] == 'interp':
53-
geocode_dict['algorithm_type'] = isce.geocode.GeocodeOutputMode.INTERP
52+
53+
geocode_algorithm = self.cfg['processing']['geocode']['algorithm_type']
54+
if geocode_algorithm == "area_projection":
55+
output_mode = isce.geocode.GeocodeOutputMode.AREA_PROJECTION
5456
else:
55-
geocode_dict['algorithm_type'] = isce.geocode.GeocodeOutputMode.AREA_PROJECTION
57+
output_mode = isce.geocode.GeocodeOutputMode.INTERP
58+
geocode_dict['output_mode'] = output_mode
5659

5760
# only 2 RTC algorithms supported: area_projection (default) & bilinear_distribution
5861
if rtc_dict['algorithm_type'] == "bilinear_distribution":
@@ -77,3 +80,25 @@ def load(self):
7780
dem_raster = isce.io.Raster(dem_file)
7881
dem_margin = 50 * max([dem_raster.dx, dem_raster.dy])
7982
self.cfg['processing']['dem_margin'] = dem_margin
83+
84+
# Update the DEM interpolation method
85+
dem_interp_method = \
86+
self.cfg['processing']['dem_interpolation_method']
87+
88+
if dem_interp_method == 'biquintic':
89+
dem_interp_method_enum = isce.core.DataInterpMethod.BIQUINTIC
90+
elif (dem_interp_method == 'sinc'):
91+
dem_interp_method_enum = isce.core.DataInterpMethod.SINC
92+
elif (dem_interp_method == 'bilinear'):
93+
dem_interp_method_enum = isce.core.DataInterpMethod.BILINEAR
94+
elif (dem_interp_method == 'bicubic'):
95+
dem_interp_method_enum = isce.core.DataInterpMethod.BICUBIC
96+
elif (dem_interp_method == 'nearest'):
97+
dem_interp_method_enum = isce.core.DataInterpMethod.NEAREST
98+
else:
99+
err_msg = ('ERROR invalid DEM interpolation method:'
100+
f' {dem_interp_method}')
101+
raise ValueError(err_msg)
102+
103+
self.cfg['processing']['dem_interpolation_method_enum'] = \
104+
dem_interp_method_enum

python/packages/pybind_nisar/workflows/h5_prep.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,13 @@ def cp_geocode_meta(cfg, output_hdf5, dst):
9393
if is_insar:
9494
secondary_hdf5 = cfg['InputFileGroup']['SecondaryFilePath']
9595

96+
if dst == "GCOV":
97+
dem_interp_method = cfg['processing']['dem_interpolation_method']
98+
geocode_algorithm = cfg['processing']['geocode']['algorithm_type']
99+
else:
100+
dem_interp_method = None
101+
geocode_algorithm = None
102+
96103
# Remove existing HDF5 and start from scratch
97104
try:
98105
os.remove(output_hdf5)
@@ -160,6 +167,17 @@ def cp_geocode_meta(cfg, output_hdf5, dst):
160167
f'{src_meta_path}/processingInformation/algorithms',
161168
f'{dst_meta_path}/processingInformation/algorithms')
162169

170+
if dst == "GCOV":
171+
algorithms_ds = (dst_meta_path +
172+
'processingInformation/algorithms/geocoding')
173+
dst_h5.require_dataset(algorithms_ds, (), "S27",
174+
data=np.string_(geocode_algorithm))
175+
176+
algorithms_ds = (dst_meta_path +
177+
'processingInformation/algorithms/demInterpolation')
178+
dst_h5.require_dataset(algorithms_ds, (), "S27",
179+
data=np.string_(dem_interp_method))
180+
163181
# copy processingInformation/inputs group
164182
exclude_args = ['l0bGranules', 'demFiles']
165183
if not is_geocoded:

share/nisar/defaults/gcov.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ runconfig:
206206

207207
dem_margin:
208208

209+
dem_interpolation_method: biquintic
210+
209211
# OPTIONAL - if noise correction desired (for ISRO)
210212
noise_correction:
211213
# OPTIONAL -

share/nisar/schemas/gcov.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,12 @@ runconfig:
7979

8080
# Mechanism to specify output posting and DEM
8181
geocode:
82-
algorithm_type: enum('area_projection', 'interp', required=False)
82+
algorithm_type: enum('area_projection', 'sinc', 'bilinear', 'bicubic', 'nearest', 'biquintic', required=False)
8383

8484
# Apply RTC
8585
apply_rtc: bool(required=False)
8686

87-
memory_mode: enum('auto', 'single_block', 'BLOCKS_GEOGRID', 'BLOCKS_GEOGRID_AND_RADARGRID', required=False)
87+
memory_mode: enum('auto', 'single_block', 'blocks_geogrid', 'blocks_geogrid_and_radargrid', required=False)
8888

8989
# Processing upsampling factor on top of the input geogrid
9090
geogrid_upsampling: int(required=False)
@@ -149,7 +149,9 @@ runconfig:
149149
geo2rdr: include('geo2rdr_options', required=False)
150150

151151
dem_margin: num(required=False)
152-
152+
153+
dem_interpolation_method: enum('sinc', 'bilinear', 'bicubic', 'nearest', 'biquintic', required=False)
154+
153155
# If noise correction desired (for ISRO)
154156
noise_correction:
155157
apply_correction: bool(required=False)

0 commit comments

Comments
 (0)