I have three scripts running simultaneously that processes raster data in several directories. The problem I am encountering is that ArcGIS is creating a temporary grid file called 'Extract_recl1' when the Extract by Mask (Spatial Analyst) tool is called. The temporary file is created in a directory where it is looking for raster data. Seeing that I have several scripts running simultaneously, there is occasionally conflict where one script trys to run Extract By Mask and encounters 'Extract_recl1', which was created by Extract by Mask running in a different script. This is the error I receive:
ExecuteError: ERROR 010429: Error in GRID IO: CellLyrCreateInternal: Directory f:\mydirectory\reclass_new_classes\extract_recl1 already exists.ERROR 010302: Unable to create the output raster: F:\mydirectory\reclass_new_classes\Extract_recl1ERROR 010067: Error in executing grid expression.Failed to execute (ExtractByMask).I have tried to handle this situation by saving the raster object with a unique name to a temp directory and deleting the file upon completion:
# Extract by maskreclass_clp = ExtractByMask(reclass, mask_raster_temp)reclass_clp_temp = random_name_generator(temp_ws, "reclass_clp_temp", ".tif") # This is a function that generates a unique output namereclass_clp.save(reclass_clp_temp)# Do some processing...arcpy.Delete_management(reclass_clp_temp)I have also set the overwriteOutput environment to True.
arcpy.env.overwriteOutput = TrueHowever, neither of these seem to have any effect. What is the best way to handle temporary files created by Extract By Mask (Spatial Analyst)?
In other words, is there a way to force Extract by Mask to generate a unique name for the temp grid 'Extract_recl1'?
أكثر...
ExecuteError: ERROR 010429: Error in GRID IO: CellLyrCreateInternal: Directory f:\mydirectory\reclass_new_classes\extract_recl1 already exists.ERROR 010302: Unable to create the output raster: F:\mydirectory\reclass_new_classes\Extract_recl1ERROR 010067: Error in executing grid expression.Failed to execute (ExtractByMask).I have tried to handle this situation by saving the raster object with a unique name to a temp directory and deleting the file upon completion:
# Extract by maskreclass_clp = ExtractByMask(reclass, mask_raster_temp)reclass_clp_temp = random_name_generator(temp_ws, "reclass_clp_temp", ".tif") # This is a function that generates a unique output namereclass_clp.save(reclass_clp_temp)# Do some processing...arcpy.Delete_management(reclass_clp_temp)I have also set the overwriteOutput environment to True.
arcpy.env.overwriteOutput = TrueHowever, neither of these seem to have any effect. What is the best way to handle temporary files created by Extract By Mask (Spatial Analyst)?
In other words, is there a way to force Extract by Mask to generate a unique name for the temp grid 'Extract_recl1'?
أكثر...