Skip to content

Commit

Permalink
Copy troika sites if missing as a part of setup (#7)
Browse files Browse the repository at this point in the history
* Copy troika sites if missing as a part of setup

* Adapt workflow
  • Loading branch information
trygveasp authored Sep 27, 2023
1 parent 4f1f669 commit 70eb651
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions experiment/setup/setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
"""PySurfexExpSetup functionality."""
import os
import shutil
import sys
from argparse import ArgumentParser
from pathlib import Path

import troika

try:
import pysurfex
Expand Down Expand Up @@ -231,3 +235,17 @@ def surfex_script_setup(**kwargs):
exp_dependencies, config_settings=merged_config, loglevel=loglevel
)
sfx_exp.dump_json(output_file, indent=2)

files = [
f
for f in (Path(pysurfex_experiment) / "experiment" / "troika" / "sites").iterdir()
if f.is_file()
]
troika_path = Path(troika.__path__[0]) / "sites"
for fobj in files:
target = Path(troika_path) / fobj.name
if not target.exists():
logger.info("Copy %s to %s", fobj, target)
shutil.copy(fobj, target)
else:
logger.debug("Taget %s exists", target)

0 comments on commit 70eb651

Please sign in to comment.