Skip to content

Commit

Permalink
inspection fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Sep 28, 2020
1 parent b92de88 commit ca5d332
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
16 changes: 11 additions & 5 deletions ensemble_perturbation/configuration/adcirc.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime, timedelta
from glob import glob
import os
from os import PathLike
from pathlib import Path
import re
from shutil import copyfile
Expand Down Expand Up @@ -52,9 +53,14 @@ def write_adcirc_configurations(runs: {str: (float, str)},
:param output_directory: path to store run configuration
"""

if not os.path.exists(input_directory):
if not isinstance(input_directory, Path):
input_directory = Path(input_directory)
if not isinstance(output_directory, Path):
input_directory = Path(output_directory)

if not input_directory.exists():
os.makedirs(input_directory, exist_ok=True)
if not os.path.exists(output_directory):
if not output_directory.exists():
os.makedirs(output_directory, exist_ok=True)

fort14_filename = input_directory / "fort.14"
Expand Down Expand Up @@ -123,9 +129,9 @@ def write_adcirc_configurations(runs: {str: (float, str)},
driver.write(run_directory, overwrite=True)
nems.write(run_directory, overwrite=True)

copyfile(
repository_root() / 'ensemble_perturbation/configuration/slurm.job',
output_directory / 'slurm.job')
copyfile(repository_root() /
'ensemble_perturbation/configuration/slurm.job',
output_directory / 'slurm.job')

pattern = re.compile(' p*adcirc')
replacement = ' NEMS.x'
Expand Down
2 changes: 1 addition & 1 deletion ensemble_perturbation/configuration/seabed/seabed.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ def write(self, filename: PathLike, **kwargs):
extension = os.path.splitext(filename)[-1]
kwargs['driver'] = drivers[extension]

self.data.to_file(filename, **kwargs)
self.data.to_file(str(filename), **kwargs)
2 changes: 1 addition & 1 deletion ensemble_perturbation/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from shapely.geometry import Point


def repository_root(path: PathLike = None) -> str:
def repository_root(path: PathLike = None) -> Path:
if path is None:
path = __file__
if not isinstance(path, Path):
Expand Down

0 comments on commit ca5d332

Please sign in to comment.