Skip to content

Commit

Permalink
Merge pull request #6 from luhipi/enhancement/avoid-zero-in-log10
Browse files Browse the repository at this point in the history
mask mean amplitude to avoid zero division warning
  • Loading branch information
Andreas-Piter authored Aug 22, 2024
2 parents 871c1ee + 9828931 commit ce57767
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sarvey/coherence.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ def computeIfgsAndTemporalCoherence(*, path_temp_coh: str, path_ifgs: str, path_
# read slc
slc = slc_stack_obj.read(datasetName='slc', box=bbox, print_msg=False)
slc = slc[time_mask, :, :]
# todo: check if mean in log() is 0, then mask it to avoid computational problems.
mean_amp_img[bbox[1]:bbox[3], bbox[0]:bbox[2]] = np.log10(np.mean(np.abs(slc), axis=0))

mean_amp = np.mean(np.abs(slc), axis=0)
mean_amp[mean_amp == 0] = np.nan
mean_amp_img[bbox[1]:bbox[3], bbox[0]:bbox[2]] = np.log10(mean_amp)

# compute ifgs
ifgs = computeIfgs(slc=slc, ifg_array=ifg_array)
Expand Down

0 comments on commit ce57767

Please sign in to comment.