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

Add shp counts #151

Merged
merged 6 commits into from
Oct 10, 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
3 changes: 3 additions & 0 deletions src/disp_s1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class ProductFiles(NamedTuple):
conncomp: Path
temp_coh: Path
correlation: Path
shp_counts: Path
ps_mask: Path
troposphere: Path | None
ionosphere: Path | None
Expand Down Expand Up @@ -235,6 +236,7 @@ def process_product(
temp_coh_filename=files.temp_coh,
ifg_corr_filename=files.correlation,
ps_mask_filename=files.ps_mask,
shp_count_filename=files.shp_counts,
unwrapper_mask_filename=files.unwrapper_mask,
los_east_file=los_east_file,
los_north_file=los_north_file,
Expand Down Expand Up @@ -315,6 +317,7 @@ def create_displacement_products(
temp_coh=out_paths.stitched_temp_coh_file,
correlation=cor,
ps_mask=out_paths.stitched_ps_file,
shp_counts=out_paths.stitched_shp_count_file,
troposphere=tropo,
ionosphere=iono,
unwrapper_mask=mask_f,
Expand Down
6 changes: 5 additions & 1 deletion src/disp_s1/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def create_output_product(
temp_coh_filename: Filename,
ifg_corr_filename: Filename,
ps_mask_filename: Filename,
shp_count_filename: Filename,
unwrapper_mask_filename: Filename | None,
pge_runconfig: RunConfig,
dolphin_config: DisplacementWorkflow,
Expand Down Expand Up @@ -110,6 +111,8 @@ def create_output_product(
The path to the input interferometric correlation image.
ps_mask_filename : Filename
The path to the input persistent scatterer mask image.
shp_count_filename : Filename
The path to statistically homogeneous pixels (SHP) counts.
unwrapper_mask_filename : Filename, optional
The path to the boolean mask used during unwrapping to ignore pixels.
pge_runconfig : Optional[RunConfig], optional
Expand Down Expand Up @@ -264,12 +267,13 @@ def create_output_product(
temp_coh_filename,
ifg_corr_filename,
ps_mask_filename,
shp_count_filename,
unwrapper_mask_filename,
]

for info, filename in zip(product_infos[2:], data_files):
if filename is not None and Path(filename).exists():
data = io.load_gdal(filename)
data = io.load_gdal(filename).astype(info.dtype)
else:
data = np.full(shape=shape, fill_value=info.fillvalue, dtype=info.dtype)

Expand Down
17 changes: 12 additions & 5 deletions src/disp_s1/product_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ class DisplacementProducts:
dtype=np.float32,
)
)

connected_component_labels: ProductInfo = field(
default_factory=lambda: ProductInfo(
name="connected_component_labels",
Expand All @@ -63,7 +62,6 @@ class DisplacementProducts:
dtype=np.uint16,
)
)

temporal_coherence: ProductInfo = field(
default_factory=lambda: ProductInfo(
name="temporal_coherence",
Expand All @@ -75,7 +73,6 @@ class DisplacementProducts:
dtype=np.float32,
)
)

interferometric_correlation: ProductInfo = field(
default_factory=lambda: ProductInfo(
name="interferometric_correlation",
Expand All @@ -90,7 +87,6 @@ class DisplacementProducts:
dtype=np.float32,
)
)

persistent_scatterer_mask: ProductInfo = field(
default_factory=lambda: ProductInfo(
name="persistent_scatterer_mask",
Expand All @@ -103,7 +99,18 @@ class DisplacementProducts:
dtype=np.uint8,
)
)

shp_counts: ProductInfo = field(
default_factory=lambda: ProductInfo(
name="shp_counts",
description=(
"Number of statistically homogeneous pixels (SHPs) used during"
" multilooking."
),
fillvalue=0,
attrs={"units": "unitless"},
dtype=np.int16,
)
)
unwrapper_mask: ProductInfo = field(
default_factory=lambda: ProductInfo(
name="unwrapper_mask",
Expand Down
Loading