-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add browse image scaling * added normalization, resizing, and save to disk * make output name optional * black formatting * correct output file type * pre-commit changes * global dataset choices * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * pytdocstyle fix * fix as_list and add more documenation * docstrings * fix error in browse make dataset info and names importable * fix import --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
5c6ed78
commit 50b7893
Showing
3 changed files
with
288 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
from dataclasses import dataclass, fields | ||
|
||
import numpy as np | ||
from numpy.typing import DTypeLike | ||
|
||
|
||
@dataclass(frozen=True) | ||
class DispProductInfo: | ||
"""Container for items used in creating displacement product datasets.""" | ||
|
||
# Name of of the dataset. | ||
name: str | ||
# Description of the dataset. | ||
description: str | ||
# Fill value of the dataset. | ||
fillvalue: DTypeLike | ||
# Attributes of the dataset. | ||
attrs: dict | ||
|
||
@classmethod | ||
def unwrapped_phase(cls): | ||
"""Return container of unwrapped phase specific information.""" | ||
return cls( | ||
name="unwrapped_phase", | ||
description="Unwrapped phase", | ||
fillvalue=np.nan, | ||
attrs=dict(units="radians"), | ||
) | ||
|
||
@classmethod | ||
def connected_component_labels(cls): | ||
"""Return container of connected component label specific information.""" | ||
return cls( | ||
name="connected_component_labels", | ||
description="Connected component labels of the unwrapped phase", | ||
fillvalue=0, | ||
attrs=dict(units="unitless"), | ||
) | ||
|
||
@classmethod | ||
def temporal_coherence(cls): | ||
"""Return container of temporal coherence specific information.""" | ||
return cls( | ||
name="temporal_coherence", | ||
description="Temporal coherence of phase inversion", | ||
fillvalue=np.nan, | ||
attrs=dict(units="unitless"), | ||
) | ||
|
||
@classmethod | ||
def interferometric_correlation(cls): | ||
"""Return container of interferometric correlation specific information.""" | ||
return cls( | ||
name="interferometric_correlation", | ||
description=( | ||
"Estimate of interferometric correlation derived from" | ||
" multilooked interferogram." | ||
), | ||
fillvalue=np.nan, | ||
attrs=dict(units="unitless"), | ||
) | ||
|
||
@classmethod | ||
def persistent_scatterer_mask(cls): | ||
"""Return container of persistent scatterer mask specific information.""" | ||
return cls( | ||
name="persistent_scatterer_mask", | ||
description=( | ||
"Mask of persistent scatterers downsampled to the multilooked" | ||
" output grid." | ||
), | ||
fillvalue=255, | ||
attrs=dict(units="unitless"), | ||
) | ||
|
||
|
||
@dataclass(frozen=True) | ||
class DispProductsInfo: | ||
"""Container for instantiated displacement product dataset info containers.""" | ||
|
||
unwrapped_phase: DispProductInfo = DispProductInfo.unwrapped_phase() | ||
connected_component_labels: ( | ||
DispProductInfo | ||
) = DispProductInfo.connected_component_labels() | ||
temporal_coherence: DispProductInfo = DispProductInfo.temporal_coherence() | ||
interferometric_correlation: ( | ||
DispProductInfo | ||
) = DispProductInfo.interferometric_correlation() | ||
persistent_scatterer_mask: ( | ||
DispProductInfo | ||
) = DispProductInfo.persistent_scatterer_mask() | ||
|
||
def as_list(self): | ||
"""Return all displacement dataset info containers as a list.""" | ||
return [getattr(self, field.name) for field in fields(self)] | ||
|
||
def product_names(self): | ||
"""Return all displacement dataset names as a list.""" | ||
return [field.name for field in fields(self)] | ||
|
||
|
||
DISP_PRODUCTS_INFO = DispProductsInfo().as_list() | ||
DISP_PRODUCT_NAMES = DispProductsInfo().product_names() |