Skip to content

WIP: handful of minor things #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pvlib/iotools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
15 changes: 5 additions & 10 deletions pvlib/iotools/psm4.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/iotools/test_psm4.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading