21
21
from nisar .workflows .yaml_argparse import YamlArgparse
22
22
from nisar .workflows .compute_stats import compute_stats_real_data
23
23
24
-
25
24
def run (cfg , runw_hdf5 , output_hdf5 ):
26
25
""" Run geocode insar on user specified hardware
27
26
@@ -73,7 +72,8 @@ def get_shadow_input_output(scratch_path, freq, dst_freq_path):
73
72
return input_raster , dataset_path
74
73
75
74
76
- def get_ds_input_output (src_freq_path , dst_freq_path , pol , runw_hdf5 , dataset_name ):
75
+ def get_ds_input_output (src_freq_path , dst_freq_path , pol , runw_hdf5 ,
76
+ dataset_name ):
77
77
""" Create input raster object and output dataset path for datasets outside
78
78
79
79
Parameters
@@ -96,6 +96,7 @@ def get_ds_input_output(src_freq_path, dst_freq_path, pol, runw_hdf5, dataset_na
96
96
dataset_path : str
97
97
HDF5 path to geocoded shadow layover dataset
98
98
"""
99
+
99
100
if dataset_name in ['alongTrackOffset' , 'slantRangeOffset' ]:
100
101
src_group_path = f'{ src_freq_path } /pixelOffsets/{ pol } '
101
102
dst_group_path = f'{ dst_freq_path } /pixelOffsets/{ pol } '
@@ -215,6 +216,11 @@ def add_radar_grid_cube(cfg, freq, radar_grid, orbit, dst_h5):
215
216
grid_zero_doppler , threshold_geo2rdr ,
216
217
iteration_geo2rdr )
217
218
219
+ def _snake_to_camel_case (snake_case_str ):
220
+ splitted_snake_case_str = snake_case_str .split ('_' )
221
+ return (splitted_snake_case_str [0 ] +
222
+ '' .join (w .title () for w in splitted_snake_case_str [1 :]))
223
+
218
224
def get_raster_lists (gunw_datasets , desired , freq , pol_list , runw_hdf5 , dst_h5 ,
219
225
scratch_path = '' ):
220
226
'''
@@ -257,13 +263,14 @@ def get_raster_lists(gunw_datasets, desired, freq, pol_list, runw_hdf5, dst_h5,
257
263
if skip_layover_shadow :
258
264
continue
259
265
260
- if ds_name == "layoverShadowMask " :
266
+ if ds_name == "layover_shadow_mask " :
261
267
input_raster , out_ds_path = get_shadow_input_output (
262
268
scratch_path , freq , dst_freq_path )
263
269
skip_layover_shadow = True
264
270
else :
271
+ ds_name_camel_case = _snake_to_camel_case (ds_name )
265
272
input_raster , out_ds_path = get_ds_input_output (
266
- src_freq_path , dst_freq_path , pol , runw_hdf5 , ds_name )
273
+ src_freq_path , dst_freq_path , pol , runw_hdf5 , ds_name_camel_case )
267
274
268
275
input_rasters .append (input_raster )
269
276
@@ -383,25 +390,25 @@ def cpu_run(cfg, runw_hdf5, output_hdf5):
383
390
else :
384
391
radar_grid = radar_grid_slc
385
392
386
- desired = ['coherenceMagnitude ' , 'unwrappedPhase ' ]
393
+ desired = ['coherence_magnitude ' , 'unwrapped_phase ' ]
387
394
geo .data_interpolator = interp_method
388
395
cpu_geocode_rasters (geo , gunw_datasets , desired , freq , pol_list ,
389
396
runw_hdf5 , dst_h5 , radar_grid , dem_raster )
390
397
391
- desired = ["connectedComponents " ]
398
+ desired = ["connected_components " ]
392
399
geo .data_interpolator = 'NEAREST'
393
400
cpu_geocode_rasters (geo , gunw_datasets , desired , freq , pol_list ,
394
401
runw_hdf5 , dst_h5 , radar_grid , dem_raster )
395
402
396
- desired = ['alongTrackOffset ' , 'slantRangeOffset ' ]
403
+ desired = ['along_track_offset ' , 'slant_range_offset ' ]
397
404
geo .data_interpolator = interp_method
398
405
radar_grid_offset = get_offset_radar_grid (offset_cfg ,
399
406
radar_grid_slc )
400
407
cpu_geocode_rasters (geo , gunw_datasets , desired , freq , pol_list ,
401
408
runw_hdf5 , dst_h5 , radar_grid_offset ,
402
409
dem_raster )
403
410
404
- desired = ["layoverShadowMask " ]
411
+ desired = ["layover_shadow_mask " ]
405
412
geo .data_interpolator = 'NEAREST'
406
413
cpu_geocode_rasters (geo , gunw_datasets , desired , freq , pol_list ,
407
414
runw_hdf5 , dst_h5 , radar_grid_slc , dem_raster ,
@@ -491,7 +498,7 @@ def gpu_run(cfg, runw_hdf5, output_hdf5):
491
498
# Multilook radar grid if needed
492
499
radar_grid = radar_grid .multilook (az_looks , rg_looks )
493
500
494
- desired = ['coherenceMagnitude ' , 'unwrappedPhase ' ]
501
+ desired = ['coherence_magnitude ' , 'unwrapped_phase ' ]
495
502
# Create radar grid geometry used by most datasets
496
503
rdr_geometry = isce3 .container .RadarGeometry (radar_grid ,
497
504
slc .getOrbit (),
@@ -508,9 +515,9 @@ def gpu_run(cfg, runw_hdf5, output_hdf5):
508
515
gpu_geocode_rasters (gunw_datasets , desired , freq , pol_list ,
509
516
runw_hdf5 , dst_h5 , geocode_obj )
510
517
511
- desired = ["connectedComponents " ]
518
+ desired = ["connected_components " ]
512
519
'''
513
- connectedComponents raster has type unsigned char and an invalid
520
+ connected_components raster has type unsigned char and an invalid
514
521
value of NaN becomes 0 which conflicts with 0 being used to indicate
515
522
an unmasked value/pixel. 255 is chosen as it is the most distant
516
523
value from components assigned in ascending order [0, 1, ...)
@@ -525,7 +532,7 @@ def gpu_run(cfg, runw_hdf5, output_hdf5):
525
532
gpu_geocode_rasters (gunw_datasets , desired , freq , pol_list ,
526
533
runw_hdf5 , dst_h5 , geocode_conn_comp_obj )
527
534
528
- desired = ['alongTrackOffset ' , 'slantRangeOffset ' ]
535
+ desired = ['along_track_offset ' , 'slant_range_offset ' ]
529
536
# If needed create geocode object for offset datasets
530
537
# Create offset unique radar grid
531
538
radar_grid = get_offset_radar_grid (offset_cfg ,
@@ -547,7 +554,7 @@ def gpu_run(cfg, runw_hdf5, output_hdf5):
547
554
gpu_geocode_rasters (gunw_datasets , desired , freq , pol_list ,
548
555
runw_hdf5 , dst_h5 , geocode_offset_obj )
549
556
550
- desired = ["layoverShadowMask " ]
557
+ desired = ["layover_shadow_mask " ]
551
558
# If needed create geocode object for shadow layover dataset
552
559
# Create radar grid geometry required by layover shadow
553
560
rdr_geometry = isce3 .container .RadarGeometry (slc .getRadarGrid (freq ),
0 commit comments