Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove optional unwrapping logic from stitch_and_unwrap.py #127

Merged
merged 3 commits into from
Sep 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/test-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ jobs:
os: [ubuntu-latest, macos-latest]
deps:
- label: Latest
spec: >-
isce3
spec: ""
- label: Minimum
spec: >-
python=3.8
Expand Down
2 changes: 1 addition & 1 deletion conda-env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ dependencies:
- python>=3.8
- pip>=21.3 # https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/#editable-installation
- git # for pip install, due to setuptools_scm
- isce3>=0.14.0 # isce3 for unwrapping has been moved to optional
- isce3
- gdal>=3.3
- h5py>=3.6
- hdf5!=1.12.2 # https://github.com/SciTools/iris/issues/5187 and https://github.com/pydata/xarray/issues/7549
Expand Down
39 changes: 11 additions & 28 deletions src/dolphin/workflows/stitch_and_unwrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,10 @@
from pathlib import Path
from typing import Sequence

from dolphin import io, stitching
from dolphin import io, stitching, unwrap
from dolphin._log import get_log, log_runtime
from dolphin.interferogram import estimate_correlation_from_phase

try:
from dolphin import unwrap

UNWRAP_INSTALLED = False
except ImportError as e:
logger = get_log(__name__)
logger.info("Unwrapping dependencies not installed: %s", e)
UNWRAP_INSTALLED = False


from .config import UnwrapMethod, Workflow


Expand Down Expand Up @@ -142,23 +132,16 @@ def run(
ifg_filenames = sorted(Path(stitched_ifg_dir).glob("*.int")) # type: ignore
if not ifg_filenames:
raise FileNotFoundError(f"No interferograms found in {stitched_ifg_dir}")
if UNWRAP_INSTALLED:
unwrapped_paths, conncomp_paths = unwrap.run(
ifg_filenames=ifg_filenames,
cor_filenames=spatial_corr_paths,
output_path=cfg.unwrap_options._directory,
nlooks=nlooks,
mask_file=output_mask,
# mask_file: Optional[Filename] = None,
# TODO: max jobs based on the CPUs and the available RAM? use dask?
max_jobs=unwrap_jobs,
# overwrite: bool = False,
no_tile=True,
use_icu=use_icu,
)
else:
logger.info("Unwrapping dependencies not installed, skipping.")
unwrapped_paths, conncomp_paths = [], []
unwrapped_paths, conncomp_paths = unwrap.run(
ifg_filenames=ifg_filenames,
cor_filenames=spatial_corr_paths,
output_path=cfg.unwrap_options._directory,
nlooks=nlooks,
mask_file=output_mask,
max_jobs=unwrap_jobs,
no_tile=True,
use_icu=use_icu,
)

return unwrapped_paths, conncomp_paths, spatial_corr_paths, stitched_tcorr_file

Expand Down