Skip to content

Commit d444632

Browse files
gshiromaGitHub Enterprise
authored andcommitted
Add metadata cubes to GSLC and GUNW workflows (#769)
* update GSLC runconfing defaults and schema with the new radar_grid_cubes group * update InSAR runconfing defaults and schema with the new radar_grid_cubes group * remove copy from geolocationGrid to radarGrid * generate radarGrid geogrid when running GSLC and GUNW workflows * update radarGrid cubes for the GCOV workflow * add radarGrid cubes to the GSLC workflow * add radarGrid cubes to the GUNW workflow
1 parent db5a796 commit d444632

File tree

11 files changed

+210
-26
lines changed

11 files changed

+210
-26
lines changed

python/packages/pybind_nisar/workflows/gcov.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,6 @@ def run(cfg):
8989
# init parameters shared between frequencyA and frequencyB sub-bands
9090
slc = SLC(hdf5file=input_hdf5)
9191
dem_raster = isce3.io.Raster(dem_file)
92-
native_doppler = slc.getDopplerCentroid()
93-
'''
94-
bounds error are turned off for the native Doppler because of
95-
some issue when computing geo2rdr() in makeRadarGridCubes().
96-
'''
97-
native_doppler.bounds_error = False
9892
zero_doppler = isce3.core.LUT2d()
9993
epsg = dem_raster.get_epsg()
10094
proj = isce3.core.make_projection(epsg)
@@ -378,7 +372,12 @@ def run(cfg):
378372
epsg=radar_grid_cubes_geogrid.epsg)
379373

380374
cube_group_name = '/science/LSAR/GCOV/metadata/radarGrid'
381-
375+
native_doppler = slc.getDopplerCentroid()
376+
'''
377+
The native-Doppler LUT bounds error is turned off to
378+
computer cubes values outside radar-grid boundaries
379+
'''
380+
native_doppler.bounds_error = False
382381
add_radar_grid_cubes_to_hdf5(hdf5_obj, cube_group_name,
383382
cube_geogrid, radar_grid_cubes_heights,
384383
radar_grid, orbit, native_doppler,

python/packages/pybind_nisar/workflows/geocode_insar.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import pybind_isce3 as isce3
1313
from pybind_nisar.products.readers import SLC
1414
from pybind_nisar.workflows import h5_prep
15+
from pybind_nisar.workflows.h5_prep import add_radar_grid_cubes_to_hdf5
1516
from pybind_nisar.workflows.geocode_insar_runconfig import \
1617
GeocodeInsarRunConfig
1718
from pybind_nisar.workflows.yaml_argparse import YamlArgparse
@@ -26,6 +27,8 @@ def run(cfg, runw_hdf5, output_hdf5):
2627
ref_hdf5 = cfg["InputFileGroup"]["InputFilePath"]
2728
freq_pols = cfg["processing"]["input_subset"]["list_of_frequencies"]
2829
geogrids = cfg["processing"]["geocode"]["geogrids"]
30+
radar_grid_cubes_geogrid = cfg['processing']['radar_grid_cubes']['geogrid']
31+
radar_grid_cubes_heights = cfg['processing']['radar_grid_cubes']['heights']
2932
dem_file = cfg["DynamicAncillaryFileGroup"]["DEMFile"]
3033
threshold_geo2rdr = cfg["processing"]["geo2rdr"]["threshold"]
3134
iteration_geo2rdr = cfg["processing"]["geo2rdr"]["maxiter"]
@@ -55,7 +58,8 @@ def run(cfg, runw_hdf5, output_hdf5):
5558
geo = isce3.geocode.GeocodeFloat32()
5659

5760
# init geocode members
58-
geo.orbit = slc.getOrbit()
61+
orbit = slc.getOrbit()
62+
geo.orbit = orbit
5963
geo.ellipsoid = ellipsoid
6064
geo.doppler = grid_zero_doppler
6165
geo.threshold_geo2rdr = threshold_geo2rdr
@@ -133,6 +137,33 @@ def run(cfg, runw_hdf5, output_hdf5):
133137

134138
del geocoded_raster
135139

140+
if freq.upper() == 'B':
141+
continue
142+
143+
# get doppler centroid
144+
cube_geogrid = isce3.product.GeoGridParameters(
145+
start_x=radar_grid_cubes_geogrid.start_x,
146+
start_y=radar_grid_cubes_geogrid.start_y,
147+
spacing_x=radar_grid_cubes_geogrid.spacing_x,
148+
spacing_y=radar_grid_cubes_geogrid.spacing_y,
149+
width=int(radar_grid_cubes_geogrid.width),
150+
length=int(radar_grid_cubes_geogrid.length),
151+
epsg=radar_grid_cubes_geogrid.epsg)
152+
153+
cube_group_name = '/science/LSAR/GUNW/metadata/radarGrid'
154+
155+
native_doppler = slc.getDopplerCentroid(frequency=freq)
156+
'''
157+
The native-Doppler LUT bounds error is turned off to
158+
computer cubes values outside radar-grid boundaries
159+
'''
160+
native_doppler.bounds_error = False
161+
add_radar_grid_cubes_to_hdf5(dst_h5, cube_group_name,
162+
cube_geogrid, radar_grid_cubes_heights,
163+
radar_grid, orbit, native_doppler,
164+
grid_zero_doppler, threshold_geo2rdr,
165+
iteration_geo2rdr)
166+
136167
t_all_elapsed = time.time() - t_all
137168
info_channel.log(f"Successfully ran geocode in {t_all_elapsed:.3f} seconds")
138169

python/packages/pybind_nisar/workflows/gslc.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import pybind_isce3 as isce3
1010
from pybind_nisar.products.readers import SLC
1111
from pybind_nisar.workflows import h5_prep
12+
from pybind_nisar.workflows.h5_prep import add_radar_grid_cubes_to_hdf5
1213
from pybind_nisar.workflows.yaml_argparse import YamlArgparse
1314
from pybind_nisar.workflows.gslc_runconfig import GSLCRunConfig
1415

@@ -22,6 +23,8 @@ def run(cfg):
2223
output_hdf5 = cfg['ProductPathGroup']['SASOutputFile']
2324
freq_pols = cfg['processing']['input_subset']['list_of_frequencies']
2425
geogrids = cfg['processing']['geocode']['geogrids']
26+
radar_grid_cubes_geogrid = cfg['processing']['radar_grid_cubes']['geogrid']
27+
radar_grid_cubes_heights = cfg['processing']['radar_grid_cubes']['heights']
2528
dem_file = cfg['DynamicAncillaryFileGroup']['DEMFile']
2629
threshold_geo2rdr = cfg['processing']['geo2rdr']['threshold']
2730
iteration_geo2rdr = cfg['processing']['geo2rdr']['maxiter']
@@ -86,6 +89,31 @@ def run(cfg):
8689
t_pol_elapsed = time.time() - t_pol
8790
info_channel.log(f'polarization {polarization} ran in {t_pol_elapsed:.3f} seconds')
8891

92+
if freq.upper() == 'B':
93+
continue
94+
95+
cube_geogrid = isce3.product.GeoGridParameters(
96+
start_x=radar_grid_cubes_geogrid.start_x,
97+
start_y=radar_grid_cubes_geogrid.start_y,
98+
spacing_x=radar_grid_cubes_geogrid.spacing_x,
99+
spacing_y=radar_grid_cubes_geogrid.spacing_y,
100+
width=int(radar_grid_cubes_geogrid.width),
101+
length=int(radar_grid_cubes_geogrid.length),
102+
epsg=radar_grid_cubes_geogrid.epsg)
103+
104+
cube_group_name = '/science/LSAR/GSLC/metadata/radarGrid'
105+
106+
native_doppler.bounds_error = False
107+
'''
108+
The native-Doppler LUT bounds error is turned off to
109+
computer cubes values outside radar-grid boundaries
110+
'''
111+
add_radar_grid_cubes_to_hdf5(dst_h5, cube_group_name,
112+
cube_geogrid, radar_grid_cubes_heights,
113+
radar_grid, orbit, native_doppler,
114+
image_grid_doppler, threshold_geo2rdr,
115+
iteration_geo2rdr)
116+
89117
t_all_elapsed = time.time() - t_all
90118
info_channel.log(f"successfully ran geocode SLC in {t_all_elapsed:.3f} seconds")
91119

python/packages/pybind_nisar/workflows/h5_prep.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -147,20 +147,6 @@ def cp_geocode_meta(cfg, output_hdf5, dst):
147147
if is_geocoded:
148148
cp_h5_meta_data(src_h5, dst_h5, f'{src_meta_path}/attitude',
149149
f'{dst_meta_path}/attitude')
150-
if dst != 'GCOV':
151-
# the lines below should be deleted after radar-grid
152-
# cubes are added to all L2 workflows
153-
yds = dst_h5.create_dataset(f'{dst_meta_path}/radarGrid/yCoordinates',
154-
data = src_h5[f'{src_meta_path}/geolocationGrid/zeroDopplerTime'])
155-
xds = dst_h5.create_dataset(f'{dst_meta_path}/radarGrid/xCoodinates',
156-
data = src_h5[f'{src_meta_path}/geolocationGrid/slantRange'])
157-
cp_h5_meta_data(src_h5, dst_h5,
158-
f'{src_meta_path}/geolocationGrid',
159-
f'{dst_meta_path}/radarGrid',
160-
renames={'coordinateX': 'slantRange',
161-
'coordinateY': 'zeroDopplerAzimuthTime'},
162-
excludes=['slantRange', 'zeroDopplerTime'],
163-
attach_scales_list = [yds, xds])
164150
else:
165151
# RUNW and RIFG have no attitude group and have geolocation grid
166152
yds = dst_h5.create_dataset(f'{dst_meta_path}/geolocationGrid/zeroDopplerTime',

python/packages/pybind_nisar/workflows/runconfig.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,5 +274,4 @@ def geocode_common_arg_load(self):
274274
self.prep_paths()
275275
self.prep_frequency_and_polarizations()
276276
self.prep_geocode_cfg()
277-
if self.workflow_name == 'gcov':
278-
self.prep_cubes_geocode_cfg()
277+
self.prep_cubes_geocode_cfg()

share/nisar/defaults/gcov.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ runconfig:
167167

168168
radar_grid_cubes:
169169

170-
# # List heights in meters
170+
# List of heights in meters
171171
heights:
172172

173173
# OPTIONAL - Same as the geocode group outputEPSG if not provided

share/nisar/defaults/gslc.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,41 @@ runconfig:
111111
y_abs:
112112
x_abs:
113113

114+
radar_grid_cubes:
115+
116+
# List of heights in meters
117+
heights:
118+
119+
# OPTIONAL - Same as the geocode group outputEPSG if not provided
120+
outputEPSG:
121+
122+
# OPTIONAL - Spacing between pixels, in same units as output EPSG.
123+
# If not provided, spacing values will be taken from geocode group
124+
# parameters.
125+
# All postings/spacings must be > 0.
126+
# ISCE3 output rasters always have North-up West-left orientation
127+
output_posting:
128+
x_posting:
129+
y_posting:
130+
131+
# OPTIONAL - To control output grid in same units as output EPSG
132+
y_snap:
133+
134+
# OPTIONAL - To control output grid in same units as output EPSG
135+
x_snap:
136+
137+
# OPTIONAL - Can control with absolute values or with snap values
138+
top_left:
139+
# OPTIONAL - Set top-left y in same units as output EPSG
140+
y_abs:
141+
# OPTIONAL - Set top-left x in same units as output EPSG
142+
x_abs:
143+
144+
# OPTIONAL - Can control with absolute values or with snap values
145+
bottom_right:
146+
y_abs:
147+
x_abs:
148+
114149
geo2rdr:
115150
threshold: 1.0e-8
116151
maxiter: 25

share/nisar/defaults/insar.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,41 @@ runconfig:
103103
y_abs:
104104
x_abs:
105105

106+
radar_grid_cubes:
107+
108+
# List of heights in meters
109+
heights:
110+
111+
# OPTIONAL - Same as the geocode group outputEPSG if not provided
112+
outputEPSG:
113+
114+
# OPTIONAL - Spacing between pixels, in same units as output EPSG.
115+
# If not provided, spacing values will be taken from geocode group
116+
# parameters.
117+
# All postings/spacings must be > 0.
118+
# ISCE3 output rasters always have North-up West-left orientation
119+
output_posting:
120+
x_posting:
121+
y_posting:
122+
123+
# OPTIONAL - To control output grid in same units as output EPSG
124+
y_snap:
125+
126+
# OPTIONAL - To control output grid in same units as output EPSG
127+
x_snap:
128+
129+
# OPTIONAL - Can control with absolute values or with snap values
130+
top_left:
131+
# OPTIONAL - Set top-left y in same units as output EPSG
132+
y_abs:
133+
# OPTIONAL - Set top-left x in same units as output EPSG
134+
x_abs:
135+
136+
# OPTIONAL - Can control with absolute values or with snap values
137+
bottom_right:
138+
y_abs:
139+
x_abs:
140+
106141
geo2rdr:
107142
# No topo_path provided. Default to ScratchPath.
108143
threshold: 1.0e-8

share/nisar/schemas/gcov.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ runconfig:
178178
---
179179
radar_grid_cubes_options:
180180

181-
# List heights in meters
181+
# List of heights in meters
182182
heights: list(num(), required=False)
183183

184184
# Same as input DEM if not provided.

share/nisar/schemas/gslc.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ runconfig:
9898
# Set bottom-right x in same units as output EPSG
9999
x_abs: num(required=False)
100100

101+
radar_grid_cubes: include('radar_grid_cubes_options', required=False)
102+
101103
geo2rdr: include('geo2rdr_options', required=False)
102104

103105
blocksize:
@@ -123,6 +125,40 @@ runconfig:
123125
logging: include('log_nfo', required=False)
124126

125127
---
128+
radar_grid_cubes_options:
129+
130+
# List of heights in meters
131+
heights: list(num(), required=False)
132+
133+
# Same as input DEM if not provided.
134+
outputEPSG: int(min=1024, max=32767, required=False)
135+
136+
# Output posting in same units as output EPSG.
137+
# If not provided, spacing values will be taken from provided DEM.
138+
output_posting:
139+
x_posting: num(min=0, required=False)
140+
y_posting: num(min=0, required=False)
141+
142+
# To control output grid in same units as output EPSG
143+
x_snap: num(min=0, required=False)
144+
145+
# To control output grid in same units as output EPSG
146+
y_snap: num(min=0, required=False)
147+
148+
top_left:
149+
# Set top-left y in same units as output EPSG
150+
y_abs: num(required=False)
151+
152+
# Set top-left x in same units as output EPSG
153+
x_abs: num(required=False)
154+
155+
bottom_right:
156+
# Set bottom-right y in same units as output EPSG
157+
y_abs: num(required=False)
158+
159+
# Set bottom-right x in same units as output EPSG
160+
x_abs: num(required=False)
161+
126162

127163
geo2rdr_options:
128164
threshold: num(min=1.0e-9, max=1.0e-3, required=False)

0 commit comments

Comments
 (0)