diff --git a/docs/sphinx/source/whatsnew/v0.16.0.rst b/docs/sphinx/source/whatsnew/v0.16.0.rst index 69283b27ce..7f56a2cb30 100644 --- a/docs/sphinx/source/whatsnew/v0.16.0.rst +++ b/docs/sphinx/source/whatsnew/v0.16.0.rst @@ -21,6 +21,10 @@ Deprecations Bug fixes ~~~~~~~~~ +* Fix incorrect column naming when parsing data from logical record + 0500 using :py:func:`~pvlib.iotools.read_bsrn` or + :py:func:`~pvlib.iotools.get_bsrn`. + (:issue:`2835`, :pull:`2841`) * :py:func:`~pvlib.irradiance.perez` no longer raises ``ZeroDivisionError`` on scalar ``dhi=0`` input (e.g. nighttime); the scalar path now returns the same finite value as the array path. (:pull:`2826`) diff --git a/pvlib/iotools/bsrn.py b/pvlib/iotools/bsrn.py index 9b5e1bd1a1..fff3f72614 100644 --- a/pvlib/iotools/bsrn.py +++ b/pvlib/iotools/bsrn.py @@ -42,10 +42,9 @@ BSRN_LR0500_COLUMNS = ['day', 'minute', 'uva_global', 'uva_global_std', 'uva_global_min', 'uva_global_max', 'uvb_direct', 'uvb_direct_std', 'uvb_direct_min', 'uvb_direct_max', - 'empty', 'empty', 'empty', 'empty', + 'empty', 'empty', 'empty', 'empty', 'empty', 'empty', 'uvb_global', 'uvb_global_std', 'uvb_global_min', 'uvb_global_max', 'uvb_diffuse', 'uvb_diffuse_std', - 'uvb_diffuse', 'uvb_diffuse_std', 'uvb_diffuse_min', 'uvb_diffuse_max', 'uvb_reflected', 'uvb_reflected_std', 'uvb_reflected_min', 'uvb_reflected_max'] diff --git a/tests/iotools/test_bsrn.py b/tests/iotools/test_bsrn.py index 8d8f905635..5bb9434f47 100644 --- a/tests/iotools/test_bsrn.py +++ b/tests/iotools/test_bsrn.py @@ -76,6 +76,9 @@ def test_read_bsrn_logical_records(expected_index): assert 'uva_global' in data.columns assert 'uvb_reflected_std' in data.columns assert 'ghi' not in data.columns + # Check that there are no duplicate columns when parsing + # LR0500 data (see #2841) + assert not data.columns.duplicated().any() def test_read_bsrn_bad_logical_record():