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