Skip to content

Commit d6379ef

Browse files
authored
Fix PVGIS TMY tests (#2305)
* update the various PVGIS test data files * update test_pvgis.py * whatsnew * remove obsolete Notes docstring section
1 parent 7abccda commit d6379ef

14 files changed

+35092
-35100
lines changed

docs/sphinx/source/whatsnew/v0.11.2.rst

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ Documentation
4949

5050
Testing
5151
~~~~~~~
52+
* Updated test files to track new PVGIS 5.3 data. (:pull:`2305`)
5253

5354

5455
Requirements
@@ -70,3 +71,4 @@ Contributors
7071
* Mark Mikofski (:ghuser:`mikofski`)
7172
* matsuobasho (:ghuser:`matsuobasho`)
7273
* Echedey Luis (:ghuser:`echedey-ls`)
74+
* Kevin Anderson (:ghuser:`kandersolar`)

pvlib/data/pvgis_tmy_test.csv

+8,761
Large diffs are not rendered by default.

pvlib/data/pvgis_tmy_test.dat

-8,761
This file was deleted.

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

-8,789
This file was deleted.

pvlib/data/tmy_45.000_8.000_2005_2020.epw

-8,768
This file was deleted.

pvlib/data/tmy_45.000_8.000_2005_2020.json

-1
This file was deleted.

pvlib/data/tmy_45.000_8.000_2005_2020.txt

-8,761
This file was deleted.

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

+8,789
Large diffs are not rendered by default.

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

+8,768
Large diffs are not rendered by default.

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

+1
Large diffs are not rendered by default.

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

+8,761
Large diffs are not rendered by default.

pvlib/data/tmy_45.000_8.000_userhorizon.json

+1-1
Large diffs are not rendered by default.

pvlib/iotools/pvgis.py

-10
Original file line numberDiff line numberDiff line change
@@ -467,16 +467,6 @@ def get_pvgis_tmy(latitude, longitude, outputformat='json', usehorizon=True,
467467
metadata : list or dict
468468
file metadata, ``None`` for basic
469469
470-
Note
471-
----
472-
The PVGIS website uses 10 years of data to generate the TMY, whereas the
473-
API accessed by this function defaults to using all available years. This
474-
means that the TMY returned by this function may not be identical to the
475-
one generated by the website. To replicate the website requests, specify
476-
the corresponding 10 year period using ``startyear`` and ``endyear``.
477-
Specifying ``endyear`` also avoids the TMY changing when new data becomes
478-
available.
479-
480470
Raises
481471
------
482472
requests.HTTPError

pvlib/tests/iotools/test_pvgis.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ def test_read_pvgis_hourly_empty_file():
304304
# PVGIS TMY tests
305305
@pytest.fixture
306306
def expected():
307-
return pd.read_csv(DATA_DIR / 'pvgis_tmy_test.dat', index_col='time(UTC)')
307+
return pd.read_csv(DATA_DIR / 'pvgis_tmy_test.csv', index_col='time(UTC)')
308308

309309

310310
@pytest.fixture
@@ -315,18 +315,18 @@ def userhorizon_expected():
315315
@pytest.fixture
316316
def month_year_expected():
317317
return [
318-
2014, 2011, 2008, 2011, 2009, 2011, 2020, 2006, 2006, 2013, 2007, 2018]
318+
2018, 2007, 2009, 2013, 2008, 2006, 2011, 2010, 2020, 2006, 2007, 2016]
319319

320320

321321
@pytest.fixture
322322
def inputs_expected():
323323
return {
324324
'location': {'latitude': 45.0, 'longitude': 8.0, 'elevation': 250.0},
325325
'meteo_data': {
326-
'radiation_db': 'PVGIS-SARAH2',
326+
'radiation_db': 'PVGIS-SARAH3',
327327
'meteo_db': 'ERA5',
328328
'year_min': 2005,
329-
'year_max': 2020,
329+
'year_max': 2023,
330330
'use_horizon': True,
331331
'horizon_db': 'DEM-calculated'}}
332332

@@ -564,14 +564,14 @@ def test_read_pvgis_horizon_invalid_coords():
564564

565565

566566
def test_read_pvgis_tmy_map_variables(pvgis_tmy_mapped_columns):
567-
fn = DATA_DIR / 'tmy_45.000_8.000_2005_2020.json'
567+
fn = DATA_DIR / 'tmy_45.000_8.000_2005_2023.json'
568568
actual, _, _, _ = read_pvgis_tmy(fn, map_variables=True)
569569
assert all(c in pvgis_tmy_mapped_columns for c in actual.columns)
570570

571571

572572
def test_read_pvgis_tmy_json(expected, month_year_expected, inputs_expected,
573573
meta_expected):
574-
fn = DATA_DIR / 'tmy_45.000_8.000_2005_2020.json'
574+
fn = DATA_DIR / 'tmy_45.000_8.000_2005_2023.json'
575575
# infer outputformat from file extensions
576576
pvgis_data = read_pvgis_tmy(fn, map_variables=False)
577577
_compare_pvgis_tmy_json(expected, month_year_expected, inputs_expected,
@@ -588,7 +588,7 @@ def test_read_pvgis_tmy_json(expected, month_year_expected, inputs_expected,
588588

589589

590590
def test_read_pvgis_tmy_epw(expected, epw_meta):
591-
fn = DATA_DIR / 'tmy_45.000_8.000_2005_2020.epw'
591+
fn = DATA_DIR / 'tmy_45.000_8.000_2005_2023.epw'
592592
# infer outputformat from file extensions
593593
pvgis_data = read_pvgis_tmy(fn, map_variables=False)
594594
_compare_pvgis_tmy_epw(expected, epw_meta, pvgis_data)
@@ -603,7 +603,7 @@ def test_read_pvgis_tmy_epw(expected, epw_meta):
603603

604604
def test_read_pvgis_tmy_csv(expected, month_year_expected, inputs_expected,
605605
meta_expected, csv_meta):
606-
fn = DATA_DIR / 'tmy_45.000_8.000_2005_2020.csv'
606+
fn = DATA_DIR / 'tmy_45.000_8.000_2005_2023.csv'
607607
# infer outputformat from file extensions
608608
pvgis_data = read_pvgis_tmy(fn, map_variables=False)
609609
_compare_pvgis_tmy_csv(expected, month_year_expected, inputs_expected,
@@ -620,7 +620,7 @@ def test_read_pvgis_tmy_csv(expected, month_year_expected, inputs_expected,
620620

621621

622622
def test_read_pvgis_tmy_basic(expected, meta_expected):
623-
fn = DATA_DIR / 'tmy_45.000_8.000_2005_2020.txt'
623+
fn = DATA_DIR / 'tmy_45.000_8.000_2005_2023.txt'
624624
# XXX: can't infer outputformat from file extensions for basic
625625
with pytest.raises(ValueError, match="pvgis format 'txt' was unknown"):
626626
read_pvgis_tmy(fn, map_variables=False)

0 commit comments

Comments
 (0)