8000 Change local_path to save_path in get_bsrn by AdamRJensen · Pull Request #1282 · pvlib/pvlib-python · GitHub
[go: up one dir, main page]

Skip to content

Change local_path to save_path in get_bsrn #1282

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 7 commits into from
Sep 1, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Save testfile in temporary directory
  • Loading branch information
AdamRJensen committed Sep 1, 2021
commit b083acd17447cdf854e30fc22be508761213c5e3
7 changes: 5 additions & 2 deletions pvlib/tests/iotools/test_bsrn.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import pandas as pd
import pytest
import os
import tempfile
from pvlib.iotools import read_bsrn, get_bsrn
from ..conftest import (DATA_DIR, RERUNS, RERUNS_DELAY, assert_index_equal,
requires_bsrn_credentials)
Expand Down Expand Up @@ -78,24 +79,26 @@ def test_read_bsrn_logical_records_not_found():
def test_get_bsrn(expected_index, bsrn_credentials):
# Retrieve irradiance data from the BSRN FTP server
# the TAM station is chosen due to its small file sizes
temp_dir = tempfile.TemporaryDirectory() # create temporary directory
username, password = bsrn_credentials
data, metadata = get_bsrn(
start=pd.Timestamp(2016, 6, 1),
end=pd.Timestamp(2016, 6, 29),
station='tam',
username=username,
password=password,
save_path='')
save_path=temp_dir.name)
assert_index_equal(expected_index, data.index)
assert 'ghi' in data.columns
assert 'dni_std' in data.columns
assert 'dhi_min' in data.columns
assert 'lwd_max' in data.columns
assert 'relative_humidity' in data.columns
# test that a local file was saved and is read correctly
data2, metadata2 = read_bsrn('tam0616.dat.gz')
data2, metadata2 = read_bsrn(os.path.join(temp_dir.name, 'tam0616.dat.gz'))
assert_index_equal(expected_index, data2.index)
assert 'ghi' in data2.columns
temp_dir.cleanup() # explicitly remove temporary directory


@requires_bsrn_credentials
Expand Down
0