@@ -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
0 commit comments