Skip to content

Commit

Permalink
Add a key for optional soil thickness layer csv file
Browse files Browse the repository at this point in the history
Co-authored-by: SarahAlidoost <[email protected]>
  • Loading branch information
MostafaGomaa93 and SarahAlidoost authored Aug 23, 2024
1 parent c8e5955 commit ed456c3
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions PyStemmusScope/config_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,16 @@ def _copy_data(input_dir: Path, config: dict) -> None:

# copy input_data.xlsx
shutil.copy(str(config["input_data"]), str(input_dir))
soilLay_file = Path(str(config["input_data"]).replace("input_data.xlsx", "input_soilLayThick.csv"))
if soilLay_file.exists():
shutil.copy(soilLay_file, str(input_dir))
# copy soil_layers_thickness, this is optional
if "soil_layers_thickness" in config:
if Path(config["soil_layers_thickness"]).is_file():
shutil.copy(str(config["soil_layers_thickness"]), str(input_dir))
else:
raise FileNotFoundError(
"The key `soil_layers_thickness` is provided in the config file, "
f"but file {config['soil_layers_thickness']} not found. "
"Remove the key from the config file or provide the file."
)

def _update_config_file(
input_dir: Path,
Expand Down

0 comments on commit ed456c3

Please sign in to comment.