diff --git a/qcore/archive_structure.py b/qcore/archive_structure.py new file mode 100644 index 00000000..8f4abb90 --- /dev/null +++ b/qcore/archive_structure.py @@ -0,0 +1,27 @@ +""" +Gives access to the folder structure of archived cybershake directories +""" +from pathlib import Path + +from .simulation_structure import get_fault_from_realisation + + +def get_fault_source_dir(fault_dir: Path): + """Gets the Source directory for the given fault directory""" + return fault_dir / "Source" + + +def get_fault_im_dir(fault_dir: Path): + """Gets the IM directory for the given fault directory""" + return fault_dir / "IM" + + +def get_fault_bb_dir(fault_dir: Path): + """Gets the BB directory for the given fault directory""" + return fault_dir / "BB" + + +def get_IM_csv_from_root(archive_root: Path, realisation: str): + """Gets the full path to the im_csv file given the archive root dir and the realistion name""" + fault_name = get_fault_from_realisation(realisation) + return get_fault_im_dir(archive_root / fault_name) / f"{realisation}.csv" diff --git a/qcore/simulation_structure.py b/qcore/simulation_structure.py index c72dce39..0531beaa 100644 --- a/qcore/simulation_structure.py +++ b/qcore/simulation_structure.py @@ -221,6 +221,13 @@ def get_IM_csv(sim_root): ) +def get_IM_csv_from_root(cybershake_root, realisation): + return os.path.join( + get_im_calc_dir(get_sim_dir(cybershake_root, realisation)), + "{}.{}".format(realisation, "csv"), + ) + + def get_IM_info(sim_root): return os.path.join( get_im_calc_dir(sim_root),