Skip to content

Commit

Permalink
Merge pull request #303 from GeoscienceAustralia/sb/multiprocess-inde…
Browse files Browse the repository at this point in the history
…pendend-orbital-correction

Fix orbital corrections
  • Loading branch information
Matt Garthwaite authored Jul 23, 2021
2 parents c2c4926 + 19216a5 commit dde59c6
Show file tree
Hide file tree
Showing 16 changed files with 826 additions and 296 deletions.
3 changes: 0 additions & 3 deletions pyrate/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,6 @@ def __init__(self, config_file_path):
else: # i.e. serial
self.rows, self.cols = 1, 1

# force offset = 1 for both method options. This adds the required intercept term to the design matrix
self.orbfitoffset = 1

# create a temporary directory if not supplied
if not hasattr(self, 'tmpdir'):
self.tmpdir = Path(self.outdir).joinpath("tmpdir")
Expand Down
5 changes: 4 additions & 1 deletion pyrate/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,11 @@
ORBITAL_FIT_LOOKS_X = 'orbfitlksx'
#: INT; Multi look factor for orbital error calculation in y dimension
ORBITAL_FIT_LOOKS_Y = 'orbfitlksy'
#: BOOL (1/0); Add column of offset params to orbit correction design matrix (1: yes, 0: no)
#: BOOL (1/0); Estimate interferogram offsets during orbit correction design matrix (1: yes, 0: no)
ORBFIT_OFFSET = 'orbfitoffset'
#: FLOAT; Scaling parameter for orbital correction design matrix
ORBFIT_SCALE = 'orbfitscale'
ORBFIT_INTERCEPT = 'orbfitintercept'

# Stacking parameters
#: FLOAT; Threshold ratio between 'model minus observation' residuals and a-priori observation standard deviations for stacking estimate acceptance (otherwise remove furthest outlier and re-iterate)
Expand Down
6 changes: 2 additions & 4 deletions pyrate/core/gamma.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,11 +458,9 @@ def manage_headers(dem_header_file, header_paths, baseline_paths=None):
hdrs = [parse_epoch_header(hp) for hp in header_paths]
if baseline_paths is not None:
baseline_header = parse_baseline_header(baseline_paths)
combined_header = combine_headers(hdrs[0], hdrs[1],
dem_header, baseline_header)
combined_header = combine_headers(hdrs[0], hdrs[1], dem_header, baseline_header)
else:
# baseline_header = {}
combined_header = combine_headers(hdrs[0], hdrs[1], dem_header)
combined_header = combine_headers(hdrs[0], hdrs[1], dem_header)
elif len(header_paths) > 2:
msg = f'There are too many parameter files for one interferogram; there should only be two. {len(header_paths)} parameter files have been given: {header_paths}.'
raise GammaException(msg)
Expand Down
2 changes: 0 additions & 2 deletions pyrate/core/gdal_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ def world_to_pixel(geo_transform, x, y):
return col, line




def resample_nearest_neighbour(input_tif, extents, new_res, output_file):
"""
Nearest neighbor resampling and cropping of an image.
Expand Down
10 changes: 10 additions & 0 deletions pyrate/core/ifgconstants.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@
PYRATE_STDDEV_REF_AREA = 'REF_AREA_STDDEV'
SEQUENCE_POSITION = 'SEQUENCE_POSITION'

PYRATE_ORB_METHOD = 'ORB_METHOD'
PYRATE_ORB_DEG = 'ORB_DEGREES'
PYRATE_ORB_XLOOKS = 'ORB_MULTILOOK_X'
PYRATE_ORB_YLOOKS = 'ORB_MULTILOOK_Y'
PYRATE_ORB_PLANAR = 'PLANAR'
PYRATE_ORB_QUADRATIC = 'QUADRATIC'
PYRATE_ORB_PART_CUBIC = 'PART-CUBIC'
PYRATE_ORB_INDEPENDENT = 'INDEPENDENT'
PYRATE_ORB_NETWORK = 'NETWORK'

DAYS_PER_YEAR = 365.25 # span of year, not a calendar year
YEARS_PER_DAY = 1 / DAYS_PER_YEAR
SPEED_OF_LIGHT_METRES_PER_SECOND = 3e8
Expand Down
12 changes: 10 additions & 2 deletions pyrate/core/mpiops.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,19 @@ def run_once(f: Callable, *args, **kwargs) -> Any:
"""
if MPI_INSTALLED:
if rank == 0:
f_result = f(*args, **kwargs)
# without the try except, any error in this step hangs the other mpi threads
# and these processes never exit, i.e., this MPI call hangs in case process 0 errors.
try:
f_result = f(*args, **kwargs)
except Exception as e:
f_result = e
else:
f_result = None
result = comm.bcast(f_result, root=0)
return result
if isinstance(result, Exception):
raise result
else:
return result
else:
return f(*args, **kwargs)

Expand Down
Loading

0 comments on commit dde59c6

Please sign in to comment.