Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Area Solar Radiation from Python script - error

$
0
0
Hello,

I am attempting to execute Area Solar Radiation in a stand-alone python script (shown below). The basis for the script was provided in the ESRI tool help. I made a few adjustments to this template by adjusting a few of the local variables and adding try/except etc.

The problem is that when I execute the script, it runs for about a minute then fails with an ERROR 999999 (also shown below in quoted script output).

Does anyone have an idea on why this may be occurring?


Code:

# Name: SolarRad_MayJuly.py
# Description: Derives incoming solar radiation from a raster surface.
#              Outputs a global radiation raster and optional direct, diffuse and direct duration rasters
#              for a specified time period. (May to July).
#             
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy, time
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "D:/Projects/Tasks/02_SpatialInputs/SolarRad/work/MayJulyOutput"

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Set local variables
inRaster = "D:/Projects/Tasks/02_SpatialInputs/Geomorph/ElevationSlope/elev"
latitude = 37.1567
skySize = 200
timeConfig = TimeMultipleDays(2012, 121, 212)
dayInterval = 14
hourInterval = 1
zFactor = 1
calcDirections = 32
zenithDivisions = 8
azimuthDivisions = 8
diffuseProp = 0.3
transmittivity = 0.5
outDirectRad = ""
outDiffuseRad = ""
outDirectDur = ""

print time.asctime(time.localtime())
print "Running Area Solar Radiation..."
try:
    # Execute AreaSolarRadiation
    outGlobalRad = AreaSolarRadiation(inRaster, latitude, skySize, timeConfig,
      dayInterval, hourInterval, "NOINTERVAL", zFactor, "FROM_DEM",
      calcDirections, zenithDivisions, azimuthDivisions, "UNIFORM_SKY",
      diffuseProp, transmittivity, outDirectRad, outDiffuseRad, outDirectDur)
except:
    print "Error while processing solar radiation"
    print (arcpy.GetMessages())

# Save the output
outGlobalRad.save("D:/Projects/Tasks/02_SpatialInputs/SolarRad/work/MayJulyOutput/globrad")
print "Finished"
print time.asctime(time.localtime())

Quote:

Tue Jan 28 09:52:16 2014
Running Area Solar Radiation...
Error while processing solar radiation
Executing: AreaSolarRadiation D:/Projects/Tasks/02_SpatialInputs/Geomorph/ElevationSlope/elev D:/Projects/Tasks/02_SpatialInputs/SolarRad/work/MayJulyOutput\AreaSol_elev1 37.1567 200 "MultiDays 2012 121 212" 14 1 NOINTERVAL 1 FROM_DEM 32 8 8 UNIFORM_SKY 0.3 0.5 # # #
Start Time: Tue Jan 28 09:52:16 2014
ERROR 999999: Error executing function.
Failed to open raster dataset
Failed to execute (AreaSolarRadiation).
Failed at Tue Jan 28 09:53:33 2014 (Elapsed Time: 1 minutes 17 seconds)

Viewing all articles
Browse latest Browse all 2485

Trending Articles