Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
4 changes: 2 additions & 2 deletions debrisframe/c1Ti/c1Ti.py → debrisframe/c1Tif/c1Tif.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
from avaframe.com1DFA import com1DFA

# create local logger under avaframe namespace to use its logging configuration
log = logging.getLogger("avaframe.debrisframe.c1Ti")
log = logging.getLogger("avaframe.debrisframe.c1Tif")


def c1TiMain(cfgMain, debrisCfg):
def c1TifMain(cfgMain, debrisCfg):
"""Run and adjust parameters to match debris flow settings for com1DFA run,
result files, reports and plots are saved analog to a standard com1DFA model run

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
### Config File - This file contains the main settings for the debris flow simulation run
## Copy to local_c1TiCfg.ini and set your parameters
## Copy to local_c1TifCfg.ini and set your parameters


[GENERAL]

# so far no general parameters to be set as debris flow option is fully implemented in com1DFA
# hence checkout the com1DFA_override section

[com1DFA_com1DFA_override]

Expand Down
18 changes: 10 additions & 8 deletions debrisframe/runC1Ti.py → debrisframe/runC1Tif.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
from avaframe.in3Utils import fileHandlerUtils as fU

# import computation modules
# from debrisframe.c1Ti import c1Ti
from c1Ti import c1Ti
import debrisframe as debf
from debrisframe.c1Tif import c1Tif


def runC1Ti(debrisDir=""):
def runC1Tif(debrisDir=""):
"""Run com1DFA with debris flow parameters with only an avalanche/ debris flow directory as input

Parameters
Expand All @@ -35,12 +35,14 @@ def runC1Ti(debrisDir=""):
startTime = time.time()

# log file name; leave empty to use default runLog.log
logName = "runC1Ti"
logName = "runC1Tif"

# Load debris flow directory from general configuration file
# More information about the configuration can be found here
# on the Configuration page in the documentation
cfgMain = cfgUtils.getGeneralConfig(nameFile=pathlib.Path("debrisframeCfg.ini"))
modPath = pathlib.Path(debf.__file__).resolve().parent
cfgNameFile = modPath / "debrisframeCfg.ini"
cfgMain = cfgUtils.getGeneralConfig(nameFile=cfgNameFile)
if debrisDir != "":
cfgMain["MAIN"]["avalancheDir"] = debrisDir
# TODO: change avalancheDir to debrisDir
Expand All @@ -57,10 +59,10 @@ def runC1Ti(debrisDir=""):
initProj.cleanSingleAvaDir(debrisDir, deleteOutput=False)

# load debris flow config
DebrisCfg = cfgUtils.getModuleConfig(c1Ti)
DebrisCfg = cfgUtils.getModuleConfig(c1Tif)

# perform com1DFA simulation with debris flow settings
_, plotDict, reportDictList, _ = c1Ti.c1TiMain(cfgMain, DebrisCfg)
_, plotDict, reportDictList, _ = c1Tif.c1TifMain(cfgMain, DebrisCfg)

# Get peakfiles to return to QGIS
debrisDir = pathlib.Path(debrisDir)
Expand All @@ -86,4 +88,4 @@ def runC1Ti(debrisDir=""):
)
print(parser)
args = parser.parse_args()
runC1Ti(str(args.debrisdir))
runC1Tif(str(args.debrisdir))
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Pytest for module c1Ti
Pytest for module c1Tif
"""

# Load modules
Expand All @@ -8,16 +8,17 @@
import shutil
import pytest

from debrisframe.c1Ti import c1Ti
from debrisframe.c1Tif import c1Tif

from avaframe.in3Utils import cfgUtils

def test_runC1Ti(tmp_path):

def test_runC1Tif(tmp_path):
"""Check that runCom1DFA produces the good outputs"""

testDir = pathlib.Path(__file__).parents[0]
inputDir = testDir / "data" / "testC1Ti"
avaDir = pathlib.Path(tmp_path, "testC1Ti")
inputDir = testDir / "data" / "testC1Tif"
avaDir = pathlib.Path(tmp_path, "testC1Tif")
shutil.copytree(inputDir, avaDir)

cfgMain = configparser.ConfigParser()
Expand All @@ -30,13 +31,13 @@ def test_runC1Ti(tmp_path):
"debugPlot": "False",
}
# modCfg, modInfo = cfgUtils.getModuleConfig(com1DFA, fileOverride=cfgFile, modInfo=True)
modCfg, modInfo = cfgUtils.getModuleConfig(c1Ti, modInfo=True)
modCfg, modInfo = cfgUtils.getModuleConfig(c1Tif, modInfo=True)

modCfg['com1DFA_com1DFA_override']['rho'] = '1000'
modCfg['com1DFA_com1DFA_override']['explicitFriction'] = '0'
modCfg['com1DFA_com1DFA_override']['frictModel'] = 'Voellmy'

dem, plotDict, reportDictList, simDF = c1Ti.c1TiMain(cfgMain, modCfg)
dem, plotDict, reportDictList, simDF = c1Tif.c1TifMain(cfgMain, modCfg)

outDir = avaDir / "Outputs" / "com1DFA"
for ext in ["pft", "pfv", "ppr"]:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ change into your ``debrisframe`` directory (replace [YOURDIR] with your path fro


cd [YOURDIR]/DebrisFrame/debrisframe
python runC1Ti.py
python runC1Tif.py



Expand Down
Loading