I have a problem saving my output from the following script. I can see an un-displayable image at the intended location with the same name as the first intended output. Mostly my gis crashes down and creates an error report. I have checked my code against the ones on the internet i cannot find any problem with it, but i am not an expert. I have set up the following script based on the help I got from my previous question at stack exchange and it worked fine previously quite a few time.
I am able to use raster calculator without any problem but i want to create this script to speed up the process as i have to repeat this process a lot and raster calculator gives a single output whereas i need one for each statement. I have 14 variables at the moment i am testing only on two (r1, r2)
i have tried the following things to mitigate
1- Changed the type of output (Tif, or native gis raster format)
2- Reduced the number of directories
3- Place input raster in a Geo database or normal windows folder
4- Place the output in Geo database or normal windows folder
5- Delete temporary files from the "appdata" folder(One of my friends had the
same problem and this solved his problem but not solving mine)
6- In the following script i have separated the conditional statement and the con.save statement but i have also tried a script that places them together for both task that didn't work either ( i think location of con.save statement doesn't matter. does it?)
7- Change the extent and cell size to "Max off" and "Min off"
import arcpy, osfrom arcpy import envfrom arcpy.sa import *# Set the current workspaceenv.workspace = r"Geodatabase Location"# Set Extentarcpy.env.extent = r"File Location"# set cell sizearcpy.env.cellSize = r"File Location"print("Processing: extant Complete") print("Processing: Cell size Complete") # Set local variablesr1 = "g2001.tif"r2 = "g2002.tif"# Execute Conditional Statement 1print("Processing: Con r1 > r2") con1 = arcpy.sa.Con(r1 > r2, 1, 0)print("Processing: Con r1 > r2 Complete.......") # Execute Conditional Statement 2print("Processing: Con r1 > r3") con2 = arcpy.sa.Con(r1 > r3, 1, 0)print("Processing: Con r1 > r3 Complete.......") # Save the output con1.save(r"Location of Output")print("Saved: Conditional 1") con2.save(r"Location of Output2")print("Saved: Conditional 2")
أكثر...
I am able to use raster calculator without any problem but i want to create this script to speed up the process as i have to repeat this process a lot and raster calculator gives a single output whereas i need one for each statement. I have 14 variables at the moment i am testing only on two (r1, r2)
i have tried the following things to mitigate
1- Changed the type of output (Tif, or native gis raster format)
2- Reduced the number of directories
3- Place input raster in a Geo database or normal windows folder
4- Place the output in Geo database or normal windows folder
5- Delete temporary files from the "appdata" folder(One of my friends had the
same problem and this solved his problem but not solving mine)
6- In the following script i have separated the conditional statement and the con.save statement but i have also tried a script that places them together for both task that didn't work either ( i think location of con.save statement doesn't matter. does it?)
7- Change the extent and cell size to "Max off" and "Min off"
import arcpy, osfrom arcpy import envfrom arcpy.sa import *# Set the current workspaceenv.workspace = r"Geodatabase Location"# Set Extentarcpy.env.extent = r"File Location"# set cell sizearcpy.env.cellSize = r"File Location"print("Processing: extant Complete") print("Processing: Cell size Complete") # Set local variablesr1 = "g2001.tif"r2 = "g2002.tif"# Execute Conditional Statement 1print("Processing: Con r1 > r2") con1 = arcpy.sa.Con(r1 > r2, 1, 0)print("Processing: Con r1 > r2 Complete.......") # Execute Conditional Statement 2print("Processing: Con r1 > r3") con2 = arcpy.sa.Con(r1 > r3, 1, 0)print("Processing: Con r1 > r3 Complete.......") # Save the output con1.save(r"Location of Output")print("Saved: Conditional 1") con2.save(r"Location of Output2")print("Saved: Conditional 2")
أكثر...