Pvlib-python: NREL TMY server rejecting python requests

Created on 25 Jun 2018  路  6Comments  路  Source: pvlib/pvlib-python

Describe the bug
NREL's TMY file server recently started rejecting requests originating from urlopen. The response was:

"<html><head><title>Request Rejected</title></head><body>An error has occurred. Please consult with your administrator.<br><br>Your support ID is: 12437308730316847769<br><br><a href='javascript:history.back();'>[Go Back]</a></body></html>"

However, it's still possible to download a file from the same url with a web browser. Mostly likely they, intentionally or not, started blocking any requests that don't come with a browser-like HTTP User-Agent header.

I have a fix mostly ready to go.

To Reproduce

pvlib/test/test_tmy.py F
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> traceback >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

    @network
    def test_readtmy3_remote():
        url = 'http://rredc.nrel.gov/solar/old_data/nsrdb/1991-2005/data/tmy3/703165TYA.CSV'
>       tmy.readtmy3(url)

pvlib/test/test_tmy.py:19:

        # read in file metadata
        meta = dict(zip(head, csvdata.readline().rstrip('\n').split(",")))

        # convert metadata strings to numeric types
>       meta['altitude'] = float(meta['altitude'])
E       KeyError: 'altitude'

pvlib/tmy.py:178: KeyError

Expected behavior
Should work like it used to!

Versions:
all

bug

All 6 comments

@wholmgren and @cwhanse unfortunately it looks like NREL has permanently retired the old rredc websites, however I think you can download a single CSV from MTS2:

api_key = 'DEMO_KEY'
blah blah blah

what a PITA

Agree with the comment about the NREL site limitations. The PSM NSRDB files have the same restrictions.

At what point does maintenance of this connection to the NSRDB become too much work?

Maybe if someone asked, they would keep it alive?

At what point does maintenance of this connection to the NSRDB become too much work?

I think the answer is "now". I suggest we remove the feature.

I think the answer is "now". I suggest we remove the feature.

I agree - we should remove the capability to pass a url to read_tmy3.

It was nice capability while it worked.

NREL's TMY server is back online and the downloads are working again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

caseymcgon picture caseymcgon  路  3Comments

wholmgren picture wholmgren  路  5Comments

Jawairia123 picture Jawairia123  路  6Comments

CameronTStark picture CameronTStark  路  3Comments

dberrian picture dberrian  路  4Comments