Skip to content

Commit d12d4b6

Browse files
committed
more fixes
1 parent dabe7b5 commit d12d4b6

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

pvlib/data/tmy_45.000_8.000_2005_2023.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
Latitude (decimal degrees): 45.000
22
Longitude (decimal degrees): 8.000
33
Elevation (m): 250.0
4+
Irradiance Time Offset (h): 0.1761
45
month,year
56
1,2018
67
2,2007

pvlib/iotools/pvgis.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -559,11 +559,17 @@ def _parse_pvgis_tmy_csv(src):
559559
inputs['longitude'] = float(src.readline().split(b':')[1])
560560
# Elevation (m): 1389.0\r\n
561561
inputs['elevation'] = float(src.readline().split(b':')[1])
562-
# Irradiance Time Offset (h): 0.1761\r\n
563-
inputs['irradiance time offset'] = float(src.readline().split(b':')[1])
562+
563+
# TMY has an extra line here: Irradiance Time Offset (h): 0.1761\r\n
564+
line = src.readline()
565+
if line.startswith(b'Irradiance Time Offset'):
566+
inputs['irradiance time offset'] = float(line.split(b':')[1])
567+
src.readline() # skip over the "month,year\r\n"
568+
else:
569+
# `line` is already the "month,year\r\n" line, so nothing to do
570+
pass
564571
# then there's a 13 row comma separated table with two columns: month, year
565-
# which contains the year used for that month in the
566-
src.readline() # get "month,year\r\n"
572+
# which contains the year used for that month in the TMY
567573
months_selected = []
568574
for month in range(12):
569575
months_selected.append(

0 commit comments

Comments
 (0)