AnsweredAssumed Answered

Python crashes when performing "Mosaic to New Raster."

Question asked by CNA142@mt.gov_MTDNRC on Nov 13, 2018
Latest reply on Nov 13, 2018 by CNA142@mt.gov_MTDNRC

I am working on a very long Python model that assesses habitat loss associated with development in Sage Grouse habitat in Montana.  


Part of this script combines a 32-bit-float rasters (values between 0-1) with a "dummy" extent raster (with values all 1) via Mosaic to New Raster using the "Minimum" mosaic method.  This is done to create standardized rasters for each type of disturbance that are used later for further raster math.  When performing this step with larger projects with a small pixel size (3.75 meters is our standard) Python.exe stops running and the script dies.  I don't get a specific error message, which leads me to believe it is some kind of memory issue that is beyond my knowledge.  Any insight would be useful.  


The top section of this section of code contains the 'if' statements where python crashes (again, this only occurs when the "PixelSize" variable that you see in the MosaicToNewRaster tuple is set earlier in the script to values below roughly 30 meters):

    if arcpy.Exists(RoadOutRastCalc):
        arcpy.MosaicToNewRaster_management([RoadOutRastCalc, extentMergeRaster], HQTOutputgdb, "DummyRoadsOps", "", "32_BIT_FLOAT", PixelSize, "1", "MINIMUM" )
    if arcpy.Exists(PlineOutRastCalc):
        arcpy.MosaicToNewRaster_management([PlineOutRastCalc, extentMergeRaster], HQTOutputgdb, "DummyPowerOps","", "32_BIT_FLOAT", PixelSize, "1", "MINIMUM" )
    if arcpy.Exists(GravOutRastCalc):
        arcpy.MosaicToNewRaster_management([GravOutRastCalc, extentMergeRaster], HQTOutputgdb, "DummyGravEtAlOps", "", "32_BIT_FLOAT", PixelSize, "1", "MINIMUM")
    if arcpy.Exists(TallRastCalc):
        arcpy.MosaicToNewRaster_management([TallRastCalc, extentMergeRaster], HQTOutputgdb, "DummyTallOps", "", "32_BIT_FLOAT", PixelSize, "1", "MINIMUM")
    if arcpy.Exists(AgMineRastCalc):
        arcpy.MosaicToNewRaster_management([AgMineRastCalc, extentMergeRaster], HQTOutputgdb, "DummyAgMine", "", "32_BIT_FLOAT", PixelSize, "1", "MINIMUM")
    if arcpy.Exists(SubsRastCalc):
        arcpy.MosaicToNewRaster_management([SubsRastCalc, extentMergeRaster], HQTOutputgdb, "DummySubs", "", "32_BIT_FLOAT", PixelSize, "1", "MINIMUM")

    ##Multiply Rasters Together Using List
    RasterList = [DummyGravEtAl, DummyPower, DummyRoads, DummyTall, DummyAgMine, DummySubs]
    MultiplierList =[]
    for i in RasterList:
        if arcpy.Exists(i):
    if len(MultiplierList) == 1:
        OperationsImpact = (Raster(MultiplierList[0]) * (DummyHQT))
    elif len(MultiplierList) == 2:
        OperationsImpact = (Raster(MultiplierList[0]) * Raster(MultiplierList[1]) * (DummyHQT))
    elif len(MultiplierList) == 3:
        OperationsImpact = (Raster(MultiplierList[0]) * Raster(MultiplierList[1]) * Raster(MultiplierList[2]) * (DummyHQT))
    elif len(MultiplierList) == 4:
        OperationsImpact = (Raster(MultiplierList[0]) * Raster(MultiplierList[1]) * Raster(MultiplierList[2]) * Raster(MultiplierList[3]) * (DummyHQT))
    elif len(MultiplierList) == 5:
        OperationsImpact = (Raster(MultiplierList[0]) * Raster(MultiplierList[1]) * Raster(MultiplierList[2]) * Raster(MultiplierList[3]) * Raster(MultiplierList[4]) * (DummyHQT))
    elif len(MultiplierList) == 6:
        OperationsImpact = (Raster(MultiplierList[0]) * Raster(MultiplierList[1]) * Raster(MultiplierList[2]) * Raster(MultiplierList[3]) * Raster(MultiplierList[4]) * Raster(MultiplierList[5]) * (DummyHQT))