Skip to content

NREL TMY server rejecting python requests #493

Closed

Description

@wholmgren

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

Activity

  1. added this to the 0.6.0 milestone on Jun 24, 2018
  2. added a commit that references this issue on Jun 26, 2018
    e6aa17c
  3. mikofski commented on Jul 26, 2018

    @mikofski
    Member

    @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

  4. cwhanse commented on Jul 26, 2018

    @cwhanse
    Member

    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?

  5. adriesse commented on Jul 26, 2018

    @adriesse
    Member

    Maybe if someone asked, they would keep it alive?

  6. wholmgren commented on Jul 26, 2018

    @wholmgren
    MemberAuthor

    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.

  7. cwhanse commented on Jul 26, 2018

    @cwhanse
    Member

    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.

  8. wholmgren commented on Jul 27, 2018

    @wholmgren
    MemberAuthor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions