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

Pass through compressed_slc_plan config to sequential #459

Merged
merged 2 commits into from
Oct 22, 2024
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
1 change: 1 addition & 0 deletions src/dolphin/workflows/wrapped_phase.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ def run(
cslc_date_fmt=cfg.input_options.cslc_date_fmt,
block_shape=cfg.worker_settings.block_shape,
baseline_lag=cfg.phase_linking.baseline_lag,
compressed_slc_plan=cfg.phase_linking.compressed_slc_plan,
**kwargs,
)
# Dump the used options for JSON parsing
Expand Down
32 changes: 32 additions & 0 deletions tests/test_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,3 +262,35 @@ def test_compressed_idx_setting(slc_file_list, slc_date_list, is_compressed):
assert ministacks[0].compressed_reference_date == expected_ref_date
# But, the output reference date should be the first one (since it was unset)
assert ministacks[0].output_reference_date == slc_date_list[0]


@pytest.mark.parametrize(
"plan", ["always_first", "first_per_ministack", "last_per_ministack"]
)
def test_compressed_plans(slc_file_list, slc_date_list, is_compressed, plan):
"""Check the planning works to set a manually passed compressed index."""
is_compressed = [False] * len(slc_file_list)
ministack_planner = MiniStackPlanner(
file_list=slc_file_list,
dates=slc_date_list,
is_compressed=is_compressed,
output_folder=Path("fake_dir"),
compressed_slc_plan=plan,
)

# This currently works ONLY for one single ministack planning
# (e.g. manually separating ministack runs and re-passing in CCSLCs)
ms_size = 3
ministacks = ministack_planner.plan(ms_size)

compslcs = [m.get_compressed_slc_info() for m in ministacks]
if plan == "always_first":
assert all(c.reference_date == slc_date_list[0] for c in compslcs)
elif plan == "first_per_ministack":
assert compslcs[0].reference_date == slc_date_list[0]
assert compslcs[1].reference_date == slc_date_list[ms_size]
assert compslcs[2].reference_date == slc_date_list[ms_size * 2]
elif plan == "last_per_ministack":
assert compslcs[0].reference_date == slc_date_list[ms_size - 1]
assert compslcs[1].reference_date == slc_date_list[2 * ms_size - 1]
assert compslcs[2].reference_date == slc_date_list[3 * ms_size - 1]