Skip to content

Commit 692d856

Browse files
committed
fix CSV parsing and test
1 parent 171f10c commit 692d856

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pvlib/iotools/pvgis.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,8 @@ 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])
562564
# then there's a 13 row comma separated table with two columns: month, year
563565
# which contains the year used for that month in the
564566
src.readline() # get "month,year\r\n"

pvlib/tests/iotools/test_pvgis.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ def month_year_expected():
321321
@pytest.fixture
322322
def inputs_expected():
323323
return {
324-
'location': {'latitude': 45.0, 'longitude': 8.0, 'elevation': 250.0},
324+
'location': {'latitude': 45.0, 'longitude': 8.0, 'elevation': 250.0,
325+
'irradiance time offset': 0.1761},
325326
'meteo_data': {
326327
'radiation_db': 'PVGIS-SARAH3',
327328
'meteo_db': 'ERA5',
@@ -503,6 +504,9 @@ def _compare_pvgis_tmy_csv(expected, month_year_expected, inputs_expected,
503504
assert inputs['latitude'] == inputs_expected['location']['latitude']
504505
assert inputs['longitude'] == inputs_expected['location']['longitude']
505506
assert inputs['elevation'] == inputs_expected['location']['elevation']
507+
assert (inputs['irradiance time offset']
508+
== inputs_expected['location']['irradiance time offset']
509+
)
506510
for meta_value in meta:
507511
if not meta_value:
508512
continue

0 commit comments

Comments
 (0)