Skip to content

Commit 58532fb

Browse files
committed
black linter
1 parent 122d4d1 commit 58532fb

File tree

4 files changed

+69
-67
lines changed

4 files changed

+69
-67
lines changed

setup.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@
33

44
console_scripts = []
55

6-
console_scripts.append('{0}={1}.app:main'.format(find_packages('src')[0].replace('_', '-'),
7-
find_packages('src')[0]))
6+
console_scripts.append(
7+
"{0}={1}.app:main".format(find_packages("src")[0].replace("_", "-"), find_packages("src")[0])
8+
)
89

9-
setup(entry_points={'console_scripts': console_scripts},
10-
packages=find_packages(where='src'),
11-
package_dir={'': 'src'})
10+
setup(
11+
entry_points={"console_scripts": console_scripts},
12+
packages=find_packages(where="src"),
13+
package_dir={"": "src"},
14+
)

src/sar_calibration/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
__import__('pkg_resources').declare_namespace(__name__)
2-
1+
__import__("pkg_resources").declare_namespace(__name__)

src/sar_calibration/app.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,32 @@
22
import sys
33
import logging
44
import click
5-
#from snapista import Graph
5+
6+
# from snapista import Graph
67
from .calibration_s1 import graph_calibrate_s1
78

8-
logging.basicConfig(stream=sys.stderr,
9-
level=logging.DEBUG,
10-
format='%(asctime)s %(levelname)-8s %(message)s',
11-
datefmt='%Y-%m-%dT%H:%M:%S')
9+
logging.basicConfig(
10+
stream=sys.stderr,
11+
level=logging.DEBUG,
12+
format="%(asctime)s %(levelname)-8s %(message)s",
13+
datefmt="%Y-%m-%dT%H:%M:%S",
14+
)
1215

1316

1417
@click.command()
15-
@click.option('--safe',
16-
'safe',
17-
help='Path to Sentinel-1 SAFE folder')
18+
@click.option("--safe", "safe", help="Path to Sentinel-1 SAFE folder")
1819
def main(safe):
1920

20-
logging.info(f'{safe} calibration')
21+
logging.info(f"{safe} calibration")
2122

2223
graph = graph_calibrate_s1(safe)
2324

2425
logging.info(graph.view())
25-
26+
2627
graph.run()
2728

28-
logging.info('Hello World!')
29+
logging.info("Hello World!")
30+
2931

30-
if __name__ == '__main__':
32+
if __name__ == "__main__":
3133
main()

src/sar_calibration/calibration_s1.py

+46-48
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,56 @@
11
import os
22
from snapista import Graph, Operator
33

4+
45
def get_identifier(safe):
56

6-
return os.path.basename(safe).replace('.SAFE', '')
7+
return os.path.basename(safe).replace(".SAFE", "")
8+
79

810
def graph_calibrate_s1(safe):
911

1012
identifier = get_identifier(safe)
1113

12-
g = Graph()
13-
14-
g.add_node(operator=Operator('Read',
15-
formatName='SENTINEL-1',
16-
file=f'{safe}'),
17-
node_id='read')
18-
19-
20-
21-
g.add_node(operator=Operator('Apply-Orbit-File',
22-
continueOnFail='true'),
23-
node_id='apply-orbit-file',
24-
source='read')
25-
26-
27-
g.add_node(operator=Operator('Remove-GRD-Border-Noise',
28-
borderLimit='2000',
29-
trimThreshold='0.2'),
30-
node_id='noise-removal',
31-
source='apply-orbit-file')
32-
33-
g.add_node(operator=Operator('Calibration',
34-
selectedPolarisations='VV'),
35-
node_id='calibration',
36-
source='noise-removal')
37-
38-
39-
g.add_node(operator=Operator('LinearToFromdB',
40-
sourceBandNames='Sigma0_VV'),
41-
node_id='linear',
42-
source='calibration')
43-
44-
45-
46-
g.add_node(operator=Operator('Terrain-Correction',
47-
pixelSpacingInMeter='20.0',
48-
demName='SRTM 1Sec HGT'),
49-
node_id='terrain-correction',
50-
source='linear')
51-
52-
g.add_node(operator=Operator('Write',
53-
file=f'{identifier}_SIGMA0_DB',
54-
formatName='GeoTIFF-BigTIFF'),
55-
node_id='write',
56-
source='terrain-correction')
57-
58-
return g
14+
g = Graph()
15+
16+
g.add_node(operator=Operator("Read", formatName="SENTINEL-1", file=f"{safe}"), node_id="read")
17+
18+
g.add_node(
19+
operator=Operator("Apply-Orbit-File", continueOnFail="true"),
20+
node_id="apply-orbit-file",
21+
source="read",
22+
)
23+
24+
g.add_node(
25+
operator=Operator("Remove-GRD-Border-Noise", borderLimit="2000", trimThreshold="0.2"),
26+
node_id="noise-removal",
27+
source="apply-orbit-file",
28+
)
29+
30+
g.add_node(
31+
operator=Operator("Calibration", selectedPolarisations="VV"),
32+
node_id="calibration",
33+
source="noise-removal",
34+
)
35+
36+
g.add_node(
37+
operator=Operator("LinearToFromdB", sourceBandNames="Sigma0_VV"),
38+
node_id="linear",
39+
source="calibration",
40+
)
41+
42+
g.add_node(
43+
operator=Operator(
44+
"Terrain-Correction", pixelSpacingInMeter="20.0", demName="SRTM 1Sec HGT"
45+
),
46+
node_id="terrain-correction",
47+
source="linear",
48+
)
49+
50+
g.add_node(
51+
operator=Operator("Write", file=f"{identifier}_SIGMA0_DB", formatName="GeoTIFF-BigTIFF"),
52+
node_id="write",
53+
source="terrain-correction",
54+
)
55+
56+
return g

0 commit comments

Comments
 (0)