I am trying to calculate Area solar radiation for rasters in a list.
It seems that the tool allows to create unique rasters for direct, diffuse and direct radiation duration, and calculates
outGlobalRadiation as the final output.
But, when I define the names for the
direct radiation duration rasters, I got back an error
RuntimeError: ERROR 000732: Input Raster: Dataset dir_1 does not exist or is not supported meaning, that my optional output file is actually considered as
Input Raster, and does not exist.
Do you understand this error? Or is there any logical error in my script?
import arcpy, os from arcpy.sa import * arcpy.CheckOutExtension("spatial") # Get path inWD = "C:/Users/2019_bioESS_coord" # Set working environment arcpy.env.workspace = os.path.join(inWD, "output/bufRastTwins.gdb") arcpy.env.overwriteOutput = True # List all rasters rasters= arcpy.ListRasters("r_*") # Calculate solar radiation with defined optional outputs for raster in rasters: # Define names for output optional rasters outNameDirect = "dir_" + raster.replace("r_", "") outNameDiff = "diff_" + raster.replace("r_", "") outNameDirDur = "dirDur_" + raster.replace("r_", "") # Define parameters for solar radiation in_surface_raster = raster latitude = "" skySize = 200 timeConfig = TimeMultipleDays(2018, 100, 150) dayInterval = 10 # default 14 hourInterval = 12 # default 0.5 each_interval = "NOINTERVAL" # "INTERVAL" zFactor = "" calcDirections = 32 zenithDivisions = 8 azimuthDivisions = 8 diffuseProp = 0.3 transmittivity = 0.5 # Set names for optional output rasters, seems not working??? outDirectRad = arcpy.Raster(outNameDirect) outDiffuseRad = arcpy.Raster(outNameDiff) outDirectDur = arcpy.Raster(outNameDirDur) # Execute AreaSolarRadiation outGlobalRad = arcpy.sa.AreaSolarRadiation(in_surface_raster, latitude, skySize, timeConfig, dayInterval, hourInterval, each_interval, zFactor, "FROM_DEM" , calcDirections, zenithDivisions, azimuthDivisions, "UNIFORM_SKY", diffuseProp, transmittivity, outDirectRad, outDiffuseRad, outDirectDur) print("area radiation saving") # Save the output outGlobalRad.save(raster.replace("r_", "globRad_"))