forked from AntSimi/py-eddy-tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEddyMergeCorrespondances
More file actions
44 lines (35 loc) · 1.15 KB
/
EddyMergeCorrespondances
File metadata and controls
44 lines (35 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Track eddy with Identification file produce with EddyIdentification
"""
import datetime as dt
import logging
from os import mkdir
from os.path import dirname, exists
from py_eddy_tracker import EddyParser
from py_eddy_tracker.tracking import Correspondances
logger = logging.getLogger("pet")
def usage():
"""Usage
"""
# Run using:
parser = EddyParser("Tool to use identification step to compute tracking")
parser.add_argument(
"nc_file",
nargs="+",
help="File of correspondances to reload link " "without tracking computation",
)
parser.add_argument("path_out", help="Path, where to write file")
return parser.parse_args()
if __name__ == "__main__":
CONFIG = usage()
# Create output directory
if not exists(dirname(CONFIG.path_out)):
mkdir(dirname(CONFIG.path_out))
START_TIME = dt.datetime.now()
CORRESPONDANCES = Correspondances.load(CONFIG.nc_file[0])
logger.info("Start merging")
for i in CONFIG.nc_file[1:]:
CORRESPONDANCES.merge_correspondance(Correspondances.load(i))
CORRESPONDANCES.save(CONFIG.path_out)