Skip to content

Commit 5cbc116

Browse files
committed
add a intern option in common parser
1 parent a91a226 commit 5cbc116

File tree

4 files changed

+11
-20
lines changed

4 files changed

+11
-20
lines changed

src/py_eddy_tracker/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ def memory_arg(self):
9292
help="Load file in memory before to read with netCDF library",
9393
)
9494

95+
def contour_intern_arg(self):
96+
self.add_argument(
97+
"--intern",
98+
action="store_true",
99+
help="Use intern contour instead of outter contour",
100+
)
101+
95102
def parse_args(self, *args, **kwargs):
96103
logger = start_logger()
97104
# Parsing

src/py_eddy_tracker/appli/eddies.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,7 @@ def get_frequency_grid():
7676
parser = EddyParser("Compute eddy frequency")
7777
parser.add_argument("observations", help="Input observations to compute frequency")
7878
parser.add_argument("out", help="Grid output file")
79-
parser.add_argument(
80-
"--intern",
81-
help="Use speed contour instead of effective contour",
82-
action="store_true",
83-
)
79+
parser.contour_intern_arg()
8480
parser.add_argument(
8581
"--xrange", nargs="+", type=float, help="Horizontal range : START,STOP,STEP"
8682
)

src/py_eddy_tracker/appli/gui.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,7 @@ def anim():
177177
)
178178
parser.add_argument("filename", help="eddy atlas")
179179
parser.add_argument("id", help="Track id to anim", type=int, nargs="*")
180-
parser.add_argument(
181-
"--intern",
182-
action="store_true",
183-
help="display intern contour inplace of outter contour",
184-
)
180+
parser.contour_intern_arg()
185181
parser.add_argument(
186182
"--keep_step", default=25, help="number maximal of step displayed", type=int
187183
)

src/py_eddy_tracker/appli/network.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@ def build_network():
2727
parser.add_argument(
2828
"--window", "-w", type=int, help="Half time window to search eddy", default=1
2929
)
30-
parser.add_argument(
31-
"--intern",
32-
action="store_true",
33-
help="Use intern contour instead of outter contour",
34-
)
30+
parser.contour_intern_arg()
3531

3632
parser.memory_arg()
3733
args = parser.parse_args()
@@ -50,11 +46,7 @@ def divide_network():
5046
parser = EddyParser("Separate path for a same group")
5147
parser.add_argument("input", help="input network file")
5248
parser.add_argument("out", help="output file")
53-
parser.add_argument(
54-
"--intern",
55-
action="store_true",
56-
help="Use intern contour instead of outter contour",
57-
)
49+
parser.contour_intern_arg()
5850
parser.add_argument(
5951
"--window", "-w", type=int, help="Half time window to search eddy", default=1
6052
)

0 commit comments

Comments
 (0)