Skip to content

Commit 1c121c0

Browse files
awirbfso42
authored andcommitted
add writing of ref DF in aimec
1 parent 128cae3 commit 1c121c0

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

avaframe/ana3AIMEC/aimecTools.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,15 @@ def readAIMECinputs(avalancheDir, pathDict, defineRunoutArea, dirName='com1DFA')
9999
# check for reference data
100100
referenceDir= pathlib.Path(avalancheDir, 'Inputs')
101101

102+
# file names need to contain: _LINE, _POLY, _POINT
102103
referenceTypes = {"referenceLine": "LINE", "referencePolygon": "POLY",'referencePoint': 'POINT'}
103104
for refType in referenceTypes:
104105
referenceFile, availableFile, _ = gI.getAndCheckInputFiles(
105106
referenceDir,
106107
"REFDATA",
107108
referenceTypes[refType],
108109
fileExt="shp",
109-
fileSuffix=referenceTypes[refType],
110+
fileSuffix=("_" + referenceTypes[refType]),
110111
)
111112
if availableFile == 'Yes':
112113
# add file paths to pathDict
@@ -1643,6 +1644,7 @@ def createReferenceDF(pathDict):
16431644
newLine = newLine.set_index(hashRef)
16441645
referenceDF = pd.concat([referenceDF, newLine], ignore_index=False)
16451646
referenceDF.loc[hashRef, 'dataType'] = 'reference'
1647+
referenceDF.loc[hashRef, "reference_Type"] = refFile.stem.split("_")[1]
16461648

16471649
# TODO add here if additional info read from shp or a textfile?
16481650

avaframe/ana3AIMEC/ana3AIMEC.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,9 @@ def mainAIMEC(pathDict, inputsDF, cfg):
152152
if cfgSetup.getboolean('includeReference'):
153153
referenceDF = aimecTools.createReferenceDF(pathDict)
154154
refDataTransformed, referenceDF = postProcessReference(cfg, rasterTransfo, pathDict, referenceDF, newRasters)
155+
# save resultsDF to file
156+
referenceDFPath = pathlib.Path(pathDict["pathResult"], "referenceDF.csv")
157+
referenceDF.to_csv(referenceDFPath)
155158
else:
156159
refDataTransformed = {}
157160

@@ -178,7 +181,7 @@ def mainAIMEC(pathDict, inputsDF, cfg):
178181
if sorted(pathDict['resTypeList']) == sorted(['ppr', 'pft', 'pfv']) and cfgPlots.getboolean('extraPlots'):
179182
outAimec.visuSimple(cfgSetup, rasterTransfo, resAnalysisDF, newRasters, pathDict)
180183
if len(resAnalysisDF.index) == 2 and sorted(pathDict['resTypeList']) == sorted(['ppr', 'pft', 'pfv']):
181-
plotName = outAimec.visuRunoutComp(rasterTransfo, resAnalysisDF, cfgSetup, pathDict)
184+
plotName = outAimec.visuRunoutComp(rasterTransfo, resAnalysisDF, cfgSetup, pathDict)
182185

183186
plotName = outAimec.visuRunoutStat(rasterTransfo, inputsDF, resAnalysisDF, newRasters, cfgSetup, pathDict)
184187

@@ -415,9 +418,9 @@ def postProcessAIMEC(cfg, rasterTransfo, pathDict, resAnalysisDF, newRasters, ti
415418

416419

417420
def postProcessReference(cfg, rasterTransfo, pathDict, referenceDF, newRasters):
418-
""" Apply domain transformation and analyse reference data, e.g. compute runout point
421+
"""Apply domain transformation and analyse reference data, e.g. compute runout point
419422
420-
Apply the domain tranformation to reference data sets
423+
Apply the domain transformation to reference data sets
421424
Analyse them.
422425
Calculate runout
423426

0 commit comments

Comments
 (0)