|
5 | 5 | """ |
6 | 6 |
|
7 | 7 | import io |
| 8 | +from urllib.parse import urljoin |
8 | 9 | import requests |
9 | 10 | import pandas as pd |
10 | 11 | from json import JSONDecodeError |
11 | 12 |
|
12 | | -NSRDB_API_BASE = "https://developer.nrel.gov" |
13 | | -API_STUB = "/api/nsrdb/v2/solar/" |
| 13 | +NSRDB_API_BASE = "https://developer.nrel.gov/api/nsrdb/v2/solar/" |
14 | 14 | GOES_ENDPOINT = "nsrdb-GOES-aggregated-v4-0-0-download.csv" |
15 | 15 | TMY_ENDPOINT = "nsrdb-GOES-tmy-v4-0-0-download.csv" |
16 | 16 | GOESCONUS_ENDPOINT = "nsrdb-GOES-conus-v4-0-0-download.csv" |
17 | | -GOES_URL = NSRDB_API_BASE + API_STUB + GOES_ENDPOINT |
18 | | -TMY_URL = NSRDB_API_BASE + API_STUB + TMY_ENDPOINT |
19 | | -GOESCONUS_URL = NSRDB_API_BASE + API_STUB + GOESCONUS_ENDPOINT |
| 17 | +GOES_URL = urljoin(NSRDB_API_BASE, GOES_ENDPOINT) |
| 18 | +TMY_URL = urljoin(NSRDB_API_BASE, TMY_ENDPOINT) |
| 19 | +GOESCONUS_URL = urljoin(NSRDB_API_BASE, GOESCONUS_ENDPOINT) |
20 | 20 |
|
21 | 21 | ATTRIBUTES = ( |
22 | 22 | 'air_temperature', 'dew_point', 'dhi', 'dni', 'ghi', 'surface_albedo', |
@@ -356,11 +356,6 @@ def read_psm4(filename, map_variables=True): |
356 | 356 | Read an NSRDB PSM4 weather file (formatted as SAM CSV). The NSRDB |
357 | 357 | is described in [1]_ and the SAM CSV format is described in [2]_. |
358 | 358 |
|
359 | | - .. versionchanged:: 0.9.0 |
360 | | - The function now returns a tuple where the first element is a dataframe |
361 | | - and the second element is a dictionary containing metadata. Previous |
362 | | - versions of this function had the return values switched. |
363 | | -
|
364 | 359 | Parameters |
365 | 360 | ---------- |
366 | 361 | filename: str |
|
0 commit comments