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
1 change: 1 addition & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ sigterm = true
omit = */test_*
*/__init__.py
*/run*
*/out3Plot/out*
9 changes: 7 additions & 2 deletions avaframe/ana3AIMEC/aimecTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,13 @@ def readAIMECinputs(avalancheDir, pathDict, defineRunoutArea, dirName='com1DFA')

referenceTypes = {"referenceLine": "LINE", "referencePolygon": "POLY",'referencePoint': 'POINT'}
for refType in referenceTypes:
referenceFile, availableFile = gI.getAndCheckInputFiles(referenceDir, 'REFDATA', referenceTypes[refType],
fileExt="shp", fileSuffix=referenceTypes[refType])
referenceFile, availableFile, _ = gI.getAndCheckInputFiles(
referenceDir,
"REFDATA",
referenceTypes[refType],
fileExt="shp",
fileSuffix=referenceTypes[refType],
)
if availableFile == 'Yes':
# add file paths to pathDict
pathDict[refType] = [referenceFile]
Expand Down
16 changes: 13 additions & 3 deletions avaframe/ana4Stats/probAna.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def updateCfgRange(cfg, cfgProb, varName, varDict):


def checkParameterSettings(cfg, varParList):
"""check if parameter settings in comMod configuration do not inlcude variation for parameters to be varied
"""check if parameter settings in comMod configuration do not include variation for parameters to be varied

Parameters
-----------
Expand Down Expand Up @@ -315,11 +315,11 @@ def checkParameterSettings(cfg, varParList):
log.error(message)
raise AssertionError(message)
elif varPar in ["entTh", "relTh", "secondaryRelTh"]:
thFromShp = varPar + "FromShp"
thFromFile = varPar + "FromFile"
# check if reference settings have already variation of varPar
_ = checkForNumberOfReferenceValues(cfg["GENERAL"], varPar)
# check if th read from shp file
if cfg["GENERAL"].getboolean(thFromShp):
if cfg["GENERAL"].getboolean(thFromFile):
thReadFromShp.append(varPar)

return True, thReadFromShp
Expand Down Expand Up @@ -821,6 +821,16 @@ def createSampleWithVariationForThParameters(

# fetch input files and corresponding thickness info
inputSimFiles = fetchThicknessInfo(avaDir)
fileTypeText = {".asc": "raster", ".tif": "raster", ".shp": "shapefile"}
for thFType in thReadFromShp:
if inputSimFiles["entResInfo"][thFType + "FileType"] != ".shp":
message = "%s file type: %s not a valid option for desired %s variation" % (
thFType,
fileTypeText[inputSimFiles["entResInfo"][thFType + "FileType"]],
thFType,
)
log.error(message)
raise AssertionError(message)

paramValuesDList = []
for iRel, relF in enumerate(inputSimFiles["relFiles"]):
Expand Down
573 changes: 401 additions & 172 deletions avaframe/com1DFA/com1DFA.py

Large diffs are not rendered by default.

28 changes: 15 additions & 13 deletions avaframe/com1DFA/com1DFACfg.ini
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,10 @@ rho = 200
rhoEnt = 100
##### Thickness is unambiguous: it is measured normal to the slope ####
#+++++Release thickness++++
# True if release thickness should be read from shapefile file; if False - relTh read from ini file
relThFromShp = True
# True if release thickness should be read from file (shapefile, raster); if False - relTh read from ini file, but only
# available for shapefile
relThFromFile = True
# VARIATION options only if REL file is a shapefile --------
# if a variation on relTh shall be performed add here +- percent and number of steps separated by $
# for example relThPercentVariation=50$10 [%]
relThPercentVariation =
Expand All @@ -81,17 +83,16 @@ relThRangeFromCiVariation =
# if variation on relTh shall be performed using a normal distribution in number of steps,
# value of buildType (ci95 value), min and max of dist in percent, buildType (ci95 only allowed),
# support (e.g. 10000) all separated by $: e.g. normaldistribution$numberOfSteps$0.3$95$ci95$10000
# if relThFromShp=True ci95 is read from shp file too
# if relThFromFile=True ci95 is read from shp file too
relThDistVariation =
# release thickness (only considered if relThFromShp=False) [m]
# release thickness (only considered if REL file is shapefile and relThFromFile=False) [m]
relTh =
# read release thickness directly from file (relThFromShp needs to be False)
relThFromFile = False
#+++++Secondary release thickness+++++
# if secRelArea is True - add secondary release area
secRelArea = True
# True if release thickness should be read from shapefile file; if False - secondaryRelTh read from ini file
secondaryRelThFromShp = True
# True if release thickness should be read from file (shapefile, raster); if False - secondaryRelTh read from ini file (only available for shapefile)
secondaryRelThFromFile = True
# VARIATION options only if SECREL file is a shapefile --------
# if a variation on secondaryRelTh shall be performed add here +- percent and number of steps separated by $
# for example secondaryRelThPercentVariation=50$10 [%]
secondaryRelThPercentVariation =
Expand All @@ -104,15 +105,16 @@ secondaryRelThRangeFromCiVariation =
# if variation on secondaryRelTh shall be performed using a normal distribution in number of steps,
# value of buildType (ci95 value), min and max of dist in percent, buildType (ci95 only allowed),
# support (e.g. 10000) all separated by $: e.g. normaldistribution$numberOfSteps$0.3$95$ci95$10000
# if secondaryRelThFromShp=True ci95 is read from shp file too
# if secondaryRelThFromFile=True ci95 is read from shp file too
secondaryRelThDistVariation =
# secondary area release thickness (only considered if secondaryRelThFromShp=False) [m]
# secondary area release thickness (only considered if SECREL file is shapefile and secondaryRelThFromFile=False) [m]
secondaryRelTh =
#+++++Entrainment thickness++++
# True if entrainment thickness should be read from shapefile file; if False - entTh read from ini file
entThFromShp = True
# True if entrainment thickness should be read from file (shapefile, raster); if False - entTh read from ini file (only available for shapefile)
entThFromFile = True
# if a thickness value is missing for the entrainment feature in the provided shp file this value is used for all features [m]
entThIfMissingInShp = 0.3
# VARIATION options only if ENT file is a shapefile --------
# if a variation on entTh shall be performed add here +- percent and number of steps separated by $
# for example entThPercentVariation=50$10 [%]
entThPercentVariation =
Expand All @@ -127,7 +129,7 @@ entThRangeFromCiVariation =
# support (e.g. 10000) all separated by $: e.g. normaldistribution$numberOfSteps$0.3$95$ci95$10000
# if entFromShp=True ci95 is read from shp file too
entThDistVariation =
# entrainment thickness (only considered if entThFromShp=False) [m]
# entrainment thickness (only considered if ENT file is shapefile and entThFromFile=False) [m]
entTh =

#++++++++++++Time stepping parameters
Expand Down
16 changes: 10 additions & 6 deletions avaframe/com1DFA/com1DFATools.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,19 +140,23 @@ def compareSimCfgToDefaultCfgCom1DFA(simCfg, module=com1DFA):

# If entrainment is requested, and it is set in shapefile, check if it contains the default entrainment thickness
# in ALL features of the shapefile
if simCfg["GENERAL"]["simTypeList"] == "ent" and simCfg["GENERAL"]["entThFromShp"] == "True":
if simCfg["GENERAL"]["simTypeList"] == "ent" and simCfg["GENERAL"]["entThFromFile"] == "True":
defaultEntTh = defCfg["GENERAL"]["entThIfMissingInShp"]

if not all([x == defaultEntTh for x in simCfg["INPUT"]["entThThickness"].split("|")]):
defaultIdentifierString = "C"
log.info("Non-default entrainment value(s) used: %s" % simCfg["INPUT"]["entThThickness"])
# this try handles raster instead of shapefile
try:
if not all([x == defaultEntTh for x in simCfg["INPUT"]["entThThickness"].split("|")]):
defaultIdentifierString = "C"
log.info("Non-default entrainment value(s) used: %s" % simCfg["INPUT"]["entThThickness"])
except KeyError:
defaultIdentifierString = "D"

# Entrainment might not be set in shpfile, but still the default from
# ini file is used. This is still default D and not changed C
if simCfg["GENERAL"]["entThFromShp"] == "False":
if simCfg["GENERAL"]["entThFromFile"] == "False":
# check if entTh is the default entTh if no other entTh is set
if simCfg["GENERAL"]["entTh"] == defCfg["GENERAL"]["entThIfMissingInShp"]:
excludeItems.append("root['GENERAL']['entThFromShp']")
excludeItems.append("root['GENERAL']['entThFromFile']")
excludeItems.append("root['GENERAL']['entTh']")

# sphKernelSize is set during runtime, make sure it is not reported
Expand Down
Loading
Loading