Skip to content

Commit

Permalink
Merge pull request #15 from equinor/add-conf-path
Browse files Browse the repository at this point in the history
Add conf path
  • Loading branch information
adnejacobsen authored Nov 16, 2023
2 parents e8e25a0 + ff808c2 commit 96a3fba
Showing 1 changed file with 23 additions and 6 deletions.
29 changes: 23 additions & 6 deletions src/fmu/sumo/sim2sumo/sim2sumo.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ def give_name(datafile_path: str) -> str:
str: derived name
"""
datafile_path_posix = Path(datafile_path)
base_name = datafile_path_posix.name.replace(datafile_path_posix.suffix, "")
base_name = datafile_path_posix.name.replace(
datafile_path_posix.suffix, ""
)
while base_name[-1].isdigit() or base_name.endswith("-"):
base_name = base_name[:-1]
return base_name
Expand Down Expand Up @@ -175,7 +177,9 @@ def read_config(config, datafile=None, datatype=None):
try:
simconfig = config["sim2sumo"]
except KeyError:
logger.warning("No specification in config, will use defaults %s", defaults)
logger.warning(
"No specification in config, will use defaults %s", defaults
)
simconfig = defaults
if isinstance(simconfig, bool):
simconfig = defaults
Expand Down Expand Up @@ -263,7 +267,14 @@ def export_with_config(config_path, datafile=None, datatype=None):
return export_folder, suffixes


def upload(upload_folder, suffixes, env="prod", threads=5, start_del="real"):
def upload(
upload_folder,
suffixes,
env="prod",
threads=5,
start_del="real",
config_path="fmuconfig/output/global_variables.yml",
):
"""Upload to sumo
Args:
Expand All @@ -288,6 +299,7 @@ def upload(upload_folder, suffixes, env="prod", threads=5, start_del="real"):
env,
case_meta_path,
threads,
config_path,
)
logger.debug("Uploaded")
except TypeError:
Expand Down Expand Up @@ -399,8 +411,11 @@ def upload_with_config(config_path, datafile, datatype, env):
logger.debug("Executing with:")
logger.debug("config: %s: ", config_path)
logger.debug("Sumo env: %s: ", env)
upload_folder, suffixes = export_with_config(config_path, datafile, datatype)
upload(upload_folder, suffixes, env)

upload_folder, suffixes = export_with_config(
config_path, datafile, datatype
)
upload(upload_folder, suffixes, env, config_path=config_path)


def main():
Expand All @@ -410,7 +425,9 @@ def main():
try:
print(give_help(args.help_on))
except AttributeError:
upload_with_config(args.config_path, args.datafile, args.datatype, args.env)
upload_with_config(
args.config_path, args.datafile, args.datatype, args.env
)


if __name__ == "__main__":
Expand Down

0 comments on commit 96a3fba

Please sign in to comment.