pvlib

Fetching TMYs from the NSRDB for interval size in 5 minutes


I am using pvlib https://pvlib-python.readthedocs.io/en/v0.9.0/generated/pvlib.iotools.get_psm3.html for retrieving NSRDB PSM3 time-series data from the PSM3 API. I was able to retrieve data for 30 minutes, but it doesn't work for changing the interval for 5 minutes!!! any help

 my_metadata, my_data = pvlib.iotools.get_psm3(
         latitude= xxx, longitude=xxx,
       interval=5,
       api_key=My_key, email='xxx',  # <-- any email works here fine
        #names='tmy'
         names='xxx')

Solution

  • Perhaps you're using an older version of pvlib? I would try updating to the latest version with pip install -U pvlib or similar. You can check your installed version with print(pvlib.__version__).

    This snippet successfully retrieves 5-minute data for me with pvlib 0.9.1:

    import pvlib
    
    lat, lon = 40, -80
    key = '<redacted>'
    email = '<redacted>'
    
    df, metadata = pvlib.iotools.get_psm3(lat, lon, key, email, names='2020',
                                          interval=5, map_variables=True)
    

    It's worth pointing out that TMYs are always hourly; the 5-minute data is only for single (calendar) years like the above 2020 request. The get_psm3 docstring mentions this:

    interval : int, {60, 5, 15, 30}
        interval size in minutes, must be 5, 15, 30 or 60. Only used for
        single-year requests (i.e., it is ignored for tmy/tgy/tdy requests).