@@ -120,7 +120,7 @@ def create_ifg_dict(dest_tifs, params, tiles):
120
120
mpiops .comm .barrier ()
121
121
preread_ifgs = OrderedDict (sorted (cp .load (open (preread_ifgs_file ,
122
122
'rb' )).items ()))
123
- log .info ('finish converting phase_data to numpy '
123
+ log .info ('Finished converting phase_data to numpy '
124
124
'in process {}' .format (mpiops .rank ))
125
125
return preread_ifgs
126
126
@@ -270,14 +270,16 @@ def save_ref_pixel_blocks(grid, half_patch_size, ifg_paths, params):
270
270
271
271
def orb_fit_calc (ifg_paths , params , preread_ifgs = None ):
272
272
"""
273
- Orbital fit correction
273
+ MPI wrapper for orbital fit correction
274
274
275
275
Parameters
276
276
----------
277
277
ifg_paths: list
278
278
list of ifg paths
279
279
params: dict
280
280
parameters dict corresponding to config file
281
+ preread_ifgs: dict, optional
282
+ dict containing information regarding ifgs
281
283
"""
282
284
log .info ('Calculating orbfit correction' )
283
285
@@ -300,15 +302,15 @@ def orb_fit_calc(ifg_paths, params, preread_ifgs=None):
300
302
# Here we do all the multilooking in one process, but in memory
301
303
# can use multiple processes if we write data to disc during
302
304
# remove_orbital_error step
303
- # A performance comparison should be performed be performed for saving
304
- # multilooked files on disc vs in memory single process multilooking
305
+ # A performance comparison should be made for saving multilooked
306
+ # files on disc vs in memory single process multilooking
305
307
if mpiops .rank == MASTER_PROCESS :
306
308
orbital .remove_orbital_error (ifg_paths , params , preread_ifgs )
307
309
mpiops .comm .barrier ()
308
- log .info ('Finished orbfit calculation in process {}' . format ( mpiops . rank ) )
310
+ log .info ('Finished orbfit calculation' )
309
311
310
312
311
- def ref_phase_estimation (ifg_paths , params , refpx , refpy ):
313
+ def ref_phase_estimation (ifg_paths , params , refpx , refpy , preread_ifgs = None ):
312
314
"""
313
315
Reference phase estimation
314
316
@@ -322,18 +324,27 @@ def ref_phase_estimation(ifg_paths, params, refpx, refpy):
322
324
reference pixel x-coordinate
323
325
refpy: float
324
326
reference pixel y-coordinate
327
+ preread_ifgs: dict
328
+ dict containing information regarding ifgs
325
329
"""
330
+ # perform some checks on existing ifgs
331
+ if preread_ifgs and mpiops .rank == MASTER_PROCESS :
332
+ ifg_paths = sorted (preread_ifgs .keys ())
333
+ if mpiops .run_once (rpe .check_ref_phs_ifgs , ifg_paths , preread_ifgs ):
334
+ return # return if True condition returned
326
335
327
- log .info ('Estimating and removing reference phase' )
328
336
if params [cf .REF_EST_METHOD ] == 1 :
329
337
# calculate phase sum for later use in ref phase method 1
330
338
comp = phase_sum (ifg_paths , params )
339
+ log .info ('Computing reference phase via method 1' )
331
340
process_ref_phs = ref_phs_method1 (ifg_paths , comp )
332
341
elif params [cf .REF_EST_METHOD ] == 2 :
342
+ log .info ('Computing reference phase via method 2' )
333
343
process_ref_phs = ref_phs_method2 (ifg_paths , params , refpx , refpy )
334
344
else :
335
345
raise ConfigException ('Ref phase estimation method must be 1 or 2' )
336
346
347
+ # Save reference phase numpy arrays to disk
337
348
ref_phs_file = join (params [cf .TMPDIR ], 'ref_phs.npy' )
338
349
if mpiops .rank == MASTER_PROCESS :
339
350
ref_phs = np .zeros (len (ifg_paths ), dtype = np .float64 )
@@ -350,6 +361,7 @@ def ref_phase_estimation(ifg_paths, params, refpx, refpy):
350
361
# send reference phase data to master process
351
362
mpiops .comm .Send (process_ref_phs , dest = MASTER_PROCESS ,
352
363
tag = mpiops .rank )
364
+ log .info ('Completed reference phase estimation' )
353
365
354
366
355
367
def ref_phs_method2 (ifg_paths , params , refpx , refpy ):
@@ -443,7 +455,7 @@ def process_ifgs(ifg_paths, params, rows, cols):
443
455
cols: int
444
456
number of cols to break each ifg into
445
457
"""
446
- if mpiops .size > 1 : # turn of multiprocessing during mpi jobs
458
+ if mpiops .size > 1 : # turn of multiprocessing during mpi jobs
447
459
params [cf .PARALLEL ] = False
448
460
449
461
tiles = mpiops .run_once (get_tiles , ifg_paths [0 ], rows , cols )
@@ -504,10 +516,10 @@ def linrate_calc(ifg_paths, params, vcmt, tiles, preread_ifgs):
504
516
"""
505
517
506
518
process_tiles = mpiops .array_split (tiles )
507
- log .info ('Calculating linear rate' )
519
+ log .info ('Calculating linear rate map ' )
508
520
output_dir = params [cf .TMPDIR ]
509
521
for t in process_tiles :
510
- log .info ('calculating lin rate of tile {}' .format (t .index ))
522
+ log .info ('Calculating linear rate of tile {}' .format (t .index ))
511
523
ifg_parts = [shared .IfgPart (p , t , preread_ifgs ) for p in ifg_paths ]
512
524
mst_grid_n = np .load (os .path .join (output_dir ,
513
525
'mst_mat_{}.npy' .format (t .index )))
@@ -641,9 +653,6 @@ def timeseries_calc(ifg_paths, params, vcmt, tiles, preread_ifgs):
641
653
dict containing ifg characteristics for efficient computing
642
654
643
655
"""
644
- if not params [cf .TIME_SERIES_CAL ]:
645
- log .info ('Time series calculation not required.' )
646
- return
647
656
process_tiles = mpiops .array_split (tiles )
648
657
log .info ('Calculating time series' )
649
658
output_dir = params [cf .TMPDIR ]
0 commit comments