Skip to content

Commit e2da2b7

Browse files
committed
only compute ouputs when in ouputFileList
bug only compute gamma when needed for output minor changes pep8
1 parent bff5409 commit e2da2b7

File tree

6 files changed

+271
-216
lines changed

6 files changed

+271
-216
lines changed

avaframe/com4FlowPy/com4FlowPy.py

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -525,20 +525,27 @@ def mergeAndWriteResults(modelPaths, modelOptions):
525525
log.info("-------------------------")
526526

527527
# Merge calculated tiles
528-
zDelta = SPAM.mergeRaster(modelPaths["tempDir"], "res_z_delta")
529-
flux = SPAM.mergeRaster(modelPaths["tempDir"], "res_flux")
530-
cellCounts = SPAM.mergeRaster(modelPaths["tempDir"], "res_count", method='sum')
531-
zDeltaSum = SPAM.mergeRaster(modelPaths["tempDir"], "res_z_delta_sum", method='sum')
532-
routFluxSum = SPAM.mergeRaster(modelPaths["tempDir"], "res_rout_flux_sum", method='sum')
533-
depFluxSum = SPAM.mergeRaster(modelPaths["tempDir"], "res_dep_flux_sum", method='sum')
534-
fpTa = SPAM.mergeRaster(modelPaths["tempDir"], "res_fp")
535-
slTa = SPAM.mergeRaster(modelPaths["tempDir"], "res_sl")
536-
travelLength = SPAM.mergeRaster(modelPaths["tempDir"], "res_travel_length")
537-
538-
if modelOptions["infraBool"]:
528+
if 'zDelta' in _outputs:
529+
zDelta = SPAM.mergeRaster(modelPaths["tempDir"], "res_z_delta")
530+
if 'flux' in _outputs:
531+
flux = SPAM.mergeRaster(modelPaths["tempDir"], "res_flux")
532+
if 'cellCounts' in _outputs:
533+
cellCounts = SPAM.mergeRaster(modelPaths["tempDir"], "res_count", method='sum')
534+
if 'zDeltaSum' in _outputs:
535+
zDeltaSum = SPAM.mergeRaster(modelPaths["tempDir"], "res_z_delta_sum", method='sum')
536+
if 'routFluxSum' in _outputs:
537+
routFluxSum = SPAM.mergeRaster(modelPaths["tempDir"], "res_rout_flux_sum", method='sum')
538+
if 'depFluxSum' in _outputs:
539+
depFluxSum = SPAM.mergeRaster(modelPaths["tempDir"], "res_dep_flux_sum", method='sum')
540+
if 'fpTravelAngle' in _outputs:
541+
fpTa = SPAM.mergeRaster(modelPaths["tempDir"], "res_fp")
542+
if 'slTravelAngle' in _outputs:
543+
slTa = SPAM.mergeRaster(modelPaths["tempDir"], "res_sl")
544+
if 'travelLength' in _outputs:
545+
travelLength = SPAM.mergeRaster(modelPaths["tempDir"], "res_travel_length")
546+
if modelOptions["infraBool"] and 'backcalc' in _outputs:
539547
backcalc = SPAM.mergeRaster(modelPaths["tempDir"], "res_backcalc")
540-
541-
if modelOptions["forestInteraction"]:
548+
if modelOptions["forestInteraction"] and 'forestInteraction' in _outputs:
542549
forestInteraction = SPAM.mergeRaster(modelPaths["tempDir"], "res_forestInt", method='min')
543550

544551
# Write Output Files to Disk
@@ -580,10 +587,10 @@ def mergeAndWriteResults(modelPaths, modelOptions):
580587
# if not modelOptions["infraBool"]: # if no infra
581588
# io.output_raster(modelPaths["demPath"], modelPaths["resDir"] / ("cell_counts%s" %(output_format)),cell_counts)
582589
# io.output_raster(modelPaths["demPath"], modelPaths["resDir"] / ("z_delta_sum%s" %(output_format)),z_delta_sum)
583-
if modelOptions["infraBool"]: # if infra
590+
if modelOptions["infraBool"] and 'backcalc' in _outputs: # if infra
584591
io.output_raster(modelPaths["demPath"], modelPaths["resDir"] / "com4_{}_{}_backcalculation{}".format(_uid,
585592
_ts, _oF), backcalc)
586-
if modelOptions["forestInteraction"]:
593+
if modelOptions["forestInteraction"] and 'forestInteraction' in _outputs:
587594
io.output_raster(modelPaths["demPath"], modelPaths["resDir"] / "com4_{}_{}_forestInteraction{}".format(_uid,
588595
_ts, _oF), forestInteraction)
589596

avaframe/com4FlowPy/com4FlowPyCfg.ini

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,9 @@ outputFileFormat = .tif
201201
# zDeltaSum
202202
# routFluxSum
203203
# depFluxSum
204-
# if forestInteraction: forestInteraction is automatically added to outputs
205-
# if infra: backCalculation is automatically added to output
204+
# forestInteraction
205+
# backalc
206+
206207
outputFiles = zDelta|cellCounts|travelLength|fpTravelAngle
207208

208209
#++++++++++++ Custom paths True/False

avaframe/com4FlowPy/flowClass.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,9 +351,6 @@ def calc_distribution(self):
351351
if self.forestBool and self.forestDetrainmentBool:
352352
self.forest_detrainment()
353353

354-
self.calc_fp_travelangle()
355-
self.calc_sl_travelangle()
356-
357354
# FOREST-Detrainment
358355
# here we subtract the detrainment from the flux before moving flux to new cells.
359356
if self.forestBool and self.forestDetrainmentBool:

0 commit comments

Comments
 (0)