Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[com4]: Select raster computation depending on output files #1075

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
37 changes: 22 additions & 15 deletions avaframe/com4FlowPy/com4FlowPy.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,20 +525,27 @@ def mergeAndWriteResults(modelPaths, modelOptions):
log.info("-------------------------")

# Merge calculated tiles
zDelta = SPAM.mergeRaster(modelPaths["tempDir"], "res_z_delta")
flux = SPAM.mergeRaster(modelPaths["tempDir"], "res_flux")
cellCounts = SPAM.mergeRaster(modelPaths["tempDir"], "res_count", method='sum')
zDeltaSum = SPAM.mergeRaster(modelPaths["tempDir"], "res_z_delta_sum", method='sum')
routFluxSum = SPAM.mergeRaster(modelPaths["tempDir"], "res_rout_flux_sum", method='sum')
depFluxSum = SPAM.mergeRaster(modelPaths["tempDir"], "res_dep_flux_sum", method='sum')
fpTa = SPAM.mergeRaster(modelPaths["tempDir"], "res_fp")
slTa = SPAM.mergeRaster(modelPaths["tempDir"], "res_sl")
travelLength = SPAM.mergeRaster(modelPaths["tempDir"], "res_travel_length")

if modelOptions["infraBool"]:
if 'zDelta' in _outputs:
zDelta = SPAM.mergeRaster(modelPaths["tempDir"], "res_z_delta")
if 'flux' in _outputs:
flux = SPAM.mergeRaster(modelPaths["tempDir"], "res_flux")
if 'cellCounts' in _outputs:
cellCounts = SPAM.mergeRaster(modelPaths["tempDir"], "res_count", method='sum')
if 'zDeltaSum' in _outputs:
zDeltaSum = SPAM.mergeRaster(modelPaths["tempDir"], "res_z_delta_sum", method='sum')
if 'routFluxSum' in _outputs:
routFluxSum = SPAM.mergeRaster(modelPaths["tempDir"], "res_rout_flux_sum", method='sum')
if 'depFluxSum' in _outputs:
depFluxSum = SPAM.mergeRaster(modelPaths["tempDir"], "res_dep_flux_sum", method='sum')
if 'fpTravelAngle' in _outputs:
fpTa = SPAM.mergeRaster(modelPaths["tempDir"], "res_fp")
if 'slTravelAngle' in _outputs:
slTa = SPAM.mergeRaster(modelPaths["tempDir"], "res_sl")
if 'travelLength' in _outputs:
travelLength = SPAM.mergeRaster(modelPaths["tempDir"], "res_travel_length")
if modelOptions["infraBool"] and 'backcalc' in _outputs:
backcalc = SPAM.mergeRaster(modelPaths["tempDir"], "res_backcalc")

if modelOptions["forestInteraction"]:
if modelOptions["forestInteraction"] and 'forestInteraction' in _outputs:
forestInteraction = SPAM.mergeRaster(modelPaths["tempDir"], "res_forestInt", method='min')

# Write Output Files to Disk
Expand Down Expand Up @@ -580,10 +587,10 @@ def mergeAndWriteResults(modelPaths, modelOptions):
# if not modelOptions["infraBool"]: # if no infra
# io.output_raster(modelPaths["demPath"], modelPaths["resDir"] / ("cell_counts%s" %(output_format)),cell_counts)
# io.output_raster(modelPaths["demPath"], modelPaths["resDir"] / ("z_delta_sum%s" %(output_format)),z_delta_sum)
if modelOptions["infraBool"]: # if infra
if modelOptions["infraBool"] and 'backcalc' in _outputs: # if infra
io.output_raster(modelPaths["demPath"], modelPaths["resDir"] / "com4_{}_{}_backcalculation{}".format(_uid,
_ts, _oF), backcalc)
if modelOptions["forestInteraction"]:
if modelOptions["forestInteraction"] and 'forestInteraction' in _outputs:
io.output_raster(modelPaths["demPath"], modelPaths["resDir"] / "com4_{}_{}_forestInteraction{}".format(_uid,
_ts, _oF), forestInteraction)

Expand Down
5 changes: 3 additions & 2 deletions avaframe/com4FlowPy/com4FlowPyCfg.ini
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,9 @@ outputFileFormat = .tif
# zDeltaSum
# routFluxSum
# depFluxSum
# if forestInteraction: forestInteraction is automatically added to outputs
# if infra: backCalculation is automatically added to output
# forestInteraction
# backalc

outputFiles = zDelta|cellCounts|travelLength|fpTravelAngle

#++++++++++++ Custom paths True/False
Expand Down
3 changes: 0 additions & 3 deletions avaframe/com4FlowPy/flowClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,9 +351,6 @@ def calc_distribution(self):
if self.forestBool and self.forestDetrainmentBool:
self.forest_detrainment()

self.calc_fp_travelangle()
self.calc_sl_travelangle()

# FOREST-Detrainment
# here we subtract the detrainment from the flux before moving flux to new cells.
if self.forestBool and self.forestDetrainmentBool:
Expand Down
Loading
Loading