sct_notch_analysis 1.0.0.dev0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sct_notch_analysis/__init__.py +9 -0
- sct_notch_analysis/cli.py +81 -0
- sct_notch_analysis/config.py +32 -0
- sct_notch_analysis/core/__init__.py +8 -0
- sct_notch_analysis/core/analysis.py +73 -0
- sct_notch_analysis/interface.py +56 -0
- sct_notch_analysis/main.py +70 -0
- sct_notch_analysis/resources/__init__.py +8 -0
- sct_notch_analysis/resources/config_schema.json +21 -0
- sct_notch_analysis/testing.py +146 -0
- sct_notch_analysis-1.0.0.dev0.dist-info/METADATA +103 -0
- sct_notch_analysis-1.0.0.dev0.dist-info/RECORD +15 -0
- sct_notch_analysis-1.0.0.dev0.dist-info/WHEEL +4 -0
- sct_notch_analysis-1.0.0.dev0.dist-info/entry_points.txt +2 -0
- sct_notch_analysis-1.0.0.dev0.dist-info/licenses/LICENSE.txt +21 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Aresys S.r.l. <info@aresys.it>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
"""Command Line Interface for Elevation Notch Analysis."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
import typer
|
|
11
|
+
from sct.cli import common
|
|
12
|
+
from sct.configuration.config import GeneralConfiguration
|
|
13
|
+
from sct.configuration.logger import sct_logger
|
|
14
|
+
|
|
15
|
+
from sct_notch_analysis.config import SCTElevationNotchAnalysisConfig
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def notch_analysis(
|
|
19
|
+
ctx: typer.Context,
|
|
20
|
+
product: common.InputProductOption,
|
|
21
|
+
output_directory: common.OutputDirectoryOption,
|
|
22
|
+
antenna_pattern: common.AntennaPatternInputOption = None,
|
|
23
|
+
graphs: common.GraphsOption = False,
|
|
24
|
+
) -> None:
|
|
25
|
+
"""Elevation Notch Analysis.
|
|
26
|
+
|
|
27
|
+
\b
|
|
28
|
+
Antenna pattern NetCDF file can be provided to estimate the elevation pointing offset with Least Square fitting
|
|
29
|
+
of the elevation profile of the focused data with a three parameters internal model.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
config: GeneralConfiguration = ctx.obj
|
|
33
|
+
|
|
34
|
+
log_path = output_directory / "sct_notch_analysis.log" if config.save_log else None
|
|
35
|
+
|
|
36
|
+
with common.logging_to_file(log_path):
|
|
37
|
+
sct_logger.info(f"Product: {product}")
|
|
38
|
+
if antenna_pattern is not None:
|
|
39
|
+
sct_logger.info(f"Antenna pattern: {antenna_pattern}")
|
|
40
|
+
else:
|
|
41
|
+
sct_logger.warning("No antenna pattern provided, only parabolic fit around minimum will be performed.")
|
|
42
|
+
sct_logger.info(f"Output folder: {output_directory}")
|
|
43
|
+
sct_logger.info(f"Graphs generation {'enabled' if graphs else 'disabled'}")
|
|
44
|
+
|
|
45
|
+
common.display_title("Elevation Notch Analysis")
|
|
46
|
+
|
|
47
|
+
analysis_config = (
|
|
48
|
+
SCTElevationNotchAnalysisConfig.from_toml(config.toml_path)
|
|
49
|
+
if config.toml_path is not None
|
|
50
|
+
else SCTElevationNotchAnalysisConfig()
|
|
51
|
+
)
|
|
52
|
+
elevation_notch_analysis_implementation(
|
|
53
|
+
product=product,
|
|
54
|
+
antenna_pattern=antenna_pattern,
|
|
55
|
+
output_directory=output_directory,
|
|
56
|
+
config=analysis_config,
|
|
57
|
+
graphs=graphs,
|
|
58
|
+
dump_config=config.save_config_copy,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@common.log_elapsed_time("Elevation Notch Analysis")
|
|
63
|
+
@common.graceful_exit("Elevation Notch Analysis")
|
|
64
|
+
def elevation_notch_analysis_implementation(
|
|
65
|
+
product: Path,
|
|
66
|
+
antenna_pattern: Path | None,
|
|
67
|
+
output_directory: Path,
|
|
68
|
+
config: SCTElevationNotchAnalysisConfig,
|
|
69
|
+
graphs: bool,
|
|
70
|
+
dump_config: bool,
|
|
71
|
+
) -> None:
|
|
72
|
+
"""Implement the elevation notch analysis command."""
|
|
73
|
+
from sct_notch_analysis.main import full_elevation_notch_analysis
|
|
74
|
+
|
|
75
|
+
full_elevation_notch_analysis(
|
|
76
|
+
product=product,
|
|
77
|
+
antenna_pattern=antenna_pattern,
|
|
78
|
+
output_directory=output_directory,
|
|
79
|
+
config=config,
|
|
80
|
+
graphs=graphs,
|
|
81
|
+
)
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Aresys S.r.l. <info@aresys.it>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
"""Elevation Notch Analysis Configuration."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from dataclasses import asdict, dataclass, field
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from perseo_quality.elevation_notch_analysis.config import ElevationNotchConfig
|
|
12
|
+
from sct.configuration.config_abc import AnalysisConfigABC
|
|
13
|
+
|
|
14
|
+
from sct_notch_analysis.resources import config_schema
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass
|
|
18
|
+
class SCTElevationNotchAnalysisConfig(AnalysisConfigABC):
|
|
19
|
+
"""SCT Elevation Notch Analysis configuration"""
|
|
20
|
+
|
|
21
|
+
base_config: ElevationNotchConfig = field(default_factory=ElevationNotchConfig)
|
|
22
|
+
config_group_name = "elevation_notch_analysis"
|
|
23
|
+
validation_schema = Path(config_schema)
|
|
24
|
+
|
|
25
|
+
@classmethod
|
|
26
|
+
def from_dict(cls, arg: dict) -> SCTElevationNotchAnalysisConfig:
|
|
27
|
+
"""Convert from dict"""
|
|
28
|
+
return cls(base_config=ElevationNotchConfig.from_dict(arg))
|
|
29
|
+
|
|
30
|
+
def to_dict(self):
|
|
31
|
+
"""Convert to dict"""
|
|
32
|
+
return {self.config_group_name: asdict(self.base_config)}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Aresys S.r.l. <info@aresys.it>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
"""Elevation Notch Analysis - Core implementation"""
|
|
5
|
+
|
|
6
|
+
from sct_notch_analysis.core.analysis import sct_elevation_notch_analysis
|
|
7
|
+
|
|
8
|
+
__all__ = ["sct_elevation_notch_analysis"]
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Aresys S.r.l. <info@aresys.it>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
"""Elevation Notch Analysis"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from perseo_quality.elevation_notch_analysis.analysis import elevation_notch_analysis
|
|
11
|
+
from perseo_quality.elevation_notch_analysis.custom_dataclasses import (
|
|
12
|
+
ElevationNotchOutput,
|
|
13
|
+
)
|
|
14
|
+
from sct.configuration.logger import sct_logger
|
|
15
|
+
from sct.io.antenna_pattern_manager import read_antenna_pattern_netcdf
|
|
16
|
+
from sct.io.io_manager import InvalidProductType, product_loader
|
|
17
|
+
|
|
18
|
+
from sct_notch_analysis.config import SCTElevationNotchAnalysisConfig
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def sct_elevation_notch_analysis(
|
|
22
|
+
product_path: str | Path,
|
|
23
|
+
antenna_pattern_file: str | Path | None = None,
|
|
24
|
+
config: SCTElevationNotchAnalysisConfig | None = None,
|
|
25
|
+
) -> list[ElevationNotchOutput]:
|
|
26
|
+
"""Elevation Notch Analysis performed on the input product, taking into account the antenna pattern data, if
|
|
27
|
+
provided.
|
|
28
|
+
|
|
29
|
+
Parameters
|
|
30
|
+
----------
|
|
31
|
+
product_path : str | Path
|
|
32
|
+
path to the product to be analyzed
|
|
33
|
+
antenna_pattern_file : str | Path | None, optional
|
|
34
|
+
path to the antenna pattern NetCDF file, if needed, by default None
|
|
35
|
+
config : SCTElevationNotchAnalysisConfig | None, optional
|
|
36
|
+
configuration parameters, by default None
|
|
37
|
+
|
|
38
|
+
Returns
|
|
39
|
+
-------
|
|
40
|
+
list[ElevationNotchOutput]
|
|
41
|
+
list of ElevationNotchOutput analysis output, one for each product channel
|
|
42
|
+
"""
|
|
43
|
+
product_path = Path(product_path)
|
|
44
|
+
sct_logger.info(f"Input product: {product_path}")
|
|
45
|
+
|
|
46
|
+
config = config or SCTElevationNotchAnalysisConfig()
|
|
47
|
+
|
|
48
|
+
# LOADING PRODUCT
|
|
49
|
+
try:
|
|
50
|
+
product, _ = product_loader(
|
|
51
|
+
product_path=product_path,
|
|
52
|
+
)
|
|
53
|
+
except InvalidProductType as err:
|
|
54
|
+
sct_logger.critical(f"Unknown product type {product_path}.")
|
|
55
|
+
sct_logger.critical("Please check that the dedicated format plugin is installed.")
|
|
56
|
+
raise InvalidProductType from err
|
|
57
|
+
|
|
58
|
+
# LOADING ANTENNA PATTERN
|
|
59
|
+
antenna_pattern = None
|
|
60
|
+
if antenna_pattern_file is not None:
|
|
61
|
+
sct_logger.info(f"Antenna Pattern provided. Loading data from {antenna_pattern_file}")
|
|
62
|
+
try:
|
|
63
|
+
antenna_pattern = read_antenna_pattern_netcdf(antenna_pattern_file)
|
|
64
|
+
except Exception as err:
|
|
65
|
+
sct_logger.critical("Error while reading antenna pattern file")
|
|
66
|
+
sct_logger.critical(err)
|
|
67
|
+
raise RuntimeError from err
|
|
68
|
+
|
|
69
|
+
return elevation_notch_analysis(
|
|
70
|
+
product=product,
|
|
71
|
+
antenna_pattern=antenna_pattern,
|
|
72
|
+
config=config.base_config,
|
|
73
|
+
)
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Aresys S.r.l. <info@aresys.it>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
"""Elevation Notch Analysis plugin entry point.
|
|
5
|
+
|
|
6
|
+
Lightweight module: importing it must not pull in the heavy analysis implementation
|
|
7
|
+
or the scientific stack. All heavy imports are deferred to the accessor methods.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from typing import TYPE_CHECKING, Callable
|
|
13
|
+
|
|
14
|
+
from sct_notch_analysis import __version__
|
|
15
|
+
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from sct.core.base import AnalysisHandler
|
|
18
|
+
from typer import Typer
|
|
19
|
+
|
|
20
|
+
ANALYSIS_NAME = "elevation_notch"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ElevationNotchAnalysisPlugin:
|
|
24
|
+
"""Elevation Notch Analysis plugin."""
|
|
25
|
+
|
|
26
|
+
version = __version__
|
|
27
|
+
short_help = "Elevation Notch Analysis."
|
|
28
|
+
|
|
29
|
+
@classmethod
|
|
30
|
+
def get_cli(cls) -> Typer | Callable:
|
|
31
|
+
from sct_notch_analysis.cli import notch_analysis
|
|
32
|
+
|
|
33
|
+
return notch_analysis
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def get_handlers(cls) -> dict[str, AnalysisHandler]:
|
|
37
|
+
from sct.core.base import AnalysisHandler, AnalysisTestingHandler
|
|
38
|
+
|
|
39
|
+
from sct_notch_analysis.config import SCTElevationNotchAnalysisConfig
|
|
40
|
+
from sct_notch_analysis.testing import (
|
|
41
|
+
run_notch_api,
|
|
42
|
+
run_notch_cli,
|
|
43
|
+
validate_notch_results,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
ANALYSIS_NAME: AnalysisHandler(
|
|
48
|
+
config=SCTElevationNotchAnalysisConfig,
|
|
49
|
+
cli=cls.get_cli(),
|
|
50
|
+
testing=AnalysisTestingHandler(
|
|
51
|
+
api_runner=run_notch_api,
|
|
52
|
+
cli_runner=run_notch_cli,
|
|
53
|
+
validator=validate_notch_results,
|
|
54
|
+
),
|
|
55
|
+
)
|
|
56
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Aresys S.r.l. <info@aresys.it>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
"""Elevation Notch Analysis implementation."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from collections.abc import Callable
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
from perseo_quality.elevation_notch_analysis.support import elevation_notch_profiles_to_netcdf
|
|
12
|
+
from sct.configuration.logger import sct_logger
|
|
13
|
+
|
|
14
|
+
from sct_notch_analysis.config import SCTElevationNotchAnalysisConfig
|
|
15
|
+
from sct_notch_analysis.core import sct_elevation_notch_analysis
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def full_elevation_notch_analysis(
|
|
19
|
+
product: Path,
|
|
20
|
+
antenna_pattern: Path | None,
|
|
21
|
+
output_directory: Path,
|
|
22
|
+
config: SCTElevationNotchAnalysisConfig | None,
|
|
23
|
+
graphs: bool,
|
|
24
|
+
) -> Path:
|
|
25
|
+
"""Full implementation of Elevation Notch Analysis.
|
|
26
|
+
|
|
27
|
+
Parameters
|
|
28
|
+
----------
|
|
29
|
+
product : Path
|
|
30
|
+
Path to the product to be analyzed
|
|
31
|
+
antenna_pattern : Path | None
|
|
32
|
+
Path to the antenna pattern NetCDF file
|
|
33
|
+
output_directory : Path
|
|
34
|
+
Path to the output directory
|
|
35
|
+
config : SCTElevationNotchAnalysisConfig | None
|
|
36
|
+
analysis configuration parameters, if needed
|
|
37
|
+
graphs : bool
|
|
38
|
+
flag to enable graphs generation
|
|
39
|
+
|
|
40
|
+
Returns
|
|
41
|
+
-------
|
|
42
|
+
Path
|
|
43
|
+
Path to the NetCDF file containing the results
|
|
44
|
+
"""
|
|
45
|
+
graphs_func = _import_notch_graphs_func(graphs)
|
|
46
|
+
output = sct_elevation_notch_analysis(product_path=product, antenna_pattern_file=antenna_pattern, config=config)
|
|
47
|
+
sct_logger.info("Saving results to NetCDF...")
|
|
48
|
+
netcdf_file = elevation_notch_profiles_to_netcdf(data=output, output_dir=output_directory)
|
|
49
|
+
|
|
50
|
+
if graphs_func is not None:
|
|
51
|
+
sct_logger.info("Generating graphs...")
|
|
52
|
+
output_graphs_dir = output_directory.joinpath("graphs")
|
|
53
|
+
output_graphs_dir.mkdir(exist_ok=True)
|
|
54
|
+
graphs_func(data=output, output_dir=output_graphs_dir)
|
|
55
|
+
|
|
56
|
+
return netcdf_file
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _import_notch_graphs_func(graphs: bool) -> Callable | None:
|
|
60
|
+
"""Importing the elevation notch analysis graphs plotting function."""
|
|
61
|
+
plot_elevation_notch_analysis = None
|
|
62
|
+
if graphs:
|
|
63
|
+
try:
|
|
64
|
+
from perseo_quality.elevation_notch_analysis.graphical_output import plot_elevation_notch_analysis
|
|
65
|
+
except ImportError as err:
|
|
66
|
+
sct_logger.critical(
|
|
67
|
+
'Cannot generate graphical output: install graphs requirements "pip install sct[graphs]"'
|
|
68
|
+
)
|
|
69
|
+
raise ImportError from err
|
|
70
|
+
return plot_elevation_notch_analysis
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"type": "object",
|
|
4
|
+
"properties": {
|
|
5
|
+
"elevation_notch_analysis": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"description": "Elevation Notch analysis configuration",
|
|
8
|
+
"properties": {
|
|
9
|
+
"azimuth_block_size": {
|
|
10
|
+
"type": "integer",
|
|
11
|
+
"description": "Number of lines for partitioning the scene along azimuth direction"
|
|
12
|
+
},
|
|
13
|
+
"range_pixel_margin": {
|
|
14
|
+
"type": "integer",
|
|
15
|
+
"description": "Pixel margin to remove near and far range"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"required": ["elevation_notch_analysis"]
|
|
21
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Aresys S.r.l. <info@aresys.it>
|
|
2
|
+
# SPDX-License-Identifier: MIT
|
|
3
|
+
|
|
4
|
+
"""SCT Testing - Elevation Notch Analysis"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
import numpy as np
|
|
11
|
+
from netCDF4 import Dataset
|
|
12
|
+
from sct.testing.utilities.common import ReferenceOutput, TestOutput, TestParams, cli_launcher
|
|
13
|
+
|
|
14
|
+
from sct_notch_analysis.config import SCTElevationNotchAnalysisConfig
|
|
15
|
+
from sct_notch_analysis.main import full_elevation_notch_analysis
|
|
16
|
+
|
|
17
|
+
ABSOLUTE_TOLERANCE = 1e-5
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def run_notch_api(
|
|
21
|
+
params: TestParams, output_dir: Path, config: SCTElevationNotchAnalysisConfig | None, graphs: bool
|
|
22
|
+
) -> TestOutput:
|
|
23
|
+
"""Running SCT Elevation Notch Analysis from API forwarding the inputs.
|
|
24
|
+
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
params : TestParams
|
|
28
|
+
test parameters
|
|
29
|
+
output_dir : Path
|
|
30
|
+
output directory
|
|
31
|
+
config : SCTElevationNotchAnalysisConfig | None
|
|
32
|
+
analysis configuration, if needed
|
|
33
|
+
graphs : bool
|
|
34
|
+
flag to enable graphs generation
|
|
35
|
+
|
|
36
|
+
Returns
|
|
37
|
+
-------
|
|
38
|
+
TestOutput
|
|
39
|
+
path to output netcdf file
|
|
40
|
+
"""
|
|
41
|
+
nc_output = full_elevation_notch_analysis(
|
|
42
|
+
product=params.product,
|
|
43
|
+
antenna_pattern=params.antenna_pattern,
|
|
44
|
+
output_directory=output_dir,
|
|
45
|
+
config=config,
|
|
46
|
+
graphs=graphs,
|
|
47
|
+
)
|
|
48
|
+
return TestOutput(netcdf_results=nc_output)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def run_notch_cli(params: TestParams, output_dir: Path, config: Path | None, graphs: bool) -> TestOutput:
|
|
52
|
+
"""Running SCT Elevation Notch Analysis using CLI tool forwarding the inputs.
|
|
53
|
+
|
|
54
|
+
Parameters
|
|
55
|
+
----------
|
|
56
|
+
params : TestParams
|
|
57
|
+
test parameters
|
|
58
|
+
output_dir : Path
|
|
59
|
+
output directory
|
|
60
|
+
config : Path | None
|
|
61
|
+
configuration file
|
|
62
|
+
graphs : bool
|
|
63
|
+
flag to enable graphs generation
|
|
64
|
+
|
|
65
|
+
Returns
|
|
66
|
+
-------
|
|
67
|
+
TestOutput
|
|
68
|
+
path to NetCDF output file
|
|
69
|
+
|
|
70
|
+
RuntimeError
|
|
71
|
+
if missing output configuration file
|
|
72
|
+
RuntimeError
|
|
73
|
+
if missing output log file
|
|
74
|
+
RuntimeError
|
|
75
|
+
if missing output NetCDF results file
|
|
76
|
+
"""
|
|
77
|
+
cli_args = []
|
|
78
|
+
if config is not None:
|
|
79
|
+
cli_args.extend(["--config", str(config)])
|
|
80
|
+
cli_args.extend(
|
|
81
|
+
[
|
|
82
|
+
"elevation_notch",
|
|
83
|
+
"-p",
|
|
84
|
+
str(params.product),
|
|
85
|
+
"-out",
|
|
86
|
+
str(output_dir),
|
|
87
|
+
]
|
|
88
|
+
)
|
|
89
|
+
if params.antenna_pattern is not None:
|
|
90
|
+
cli_args.extend(["-ap", str(params.antenna_pattern)])
|
|
91
|
+
if graphs:
|
|
92
|
+
cli_args.extend(["-g"])
|
|
93
|
+
|
|
94
|
+
cli_launcher(cli_args)
|
|
95
|
+
|
|
96
|
+
# checking successful run
|
|
97
|
+
if not output_dir.joinpath("analysis_config.toml").exists():
|
|
98
|
+
raise RuntimeError("Missing analysis_config.toml file")
|
|
99
|
+
if not output_dir.joinpath("sct_notch_analysis.log").exists():
|
|
100
|
+
raise RuntimeError("Missing sct_notch_analysis.log file")
|
|
101
|
+
nc_output_file = list(output_dir.glob("*.nc"))
|
|
102
|
+
if not len(nc_output_file) == 1:
|
|
103
|
+
raise RuntimeError("No output NetCDF file found")
|
|
104
|
+
|
|
105
|
+
return TestOutput(netcdf_results=nc_output_file[0])
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def validate_notch_results(current_output: TestOutput, reference_output: ReferenceOutput) -> None:
|
|
109
|
+
"""Compare elevation notch netCDF output results with tolerances.
|
|
110
|
+
|
|
111
|
+
Parameters
|
|
112
|
+
----------
|
|
113
|
+
current_output : TestOutput
|
|
114
|
+
current run output
|
|
115
|
+
reference_output : ReferenceOutput
|
|
116
|
+
reference output
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
current_ds = Dataset(current_output.netcdf_results, "r", format="NETCDF4")
|
|
120
|
+
reference_ds = Dataset(reference_output.netcdf_reference, "r", format="NETCDF4")
|
|
121
|
+
|
|
122
|
+
assert reference_ds.groups.keys() == current_ds.groups.keys()
|
|
123
|
+
for key, group in reference_ds.groups.items():
|
|
124
|
+
current_group = current_ds.groups[key]
|
|
125
|
+
assert group.groups.keys() == current_group.groups.keys()
|
|
126
|
+
for s_key, subgroup in group.groups.items():
|
|
127
|
+
current_subgroup = current_group.groups[s_key]
|
|
128
|
+
assert subgroup.azimuth_blocks_num == current_subgroup.azimuth_blocks_num
|
|
129
|
+
assert subgroup.lines_per_block == current_subgroup.lines_per_block
|
|
130
|
+
assert subgroup.samples_per_block == current_subgroup.samples_per_block
|
|
131
|
+
assert subgroup.variables.keys() == current_subgroup.variables.keys()
|
|
132
|
+
for var_name, var in subgroup.variables.items():
|
|
133
|
+
current_var = current_subgroup.variables[var_name]
|
|
134
|
+
try:
|
|
135
|
+
assert var.units == current_var.units
|
|
136
|
+
except AttributeError:
|
|
137
|
+
pass
|
|
138
|
+
np.testing.assert_allclose(
|
|
139
|
+
var[:],
|
|
140
|
+
current_var[:],
|
|
141
|
+
atol=ABSOLUTE_TOLERANCE,
|
|
142
|
+
rtol=0,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
reference_ds.close()
|
|
146
|
+
current_ds.close()
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sct_notch_analysis
|
|
3
|
+
Version: 1.0.0.dev0
|
|
4
|
+
Summary: SCT Plugin for Notch Analysis of L1 SAR Products.
|
|
5
|
+
Project-URL: Homepage, https://github.com/aresys-srl/sct_plugins_analyses
|
|
6
|
+
Project-URL: Repository, https://github.com/aresys-srl/sct_plugins_analyses
|
|
7
|
+
Project-URL: Documentation, https://opensource.aresys.it/sct_plugins_analyses
|
|
8
|
+
Author-email: "Aresys S.R.L." <info@aresys.it>
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (C) Aresys S.r.l. <info@aresys.it>
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
License-File: LICENSE.txt
|
|
31
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
32
|
+
Classifier: Intended Audience :: Developers
|
|
33
|
+
Classifier: Intended Audience :: Education
|
|
34
|
+
Classifier: Intended Audience :: Science/Research
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Natural Language :: English
|
|
37
|
+
Classifier: Operating System :: OS Independent
|
|
38
|
+
Classifier: Programming Language :: Python
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
40
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
41
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
42
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
43
|
+
Classifier: Topic :: Scientific/Engineering
|
|
44
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
45
|
+
Classifier: Topic :: Utilities
|
|
46
|
+
Classifier: Typing :: Typed
|
|
47
|
+
Requires-Python: >=3.11
|
|
48
|
+
Requires-Dist: jsonschema
|
|
49
|
+
Requires-Dist: netcdf4
|
|
50
|
+
Requires-Dist: numpy>2
|
|
51
|
+
Requires-Dist: perseo-core>=1.0.0
|
|
52
|
+
Requires-Dist: perseo-quality>=1.1.0
|
|
53
|
+
Requires-Dist: sct
|
|
54
|
+
Requires-Dist: typer>=0.24.1
|
|
55
|
+
Provides-Extra: dev
|
|
56
|
+
Requires-Dist: pylint; extra == 'dev'
|
|
57
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
58
|
+
Provides-Extra: docs
|
|
59
|
+
Requires-Dist: mkdocstrings-python; extra == 'docs'
|
|
60
|
+
Requires-Dist: zensical; extra == 'docs'
|
|
61
|
+
Provides-Extra: test
|
|
62
|
+
Requires-Dist: pytest; extra == 'test'
|
|
63
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
64
|
+
Requires-Dist: pytest-mock; extra == 'test'
|
|
65
|
+
Requires-Dist: sct[graphs]>=3.1.0; extra == 'test'
|
|
66
|
+
Description-Content-Type: text/markdown
|
|
67
|
+
|
|
68
|
+
# SCT Plugin: Elevation Notch Analysis
|
|
69
|
+
|
|
70
|
+
[](https://pypi.org/project/sct-notch-analysis/)
|
|
71
|
+
[](https://python.org)
|
|
72
|
+
[](LICENSE.txt)
|
|
73
|
+
|
|
74
|
+
[](https://github.com/aresys-srl/sct_plugins_analyses/actions/workflows/notch.yml)
|
|
75
|
+
|
|
76
|
+
[SCT (SAR Calibration Toolbox)](https://github.com/aresys-srl/sct) plugin for performing
|
|
77
|
+
Elevation Notch Analysis on L1 SAR products. Enables antenna mispointing computation from dedicated notch products.
|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
``` bash
|
|
82
|
+
pip install sct-notch-analysis
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
SCT is automatically installed as a dependency.
|
|
86
|
+
|
|
87
|
+
## Compatibility
|
|
88
|
+
|
|
89
|
+
This plugin must be installed in the same Python environment as SCT. Once installed,
|
|
90
|
+
the plugin is automatically discovered and registered by SCT through its entry-point
|
|
91
|
+
based plugin system; no additional configuration is required.
|
|
92
|
+
|
|
93
|
+
## Documentation
|
|
94
|
+
|
|
95
|
+
- [SCT documentation](https://opensource.aresys.it/sct/)
|
|
96
|
+
- [Quality Analysis documentation](https://opensource.aresys.it/perseo/documentation/quality/)
|
|
97
|
+
- [Analysis Plugins documentation](https://opensource.aresys.it/sct_plugins_analyses)
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
This project is licensed under the MIT License. See the [LICENSE.txt](LICENSE.txt) file for details.
|
|
102
|
+
|
|
103
|
+
Copyright © 2026-present Aresys S.r.l. <info@aresys.it>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
sct_notch_analysis/__init__.py,sha256=cQ7f6zW7dAjTHlqTQEKvk3LjG64RonaixJHjIIMlOeo,260
|
|
2
|
+
sct_notch_analysis/cli.py,sha256=qL26JrjVvuJ08cAhzshyq8XbAYIYEGgmgqLWsusY25Y,2833
|
|
3
|
+
sct_notch_analysis/config.py,sha256=nsSsnum0T-IQ7S5fRdEXtnMmtxr5quIGOiNvC0jIVvQ,1086
|
|
4
|
+
sct_notch_analysis/interface.py,sha256=V0A_uz-U-TgfWq38xkeqWIZCiSGdMuAuxa7Lcx3WIOI,1684
|
|
5
|
+
sct_notch_analysis/main.py,sha256=OSQQOmZFcu6ODmaQTciFjDMBdaPewfabE4weoBTGjYQ,2524
|
|
6
|
+
sct_notch_analysis/testing.py,sha256=c5ryl8SG1DM9vtvXqy4e9In8-CszlC5GXJRcerFnZhs,4822
|
|
7
|
+
sct_notch_analysis/core/__init__.py,sha256=QNw5ABy_pj4h3uL4XKrHmq6IzBJsxoyJ2wkyPC0kCi4,269
|
|
8
|
+
sct_notch_analysis/core/analysis.py,sha256=ftgvrjKsKlYAt4tDVoNhITYU55oJ9683AuMHkCq_GdM,2655
|
|
9
|
+
sct_notch_analysis/resources/__init__.py,sha256=8qVyjxbucCUmP0pEKv3Rg3yqjYKbtAijpHZEp6bkWI0,248
|
|
10
|
+
sct_notch_analysis/resources/config_schema.json,sha256=Mu3T6kls0WAMfpaRCEeI83NWOjAl25CM1bMeQi8Nzus,742
|
|
11
|
+
sct_notch_analysis-1.0.0.dev0.dist-info/METADATA,sha256=B8EU1u3uZDVSS1uka6MUrnepNCFfYTlrrAnX2qjO50Q,4618
|
|
12
|
+
sct_notch_analysis-1.0.0.dev0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
13
|
+
sct_notch_analysis-1.0.0.dev0.dist-info/entry_points.txt,sha256=cOLPBpnl6suXlDGTacDrXsMjvR3bQZEOmtpO_-aORU4,91
|
|
14
|
+
sct_notch_analysis-1.0.0.dev0.dist-info/licenses/LICENSE.txt,sha256=ghpoTMO3cD8pZJfaY7VtSv57JvZOsLuSCiysG-ERAuY,1103
|
|
15
|
+
sct_notch_analysis-1.0.0.dev0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (C) Aresys S.r.l. <info@aresys.it>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|