admin管理员组文章数量:1390192
I want a Python code, give it an Excel file and it will give me the results.
The colored results are the correct results that I got manually from the site PVGIS(/). As for the other results, I got them using Python code. They are close, but I want correct and accurate results. Please help.
optimize_slope_azimuth = 1
optimizeazimuth=0
for lat, lon in zip(df["Latitudes"], df["Longitudes"]):
url = (f"={lat}&lon={lon}&peakpower=1&loss=14"
f"&mountingplace=free&optimalinclination={optimize_slope_azimuth}&optimalangles={optimizeazimuth}"
f"&outputformat=json")
response = requests.get(url)
if response.status_code == 200:
data = response.json()
yearly_pv_energy = data["outputs"]["totals"]["fixed"]["E_y"] # [kWh]
yearly_irradiation = data["outputs"]["totals"]["fixed"]["H(i)_y"] # [kWh/m2]
year_variability = data["outputs"]["totals"]["fixed"]["SD_y"] # [kWh]
results.append({
"Latitude": lat,
"Longitude": lon,
"Yearly PV Energy [kWh]": yearly_pv_energy,
"Yearly In-Plane Irradiation [kWh/m2]": yearly_irradiation,
"Year-to-Year Variability [kWh]": year_variability
})
I want a Python code, give it an Excel file and it will give me the results.
The colored results are the correct results that I got manually from the site PVGIS(https://re.jrc.ec.europa.eu/pvg_tools/en/). As for the other results, I got them using Python code. They are close, but I want correct and accurate results. Please help.
optimize_slope_azimuth = 1
optimizeazimuth=0
for lat, lon in zip(df["Latitudes"], df["Longitudes"]):
url = (f"https://re.jrc.ec.europa.eu/api/v5_2/PVcalc?lat={lat}&lon={lon}&peakpower=1&loss=14"
f"&mountingplace=free&optimalinclination={optimize_slope_azimuth}&optimalangles={optimizeazimuth}"
f"&outputformat=json")
response = requests.get(url)
if response.status_code == 200:
data = response.json()
yearly_pv_energy = data["outputs"]["totals"]["fixed"]["E_y"] # [kWh]
yearly_irradiation = data["outputs"]["totals"]["fixed"]["H(i)_y"] # [kWh/m2]
year_variability = data["outputs"]["totals"]["fixed"]["SD_y"] # [kWh]
results.append({
"Latitude": lat,
"Longitude": lon,
"Yearly PV Energy [kWh]": yearly_pv_energy,
"Yearly In-Plane Irradiation [kWh/m2]": yearly_irradiation,
"Year-to-Year Variability [kWh]": year_variability
})
Share
Improve this question
edited Mar 16 at 5:17
Hai Vu
40.9k15 gold badges71 silver badges102 bronze badges
asked Mar 14 at 21:30
Oussama LatelliOussama Latelli
11 silver badge
1 Answer
Reset to default 2The difference is very likely because the API call uses version 5.2, whereas the interface you are downloading from is version 5.3.
本文标签: pythonWhy do the results I extract manually not match the results I get with the codeStack Overflow
版权声明:本文标题:python - Why do the results I extract manually not match the results I get with the code? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744631832a2616586.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论