Skip to content

Commit 1a2dcb4

Browse files
committed
Add a subsetter for network
1 parent cbf1267 commit 1a2dcb4

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
# network
4848
"EddyNetworkGroup = py_eddy_tracker.appli.network:build_network",
4949
"EddyNetworkBuildPath = py_eddy_tracker.appli.network:divide_network",
50+
"EddyNetworkSubSetter = py_eddy_tracker.appli.network:subset_network",
5051
# anim/gui
5152
"EddyAnim = py_eddy_tracker.appli.gui:anim",
5253
"GUIEddy = py_eddy_tracker.appli.gui:guieddy",

src/py_eddy_tracker/appli/network.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,24 @@ def divide_network():
5656
n.write_file(filename=args.out)
5757

5858

59-
def subsample_network():
60-
parser = EddyParser("Sub sample")
59+
def subset_network():
60+
parser = EddyParser("Subset network")
6161
parser.add_argument("input", help="input network file")
6262
parser.add_argument("out", help="output file")
63+
parser.add_argument(
64+
"--inverse_selection",
65+
action="store_true",
66+
help="Extract the inverse of selection",
67+
)
68+
parser.add_argument(
69+
"-l",
70+
"--length",
71+
nargs=2,
72+
type=int,
73+
help="Nb of day which must be cover by network, first minimum number of day and last maximum number of day,"
74+
"if value is negative, this bound won't be used",
75+
)
76+
args = parser.parse_args()
77+
n = NetworkObservations.load_file(args.input)
78+
n = n.longer_than(*args.length)
79+
n.write_file(filename=args.out)

0 commit comments

Comments
 (0)