Skip to content

Commit

Permalink
allow None for ntiles. fix ovr formatting (#231)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottstanie authored Feb 14, 2024
1 parent e8531c1 commit 869cf7d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/dolphin/_overviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def create_image_overviews(
flags = gdal.GA_Update if not external else gdal.GA_ReadOnly
ds = gdal.Open(fspath(file_path), flags)
if ds.GetRasterBand(1).GetOverviewCount() > 0:
logger.info("%s already has overviews. Skipping.")
logger.info("%s already has overviews. Skipping.", file_path)
return

gdal.SetConfigOption("COMPRESS_OVERVIEW", compression)
Expand Down
4 changes: 2 additions & 2 deletions src/dolphin/phase_link/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ def run_cpl(
avg_coh : np.ndarray | None
The average coherence of each row of the coherence matrix,
if requested.
shape = (ncls, out_rows, out_cols)
shape = (nslc, out_rows, out_cols)
"""
C_arrays = covariance.estimate_stack_covariance(
Expand All @@ -303,7 +303,7 @@ def run_cpl(
else:
avg_coh = None

# Reshape the (rows, cols, ncls) output to be same as input stack
# Reshape the (rows, cols, nslcs) output to be same as input stack
cpx_phase_reshaped = jnp.moveaxis(cpx_phase, -1, 0)
return PhaseLinkOutput(
cpx_phase_reshaped, temp_coh, eigenvalues, estimator, avg_coh
Expand Down
9 changes: 9 additions & 0 deletions src/dolphin/workflows/config/_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,15 @@ class UnwrapOptions(BaseModel, extra="forbid"):
description="Statistical cost mode method for SNAPHU.",
)

@field_validator("ntiles", "downsample_factor", mode="before")
@classmethod
def _to_tuple(cls, v):
if v is None:
return (1, 1)
elif isinstance(v, int):
return (v, v)
return v


class WorkerSettings(BaseModel, extra="forbid"):
"""Settings for controlling CPU/GPU settings and parallelism."""
Expand Down

0 comments on commit 869cf7d

Please sign in to comment.