私は非常に長い間、以下のコードを扱ってきました。太陽光発電所の電気代を計算した結果をラスター イメージで表示する必要があります。問題は、レイヤー「DNI」(直接法線照射)を式と相互作用させる必要があり、式の値は、生命植物の30年間の年ごとの係数(costReductionFactorPlant)で変化することです。以下に要因を示す。
コードを実行すると、次のエラーが表示されます。
Runtime error
Traceback (most recent call last):
File "<string>", line 56, in <module>
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\sa\Functions.py", line 4049, in Times
in_raster_or_constant2)
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\sa\Utils.py", line 47, in swapper
result = wrapper(*args, **kwargs)
File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\sa\Functions.py", line 4046, in wrapper
return _wrapLocalFunctionRaster(u"Times_sa", ["Times", in_raster_or_constant1, in_raster_or_constant2])
RuntimeError: ERROR 000732: Input Raster: Dataset D:_ArcGIS\Python\LCOE_test does not exist or is not supported
>>>
レイヤーを「DNI」と呼ぶときに何か問題があるのではないかと心配しています。しかし、手がかりはありません。ループにもエラーがあるのかもしれません...私も見ようとしましたが、私は良さそうですが、私は専門家ではありません。
ArcGis 10.1 を実行しています。すべての提案は大歓迎です。
コード:
import arcpy, os, sys
from arcpy import env
from arcpy.sa import *
# Set Workspace
env.workspace = "D:\02_ArcGIS\Python\LCOE_test"
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Variables definition
capacity = 100000
actualOutput = .94 * capacity
storageHours = 16
loadFactor = (.57 * storageHours + 7.1)/24
costReductionFactorPlant = [0.4790, 0.4533, 0.4297, 0.4080, 0.3880, 0.3696, 0.3526, 0.3368, 0.3222, 0.3087, 0.2961, 0.2844, 0.2735, 0.2633, 0.2538, 0.2449, 0.2366, 0.2288, 0.2215, 0.2146, 0.2081, 0.2021, 0.1964, 0.1910, 0.1859, 0.1811, 0.1765, 0.1723, 0.1682, 0.1643, 0.1607]
efficiency = [0.1822, 0.1827, 0.1831, 0.1834, 0.1837, 0.1840, 0.1841, 0.1843, 0.1844, 0.1845, 0.1846, 0.1847, 0.1847, 0.1848, 0.1848, 0.1849, 0.1849, 0.1849, 0.1849, 0.1849, 0.1849, 0.1850, 0.1850, 0.1850, 0.1850, 0.1850, 0.1850, 0.1850, 0.1850, 0.1850, 0.1850]
years = 30
i = .1
ir = .01
lcoePlantTotal = 0
productionPlant = loadFactor * actualOutput * 8760
DNI = "D:\02_ArcGIS\Python\LCOE_test" #layer#
Count=len(costReductionFactorPlant)+ 1
counter=1
while counter < Count:
for i in range(counter,(counter+1)):
# Set the cell size environment using a keyword.
arcpy.env.cellSize = "MAXOF"
# Set the extent environment using a keyword
arcpy.env.extent = "MAXOF"
#intermediate formula plant
# size = (capacity * 8760 * loadFactor)/(DNI * efficiency[counter-1])
size1 = (capacity * 8760 * loadFactor)
timesConstant = efficiency[counter-1]
size2 = Times(3, timesConstant)
print size2
size = Divide(size1, size2)
# Calculate power block & storage
powerBlock = capacity * 1484.9918 * costReductionFactorPlant[counter-1]
storage = storageHours * capacity * 39.45759 * costReductionFactorPlant[counter-1]
# Calculate mirrowField
# mirrorField = size * 155.6975 * costReductionFactorPlant[cont-1]
timesConstant2 = costReductionFactorPlant[counter-1]
inconstant = Times(155.6975, timesConstant2)
mirrorField = Times(size, inconstant)
# calculate PowerTower
powerTower = ((capacity * 121.03883) + (capacity * 128.50378)) * costReductionFactorPlant[counter-1]
# Calculate investmentPlant
investmentPlant = powerBlock + storage + mirrorField + powerTower
# Calculate omPlant
omPlant = Times(investmentPlant, 0.048)
#formula: lcoePlant = ((investmentPlant * (((i * (1 + i)^counter)/((1 + i)^counter-1))+ ir))+omPlant)/productionPlant*100
# Formula Part 1 = (investmentPlant * (((i * (1 + i)^counter) Power symbol = **
InConstant3= i * ((1 + i)**counter)
FormulaPart1 = Times(investmentPlant, InConstant3)
# Formula Part 2 = ((1 + i)^counter-1))+ ir))+omPlant)/productionPlant*100
FormulaPart2 =(((1 + i)**(counter-1)+ ir)+omPlant)/productionPlant*100
# Formula
lcoePlant = Divide(FormulaPart1, FormulaPart2)
lcoePlantTotal = lcoePlantTotal + lcoePlant
lcoePlantTotal.save = "D:\\02_ArcGIS\\Python" + str(lcoePlantTotal) + ".img"
print "lcoePlanttotal calculated"