Skip to content

Commit

Permalink
Adjust sign error and handle multiple tropo files
Browse files Browse the repository at this point in the history
  • Loading branch information
Simran S Sangha committed Mar 28, 2023
1 parent 43869a0 commit 90bebdb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
10 changes: 7 additions & 3 deletions src/mintpy/cli/prep_aria.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,14 @@ def cmd_line_parse(iargs = None):
# search for wildcard pattern
fnames = glob.glob(iDict[key]) if iDict[key] else []

# user the first element if more than one exist
# return the first element if more than one exist
# except for tropo, for which multiple inputs could be passed
if len(fnames) > 0:
iDict[key] = fnames[0]
print('{k:<{w}} : {f}'.format(k=key, w=max_digit, f=fnames[0]))
if 'tropo' not in key:
iDict[key] = fnames[0]
else:
iDict[key] = fnames
print('{k:<{w}} : {f}'.format(k=key, w=max_digit, f=iDict[key]))

elif key in required_ds_keys:
# raise exception if any required DS is missing
Expand Down
12 changes: 7 additions & 5 deletions src/mintpy/prep_aria.py
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ def write_model_stack(outfile, corrStack, box=None,

# Get the wavelength. need to convert radians to meters
wavelength = np.float64(dsCor.GetRasterBand(1).GetMetadata(layer)["Wavelength (m)"])
phase2range = -1 * wavelength / (4.*np.pi)
phase2range = wavelength / (4.*np.pi)

# get model dates and time
nDate = dsCor.RasterCount
Expand Down Expand Up @@ -854,8 +854,10 @@ def load_aria(inps):

# 3.2 - model based corrections: SolidEarthTides and Troposphere
# Loop through other correction layers also provided as epochs

correction_layers = [inps.tropoFile, inps.setFile]
# handle multiple tropo stacks (if specified)
if inps.tropoFile is None:
inps.tropoFile = [None]
correction_layers = inps.tropoFile + [inps.setFile]
for layer in correction_layers:
if layer:
# get name and type
Expand All @@ -878,15 +880,15 @@ def load_aria(inps):

if run_or_skip(inps, ds_name_dict, out_file=inps.outfile[0]) == 'run':
writefile.layout_hdf5(
f'{out_dir}/{layer_name}.h5',
f'{out_dir}/{layer_name}_ARIA.h5',
ds_name_dict,
metadata=meta,
compression=inps.compression,
)

# write data to disk
write_model_stack(
f'{out_dir}/{layer_name}.h5',
f'{out_dir}/{layer_name}_ARIA.h5',
corrStack=layer,
box=box,
xstep=inps.xstep,
Expand Down

0 comments on commit 90bebdb

Please sign in to comment.