GeoscienceAustralia / PyRate

A Python tool for estimating velocity and time-series from Interferometric Synthetic Aperture Radar (InSAR) data.
https://geoscienceaustralia.github.io/PyRate/
Apache License 2.0
200 stars 70 forks source link

Tf/dem error #304

Closed tfuhrmann closed 3 years ago

tfuhrmann commented 3 years ago

Implemented DEM error estimation generating correction values for each interferogram in subfolder /out/dem_error as well as a /out/dem_error.tif file giving the average height difference w.r.t. the input DEM.

ToDo:

codecov-io commented 3 years ago

Codecov Report

Merging #304 (e1d35ba) into develop (d378a5f) will increase coverage by 0.50%. The diff coverage is 86.26%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #304      +/-   ##
===========================================
+ Coverage    83.22%   83.73%   +0.50%     
===========================================
  Files           26       28       +2     
  Lines         3470     4039     +569     
  Branches       544      614      +70     
===========================================
+ Hits          2888     3382     +494     
- Misses         486      530      +44     
- Partials        96      127      +31     
Impacted Files Coverage Δ
pyrate/default_parameters.py 100.00% <ø> (ø)
pyrate/core/gamma.py 81.64% <73.44%> (-11.14%) :arrow_down:
pyrate/core/config.py 92.42% <75.00%> (-1.99%) :arrow_down:
pyrate/core/shared.py 92.64% <87.50%> (-0.51%) :arrow_down:
pyrate/configuration.py 90.90% <90.90%> (-1.26%) :arrow_down:
pyrate/prepifg.py 60.22% <90.90%> (+9.48%) :arrow_up:
pyrate/core/dem_error.py 91.44% <91.44%> (ø)
pyrate/core/geometry.py 92.70% <92.70%> (ø)
pyrate/constants.py 100.00% <100.00%> (ø)
pyrate/core/gdal_python.py 85.33% <100.00%> (+1.12%) :arrow_up:
... and 9 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d378a5f...e1d35ba. Read the comment docs.

tfuhrmann commented 3 years ago

Yes I agree that we need to roll back to Thomas' version of the remove_file_if_exists function. Also, I wonder if remove_file_if_exists function is better housed in shared.py? it's generic and used in two places (dem_error.py and geometry.py)

I've now changed remove_file_if_exists back to the old version and moved it into shared.py.

This change has also fixed the broken tests.

tfuhrmann commented 3 years ago

I think the Python 3.6 Travis checks fail because of these lines of code:

    # get azimuth angle value of PyRate file azimuth_angle.tif
    out = run(f"gdallocationinfo {tif_file} {x0} {y0}", shell=True, capture_output=True,
              text=True).stdout
    angle_value = float(out.split('Value:')[1].strip('\n'))

Looks like capture_output=True is only for Python version 3.7+ (see https://stackoverflow.com/questions/52219836/subprocess-run-doesnt-return-stdout-or-stderr)

@basaks : can you think of another solution to capture and extract from the output of the gdallocationinfo command?

EDIT: I think I've fixed it (see commit below). Just waiting for Travis checks...