Skip to content
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

Error for get_pvgis_tmy with outputformat='csv' #2344

Open
kandersolar opened this issue Dec 23, 2024 · 0 comments
Open

Error for get_pvgis_tmy with outputformat='csv' #2344

kandersolar opened this issue Dec 23, 2024 · 0 comments
Labels

Comments

@kandersolar
Copy link
Member

A recent remote-data CI run (https://github.com/pvlib/pvlib-python/actions/runs/12470840782/job/34806707387?pr=2258#step:6:78) experienced a test failure:

>       pvgis_data = get_pvgis_tmy(45, 8, outputformat='csv', map_variables=False)

pvlib/tests/iotools/test_pvgis.py:488: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pvlib/iotools/pvgis.py:518: in get_pvgis_tmy
    data, months_selected, inputs, meta = _parse_pvgis_tmy_csv(src)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

src = <_io.BytesIO object at 0x7fe3530318f0>

    def _parse_pvgis_tmy_csv(src):
        # the first 3 rows are latitude, longitude, elevation
        inputs = {}
        # 'Latitude (decimal degrees): 45.000\r\n'
        inputs['latitude'] = float(src.readline().split(b':')[1])
        # 'Longitude (decimal degrees): 8.000\r\n'
        inputs['longitude'] = float(src.readline().split(b':')[1])
        # Elevation (m): 1389.0\r\n
        inputs['elevation'] = float(src.readline().split(b':')[1])
        # then there's a 13 row comma separated table with two columns: month, year
        # which contains the year used for that month in the
        src.readline()  # get "month,year\r\n"
        months_selected = []
        for month in range(12):
            months_selected.append(
>               {'month': month+1, 'year': int(src.readline().split(b',')[1])})
E           ValueError: invalid literal for int() with base 10: b'year\r\n'

Seems like PVGIS changed the format of their CSV TMY output.

Note that the default case in get_pvgis_tmy (outputformat='json') works without issue, so this issue probably does not affect many users.

Side note: why do we support all these formats? Seems like we could simplify that module a lot by choosing whichever one we like best and deprecating the outputformat parameter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant