Skip to content

Commit 7e6017a

Browse files
committed
Instead of result eddyquickcompare could produce file for each group
1 parent bdabfe6 commit 7e6017a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/py_eddy_tracker/appli/eddies.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,6 @@ def quick_compare():
463463
)
464464
parser.contour_intern_arg()
465465
args = parser.parse_args()
466-
if args.path_out is not None and not exists(args.path_out):
467-
mkdir(args.path_out)
468466

469467
kw = dict(
470468
include_vars=[
@@ -475,6 +473,9 @@ def quick_compare():
475473
if args.area:
476474
kw["include_vars"].append("speed_area" if args.intern else "effective_area")
477475

476+
if args.path_out is not None:
477+
kw = dict()
478+
478479
ref = EddiesObservations.load_file(args.ref, **kw)
479480
print(f"[ref] {args.ref} -> {len(ref)} obs")
480481
groups_ref, groups_other = dict(), dict()
@@ -493,6 +494,21 @@ def quick_compare():
493494
groups_ref[other_] = gr1
494495
groups_other[other_] = gr2
495496

497+
if args.path_out is not None:
498+
if not exists(args.path_out):
499+
mkdir(args.path_out)
500+
for i, other_ in enumerate(args.others):
501+
dirname_ = f"{args.path_out}/{other_.replace('/', '_')}/"
502+
if not exists(dirname_):
503+
mkdir(dirname_)
504+
for k, v in groups_other[other_].items():
505+
basename_ = f"other_{k}.nc"
506+
others[other_].index(v).write_file(filename=f"{dirname_}/{basename_}")
507+
for k, v in groups_ref[other_].items():
508+
basename_ = f"ref_{k}.nc"
509+
ref.index(v).write_file(filename=f"{dirname_}/{basename_}")
510+
return
511+
496512
def display(value, ref=None):
497513
outs = list()
498514
for v in value:

0 commit comments

Comments
 (0)