diff --git a/pvlib/iotools/__init__.py b/pvlib/iotools/__init__.py index c4d864f0a9..a43f929719 100644 --- a/pvlib/iotools/__init__.py +++ b/pvlib/iotools/__init__.py @@ -11,6 +11,9 @@ from pvlib.iotools.psm3 import get_psm3 # noqa: F401 from pvlib.iotools.psm3 import read_psm3 # noqa: F401 from pvlib.iotools.psm3 import parse_psm3 # noqa: F401 +from pvlib.iotools.psm4 import get_psm4 # noqa: F401 +from pvlib.iotools.psm4 import read_psm4 # noqa: F401 +from pvlib.iotools.psm4 import parse_psm4 # noqa: F401 from pvlib.iotools.pvgis import get_pvgis_tmy, read_pvgis_tmy # noqa: F401 from pvlib.iotools.pvgis import read_pvgis_hourly # noqa: F401 from pvlib.iotools.pvgis import get_pvgis_hourly # noqa: F401 @@ -34,6 +37,3 @@ from pvlib.iotools.solcast import get_solcast_historic # noqa: F401 from pvlib.iotools.solcast import get_solcast_tmy # noqa: F401 from pvlib.iotools.solargis import get_solargis # noqa: F401 -from pvlib.iotools.goes4 import get_goes4 # noqa: F401 -from pvlib.iotools.goes4 import read_goes4 # noqa: F401 -from pvlib.iotools.goes4 import parse_goes4 # noqa: F401 diff --git a/pvlib/iotools/psm4.py b/pvlib/iotools/psm4.py index 9bce27b848..f1a5eba7e3 100644 --- a/pvlib/iotools/psm4.py +++ b/pvlib/iotools/psm4.py @@ -5,18 +5,18 @@ """ import io +from urllib.parse import urljoin import requests import pandas as pd from json import JSONDecodeError -NSRDB_API_BASE = "https://developer.nrel.gov" -API_STUB = "/api/nsrdb/v2/solar/" +NSRDB_API_BASE = "https://developer.nrel.gov/api/nsrdb/v2/solar/" GOES_ENDPOINT = "nsrdb-GOES-aggregated-v4-0-0-download.csv" TMY_ENDPOINT = "nsrdb-GOES-tmy-v4-0-0-download.csv" GOESCONUS_ENDPOINT = "nsrdb-GOES-conus-v4-0-0-download.csv" -GOES_URL = NSRDB_API_BASE + API_STUB + GOES_ENDPOINT -TMY_URL = NSRDB_API_BASE + API_STUB + TMY_ENDPOINT -GOESCONUS_URL = NSRDB_API_BASE + API_STUB + GOESCONUS_ENDPOINT +GOES_URL = urljoin(NSRDB_API_BASE, GOES_ENDPOINT) +TMY_URL = urljoin(NSRDB_API_BASE, TMY_ENDPOINT) +GOESCONUS_URL = urljoin(NSRDB_API_BASE, GOESCONUS_ENDPOINT) ATTRIBUTES = ( 'air_temperature', 'dew_point', 'dhi', 'dni', 'ghi', 'surface_albedo', @@ -356,11 +356,6 @@ def read_psm4(filename, map_variables=True): Read an NSRDB PSM4 weather file (formatted as SAM CSV). The NSRDB is described in [1]_ and the SAM CSV format is described in [2]_. - .. versionchanged:: 0.9.0 - The function now returns a tuple where the first element is a dataframe - and the second element is a dictionary containing metadata. Previous - versions of this function had the return values switched. - Parameters ---------- filename: str diff --git a/pvlib/tests/iotools/test_psm4.py b/pvlib/tests/iotools/test_psm4.py index a525e88d46..d6464451c8 100644 --- a/pvlib/tests/iotools/test_psm4.py +++ b/pvlib/tests/iotools/test_psm4.py @@ -185,7 +185,7 @@ def test_get_psm4_attribute_mapping(nrel_api_key): """Test that pvlib names can be passed in as attributes and get correctly reverse mapped to psm4 names""" data, meta = psm4.get_psm4(LATITUDE, LONGITUDE, nrel_api_key, - PVLIB_EMAIL, names=2019, interval=60, + PVLIB_EMAIL, names='2019', interval=60, attributes=['ghi', 'wind_speed'], leap_day=False, map_variables=True) # Check that columns are in the correct order (GH1647)