Skip to content

Commit 57d3286

Browse files
committed
only compute ouputs when in ouputFileList
bug only compute gamma when needed for output minor changes pep8
1 parent 7cebbb0 commit 57d3286

File tree

6 files changed

+272
-217
lines changed

6 files changed

+272
-217
lines changed

avaframe/com4FlowPy/com4FlowPy.py

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

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

545552
# Write Output Files to Disk
@@ -581,10 +588,10 @@ def mergeAndWriteResults(modelPaths, modelOptions):
581588
# if not modelOptions["infraBool"]: # if no infra
582589
# io.output_raster(modelPaths["demPath"], modelPaths["resDir"] / ("cell_counts%s" %(output_format)),cell_counts)
583590
# io.output_raster(modelPaths["demPath"], modelPaths["resDir"] / ("z_delta_sum%s" %(output_format)),z_delta_sum)
584-
if modelOptions["infraBool"]: # if infra
591+
if modelOptions["infraBool"] and 'backcalc' in _outputs: # if infra
585592
io.output_raster(modelPaths["demPath"], modelPaths["resDir"] / "com4_{}_{}_backcalculation{}".format(_uid,
586593
_ts, _oF), backcalc)
587-
if modelOptions["forestInteraction"]:
594+
if modelOptions["forestInteraction"] and 'forestInteraction' in _outputs:
588595
io.output_raster(modelPaths["demPath"], modelPaths["resDir"] / "com4_{}_{}_forestInteraction{}".format(_uid,
589596
_ts, _oF), forestInteraction)
590597

avaframe/com4FlowPy/com4FlowPyCfg.ini

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

207208
#++++++++++++ Custom paths True/False

avaframe/com4FlowPy/flowClass.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,6 @@ def calc_distribution(self):
374374
if self.forestBool and self.forestDetrainmentBool:
375375
self.forest_detrainment()
376376

377-
self.calc_fp_travelangle()
378-
self.calc_sl_travelangle()
379-
380377
# FOREST-Detrainment
381378
# here we subtract the detrainment from the flux before moving flux to new cells.
382379
if self.forestBool and self.forestDetrainmentBool:

0 commit comments

Comments
 (0)