-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Remove pvgis_tmy outputformat='basic' #2416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 3 commits
c83ecc7
33e15a5
ff7de82
de2712b
e7d80e3
28e7d58
91d1d19
e3defba
ff01c08
9611a77
a064af5
a4d6b9c
38fbc0c
53ca484
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.. _whatsnew_01300: | ||
|
||
|
||
v0.13.0 (June XX, 2025) | ||
------------------------ | ||
|
||
Breaking Changes | ||
~~~~~~~~~~~~~~~~ | ||
* Remove the ``outputformat='basic'`` option in :py:func:`~pvlib.iotools.get_pvgis_tmy` | ||
and :py:func:`~pvlib.iotools.read_pvgis_tmy`. (:pull:`2416`) | ||
|
||
Bug fixes | ||
~~~~~~~~~ | ||
|
||
|
||
Enhancements | ||
~~~~~~~~~~~~ | ||
|
||
|
||
Documentation | ||
~~~~~~~~~~~~~ | ||
|
||
|
||
Testing | ||
~~~~~~~ | ||
|
||
|
||
Maintenance | ||
~~~~~~~~~~~ | ||
|
||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
* Adam R. Jensen (:ghuser:`AdamRJensen`) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -279,6 +279,13 @@ def test_get_pvgis_hourly_bad_outputformat(requests_mock): | |
get_pvgis_hourly(latitude=45, longitude=8, outputformat='basic') | ||
|
||
|
||
def test_get_pvgis_tmy_basic_outputformat(): | ||
# Test if a ValueError is raised if an unsupported outputformat is used | ||
# E.g. 'basic' is a valid PVGIS format, but is not supported by pvlib | ||
with pytest.raises(ValueError): | ||
get_pvgis_tmy(latitude=45, longitude=8, outputformat='basic') | ||
|
||
|
||
url_additional_inputs = 'https://re.jrc.ec.europa.eu/api/seriescalc?lat=55.6814&lon=12.5758&outputformat=csv&angle=0&aspect=0&pvcalculation=1&pvtechchoice=crystSi&mountingplace=free&trackingtype=0&components=1&usehorizon=1&optimalangles=1&optimalinclination=0&loss=2&userhorizon=10%2C15%2C20%2C10&peakpower=5' # noqa: E501 | ||
|
||
|
||
|
@@ -427,21 +434,6 @@ def test_get_pvgis_tmy_kwargs(userhorizon_expected): | |
assert inputs['meteo_data']['year_max'] == 2016 | ||
|
||
|
||
@pytest.mark.remote_data | ||
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) | ||
def test_get_pvgis_tmy_basic(expected, meta_expected): | ||
pvgis_data = get_pvgis_tmy(45, 8, outputformat='basic', | ||
map_variables=False) | ||
_compare_pvgis_tmy_basic(expected, meta_expected, pvgis_data) | ||
|
||
|
||
def _compare_pvgis_tmy_basic(expected, meta_expected, pvgis_data): | ||
data, _, _, _ = pvgis_data | ||
# check each column of output separately | ||
for outvar in meta_expected['outputs']['tmy_hourly']['variables'].keys(): | ||
assert np.allclose(data[outvar], expected[outvar]) | ||
|
||
|
||
@pytest.mark.remote_data | ||
@pytest.mark.flaky(reruns=RERUNS, reruns_delay=RERUNS_DELAY) | ||
def test_get_pvgis_tmy_coerce_year(): | ||
|
@@ -630,23 +622,6 @@ def test_read_pvgis_tmy_csv(expected, month_year_expected, inputs_expected, | |
meta_expected, csv_meta, pvgis_data) | ||
|
||
|
||
def test_read_pvgis_tmy_basic(expected, meta_expected): | ||
fn = TESTS_DATA_DIR / 'tmy_45.000_8.000_2005_2023.txt' | ||
AdamRJensen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# XXX: can't infer outputformat from file extensions for basic | ||
with pytest.raises(ValueError, match="pvgis format 'txt' was unknown"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there are not tests now for raising an exception if either the file extension or There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is now a dedicated test that checks if an error is raised when a filename with a non-recognized file format is passed. |
||
read_pvgis_tmy(fn, map_variables=False) | ||
# explicit pvgis outputformat | ||
pvgis_data = read_pvgis_tmy(fn, pvgis_format='basic', map_variables=False) | ||
_compare_pvgis_tmy_basic(expected, meta_expected, pvgis_data) | ||
with fn.open('rb') as fbuf: | ||
pvgis_data = read_pvgis_tmy(fbuf, pvgis_format='basic', | ||
map_variables=False) | ||
_compare_pvgis_tmy_basic(expected, meta_expected, pvgis_data) | ||
# file buffer raises TypeError if passed to pathlib.Path() | ||
with pytest.raises(TypeError): | ||
read_pvgis_tmy(fbuf, map_variables=False) | ||
|
||
|
||
def test_read_pvgis_tmy_exception(): | ||
bad_outputformat = 'bad' | ||
err_msg = f"pvgis format '{bad_outputformat:s}' was unknown" | ||
|
Uh oh!
There was an error while loading. Please reload this page.