Skip to content

Commit b87363e

Browse files
committed
fix for new stack-based temp coh, add parameter for deformation width
1 parent 1b66fe0 commit b87363e

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

src/synth/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,12 @@ class SimulationInputs(BaseModel):
107107
max_defo_amplitude: float = Field(
108108
default=5, description="Maximum amplitude for deformation effects."
109109
)
110+
defo_width_fraction: float = Field(
111+
default=0.2,
112+
description=(
113+
"Fraction of the total image width that the deformation bowl spans."
114+
),
115+
)
110116

111117
include_ramps: bool = Field(
112118
default=True, description="Flag to include ramp effects in the simulation."

src/synth/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def create_simulation_data(
110110
files["deformation"] = layers_dir / "deformation.h5"
111111
create_defo_stack(
112112
shape=shape3d,
113-
sigma=shape2d[0] / 5,
113+
sigma=shape2d[0] * inps.defo_width_fraction,
114114
max_amplitude=inps.max_defo_amplitude,
115115
out_hdf5=files["deformation"],
116116
)

src/synth/plotting.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
import pandas as pd
77
import rasterio as rio
88

9-
from ._utils import get_dates
9+
from .utils import get_dates
1010

1111

1212
def process_coherence_data(
1313
directory: str | Path,
1414
by_date: bool = False,
1515
subsample: int = 1,
1616
difference_dir: str | Path = "differences",
17+
trim: int = 20,
1718
) -> pd.DataFrame:
1819
"""Process InSAR coherence data from a directory and return analysis dataframe.
1920
@@ -23,8 +24,8 @@ def process_coherence_data(
2324
Path to the directory containing the InSAR data with the following structure:
2425
- directory/
2526
- differences/*.tif
26-
- interferograms/temporal_coherence.tif
27-
- interferograms/similarity.tif
27+
- interferograms/temporal_coherence*.tif
28+
- interferograms/similarity*.tif
2829
by_date : bool, optional
2930
If True, return a dataframe with one row per date, by default False
3031
subsample : int, optional
@@ -58,28 +59,25 @@ def process_coherence_data(
5859
file_list = sorted(diff_dir.glob("*tif"))
5960

6061
temp_coh = _load_gdal(
61-
main_dir / "interferograms/temporal_coherence.tif", subsample_factor=subsample
62+
next(iter(main_dir.glob("interferograms/temporal_coherence_[0-9]*.tif"))),
63+
subsample_factor=subsample,
64+
)
65+
sim = _load_gdal(
66+
next(iter(main_dir.glob("interferograms/similarity_[0-9]*.tif"))),
67+
subsample_factor=subsample,
6268
)
6369
# sim = _load_gdal(main_dir / "interferograms/similarity.tif")
6470
# sim = _load_gdal(next(sorted(Path(main_dir / "linked_phase")
6571
# .rglob("similarity_*.tif"))))
6672
# AVERAGE sim... since this is average temp coh?
6773
# Or should i just do a single one...
6874
# print(sorted(Path(main_dir / "linked_phase").rglob("similarity_*.tif")))
69-
if (pl_dir := Path(main_dir / "linked_phase")).exists():
70-
sim_f = sorted(pl_dir.rglob("similarity_*.tif"))[0]
71-
else:
72-
pl_dir = Path(main_dir / "phase_linking/linked_phase")
73-
sim_f = sorted(pl_dir.rglob("similarity_*.tif"))[0]
74-
sim = _load_gdal(
75-
sim_f,
76-
subsample_factor=subsample,
77-
)
7875

7976
# Process differences
8077
pixels = np.stack(
8178
[_load_gdal(f, subsample_factor=subsample) for f in file_list], axis=0
8279
)
80+
pixels = pixels[..., trim:-trim, trim:-trim]
8381
pixels = pixels.reshape(pixels.shape[0], -1)
8482

8583
if not by_date:

0 commit comments

Comments
 (0)