8
8
9
9
import h5py
10
10
import journal
11
+ import pathlib
11
12
import pybind_isce3 as isce3
12
13
from pybind_nisar .products .readers import SLC
13
14
from pybind_nisar .workflows import h5_prep
@@ -34,6 +35,7 @@ def run(cfg, runw_hdf5, output_hdf5):
34
35
rg_looks = cfg ["processing" ]["crossmul" ]["range_looks" ]
35
36
interp_method = cfg ["processing" ]["geocode" ]["interp_method" ]
36
37
gunw_datasets = cfg ["processing" ]["geocode" ]["datasets" ]
38
+ scratch_path = pathlib .Path (cfg ['ProductPathGroup' ]['ScratchPath' ])
37
39
38
40
slc = SLC (hdf5file = ref_hdf5 )
39
41
@@ -67,9 +69,9 @@ def run(cfg, runw_hdf5, output_hdf5):
67
69
for freq in freq_pols .keys ():
68
70
pol_list = freq_pols [freq ]
69
71
70
- radar_grid = slc .getRadarGrid (freq )
72
+ radar_grid_slc = slc .getRadarGrid (freq )
71
73
if az_looks > 1 or rg_looks > 1 :
72
- radar_grid = radar_grid .multilook (az_looks , rg_looks )
74
+ radar_grid_multilook = radar_grid_slc .multilook (az_looks , rg_looks )
73
75
geo_grid = geogrids [freq ]
74
76
geo .geogrid (
75
77
geo_grid .start_x ,
@@ -80,24 +82,39 @@ def run(cfg, runw_hdf5, output_hdf5):
80
82
geo_grid .length ,
81
83
geo_grid .epsg ,
82
84
)
85
+ src_freq_path = f"/science/LSAR/RUNW/swaths/frequency{ freq } /interferogram"
86
+ dst_freq_path = f"/science/LSAR/GUNW/grids/frequency{ freq } /interferogram"
83
87
84
88
for pol in pol_list :
85
- src_group_path = f"/science/LSAR/RUNW/swaths/frequency { freq } /interferogram /{ pol } "
86
- dst_group_path = f"/science/LSAR/GUNW/grids/frequency { freq } /interferogram /{ pol } "
89
+ src_group_path = f"{ src_freq_path } /{ pol } "
90
+ dst_group_path = f"{ dst_freq_path } /{ pol } "
87
91
88
92
# iterate over key: dataset name value: bool flag to perform geocode
89
93
for dataset_name , geocode_this_dataset in gunw_datasets .items ():
90
94
if not geocode_this_dataset :
91
95
continue
92
96
93
- # prepare input raster
94
- input_raster_str = (
95
- f"HDF5:{ runw_hdf5 } :/{ src_group_path } /{ dataset_name } "
96
- )
97
- input_raster = isce3 .io .Raster (input_raster_str )
97
+ if (dataset_name == "layoverShadowMask" ):
98
+ # prepare input raster
99
+ raster_ref = scratch_path / 'rdr2geo' / f'freq{ freq } ' / 'mask.rdr'
100
+ input_raster = isce3 .io .Raster (str (raster_ref ))
101
+
102
+ # access the HDF5 dataset for layover shadow mask
103
+ dataset_path = f"{ dst_freq_path } /{ dataset_name } "
104
+ geo .data_interpolator = 'NEAREST'
105
+ radar_grid = radar_grid_slc
106
+ else :
107
+ # prepare input raster
108
+ input_raster_str = (
109
+ f"HDF5:{ runw_hdf5 } :/{ src_group_path } /{ dataset_name } "
110
+ )
111
+ input_raster = isce3 .io .Raster (input_raster_str )
112
+
113
+ # access the HDF5 dataset for a given frequency and pol
114
+ geo .data_interpolator = interp_method
115
+ radar_grid = radar_grid_multilook
116
+ dataset_path = f"{ dst_group_path } /{ dataset_name } "
98
117
99
- # access the HDF5 dataset for a given frequency and pol
100
- dataset_path = f"{ dst_group_path } /{ dataset_name } "
101
118
geocoded_dataset = dst_h5 [dataset_path ]
102
119
103
120
# Construct the output ratster directly from HDF5 dataset
0 commit comments