Skip to content

NSRDB API returning bad data for tmy-2017 #159

@kandersolar

Description

@kandersolar

Was a change made to the tmy-2017 NSRDB dataset? We noticed part of our test suite failing (pvlib/pvlib-python#886 (comment)) because the TMY API is returning somewhat different data than it used to. It could be that other datasets are affected as well; our tests just use tmy-2017 as an example, so that's the only one I've looked at.

Here's a script to reproduce what I'm seeing. It shows the difference from the old version of what the API returned (stored as a CSV in our test suite). Seems like some, but not all, of the data columns have changed. It also appears that the date labels are shifted by one day because two days are marked Feb 28.

Click to expand
import requests
import pandas as pd
import io

# read older dataset from before the change
url_old_data = 'https://raw.githubusercontent.com/pvlib/pvlib-python/master/pvlib/data/test_psm3_tmy-2017.csv'
df_old = pd.read_csv(url_old_data, index_col=0)

# retrieve current dataset from API
params = {'api_key': API_KEY,
          'full_name': NAME,
          'email': EMAIL,
          'affiliation': AFFILIATION,
          'reason': REASON,
          'mailing_list': 'false',
          'wkt': 'POINT(-108.5449 40.5137)',
          'names': 'tmy-2017',
          'attributes': 'air_temperature,dew_point,dhi,dni,ghi,surface_albedo,surface_pressure,wind_direction,wind_speed',
          'leap_day': 'false',
          'utc': 'false',
          'interval': 60}
url = 'https://developer.nrel.gov/api/nsrdb_api/solar/nsrdb_psm3_tmy_download.csv'

response = requests.get(url, params, timeout=30)
fbuf = io.StringIO(response.content.decode('utf-8'))

# pop off the header lines
fbuf.readline()
fbuf.readline()
df_new = pd.read_csv(fbuf)

print((df_old == df_new).all())
print(len(df_old.loc[(df_old.Month==2) & (df_old.Day==28)]))
print(len(df_new.loc[(df_new.Month==2) & (df_new.Day==28)]))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions