Skip to content

De-noise CI output #1294

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 11 commits into from
Sep 10, 2021
2 changes: 1 addition & 1 deletion pvlib/clearsky.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def _calc_taud(w, aod700, p):
# set up nan-tolerant masks
aod700_lt_0p05 = np.full_like(aod700, False, dtype='bool')
np.less(aod700, 0.05, where=~np.isnan(aod700), out=aod700_lt_0p05)
aod700_mask = np.array([aod700_lt_0p05, ~aod700_lt_0p05], dtype=np.int)
aod700_mask = np.array([aod700_lt_0p05, ~aod700_lt_0p05], dtype=int)

# create tuples of coefficients for
# aod700 < 0.05, aod700 >= 0.05
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/iotools/test_ecmwf_macc.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def test_read_ecmwf_macc(expected_test_data):
expected_times = [
1351738800, 1351749600, 1351760400, 1351771200, 1351782000, 1351792800,
1351803600, 1351814400]
assert np.allclose(data.index.astype(int) // 1000000000, expected_times)
assert np.allclose(data.index.view(np.int64) // 1000000000, expected_times)
expected_aod = np.array([
0.39531226, 0.22371339, 0.18373083, 0.15010143, 0.130809, 0.11172834,
0.09741255, 0.0921606])
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/iotools/test_tmy.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_gh865_read_tmy3_feb_leapyear_hr24():
assert all(data.index[:-1].year == 1990)
assert data.index[-1].year == 1991
# let's do a quick sanity check, are the indices monotonically increasing?
assert all(np.diff(data.index.astype(int)) == 3600000000000)
assert all(np.diff(data.index.view(np.int64)) == 3600000000000)
# according to the TMY3 manual, each record corresponds to the previous
# hour so check that the 1st hour is 1AM and the last hour is midnite
assert data.index[0].hour == 1
Expand Down
2 changes: 1 addition & 1 deletion pvlib/tests/test_modelchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ def test_run_model_with_weather_noct_sam_temp(sapm_dc_snl_ac_system, location,
weather, mocker):
weather['wind_speed'] = 5
weather['temp_air'] = 10
sapm_dc_snl_ac_system.temperature_model_parameters = {
sapm_dc_snl_ac_system.arrays[0].temperature_model_parameters = {
'noct': 45, 'module_efficiency': 0.2
}
mc = ModelChain(sapm_dc_snl_ac_system, location)
Expand Down
54 changes: 24 additions & 30 deletions pvlib/tests/test_solarposition.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,21 +204,18 @@ def test_sun_rise_set_transit_ephem(expected_rise_set_ephem, golden):
expected = pd.DataFrame(index=times,
columns=['sunrise', 'sunset'],
dtype='datetime64[ns]')
expected['sunrise'] = pd.Series(index=times, data=[
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 2), 'sunrise'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 3), 'sunrise'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 3), 'sunrise'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 3), 'sunrise']])
expected['sunset'] = pd.Series(index=times, data=[
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 2), 'sunset'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 2), 'sunset'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 2), 'sunset'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 3), 'sunset']])
expected['transit'] = pd.Series(index=times, data=[
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 2), 'transit'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 2), 'transit'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 3), 'transit'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 3), 'transit']])
idx_sunrise = pd.to_datetime(['2015-01-02', '2015-01-03', '2015-01-03',
'2015-01-03']).tz_localize('MST')
expected['sunrise'] = \
expected_rise_set_ephem.loc[idx_sunrise, 'sunrise'].tolist()
idx_sunset = pd.to_datetime(['2015-01-02', '2015-01-02', '2015-01-02',
'2015-01-03']).tz_localize('MST')
expected['sunset'] = \
expected_rise_set_ephem.loc[idx_sunset, 'sunset'].tolist()
idx_transit = pd.to_datetime(['2015-01-02', '2015-01-02', '2015-01-03',
'2015-01-03']).tz_localize('MST')
expected['transit'] = \
expected_rise_set_ephem.loc[idx_transit, 'transit'].tolist()

result = solarposition.sun_rise_set_transit_ephem(times,
golden.latitude,
Expand All @@ -243,21 +240,18 @@ def test_sun_rise_set_transit_ephem(expected_rise_set_ephem, golden):
expected = pd.DataFrame(index=times,
columns=['sunrise', 'sunset'],
dtype='datetime64[ns]')
expected['sunrise'] = pd.Series(index=times, data=[
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 1), 'sunrise'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 2), 'sunrise'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 2), 'sunrise'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 3), 'sunrise']])
expected['sunset'] = pd.Series(index=times, data=[
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 1), 'sunset'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 1), 'sunset'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 2), 'sunset'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 2), 'sunset']])
expected['transit'] = pd.Series(index=times, data=[
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 1), 'transit'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 1), 'transit'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 2), 'transit'],
expected_rise_set_ephem.loc[datetime.datetime(2015, 1, 3), 'transit']])
idx_sunrise = pd.to_datetime(['2015-01-01', '2015-01-02', '2015-01-02',
'2015-01-03']).tz_localize('MST')
expected['sunrise'] = \
expected_rise_set_ephem.loc[idx_sunrise, 'sunrise'].tolist()
idx_sunset = pd.to_datetime(['2015-01-01', '2015-01-01', '2015-01-02',
'2015-01-02']).tz_localize('MST')
expected['sunset'] = \
expected_rise_set_ephem.loc[idx_sunset, 'sunset'].tolist()
idx_transit = pd.to_datetime(['2015-01-01', '2015-01-01', '2015-01-02',
'2015-01-03']).tz_localize('MST')
expected['transit'] = \
expected_rise_set_ephem.loc[idx_transit, 'transit'].tolist()

result = solarposition.sun_rise_set_transit_ephem(
times,
Expand Down
28 changes: 14 additions & 14 deletions pvlib/tests/test_spa.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

times = (pd.date_range('2003-10-17 12:30:30', periods=1, freq='D')
.tz_localize('MST'))
unixtimes = np.array(times.tz_convert('UTC').astype(np.int64)*1.0/10**9)
unixtimes = np.array(times.tz_convert('UTC').view(np.int64)*1.0/10**9)

lat = 39.742476
lon = -105.1786
Expand Down Expand Up @@ -266,15 +266,15 @@ def test_transit_sunrise_sunset(self):
times = pd.DatetimeIndex([dt.datetime(1996, 7, 5, 0),
dt.datetime(2004, 12, 4, 0)]
).tz_localize(
'UTC').astype(np.int64)*1.0/10**9
'UTC').view(np.int64)*1.0/10**9
sunrise = pd.DatetimeIndex([dt.datetime(1996, 7, 5, 7, 8, 15),
dt.datetime(2004, 12, 4, 4, 38, 57)]
).tz_localize(
'UTC').astype(np.int64)*1.0/10**9
'UTC').view(np.int64)*1.0/10**9
sunset = pd.DatetimeIndex([dt.datetime(1996, 7, 5, 17, 1, 4),
dt.datetime(2004, 12, 4, 19, 2, 2)]
).tz_localize(
'UTC').astype(np.int64)*1.0/10**9
'UTC').view(np.int64)*1.0/10**9
times = np.array(times)
sunrise = np.array(sunrise)
sunset = np.array(sunset)
Expand All @@ -284,13 +284,13 @@ def test_transit_sunrise_sunset(self):

times = pd.DatetimeIndex([dt.datetime(1994, 1, 2), ]
).tz_localize(
'UTC').astype(np.int64)*1.0/10**9
'UTC').view(np.int64)*1.0/10**9
sunset = pd.DatetimeIndex([dt.datetime(1994, 1, 2, 16, 59, 55), ]
).tz_localize(
'UTC').astype(np.int64)*1.0/10**9
'UTC').view(np.int64)*1.0/10**9
sunrise = pd.DatetimeIndex([dt.datetime(1994, 1, 2, 7, 8, 12), ]
).tz_localize(
'UTC').astype(np.int64)*1.0/10**9
'UTC').view(np.int64)*1.0/10**9
times = np.array(times)
sunrise = np.array(sunrise)
sunset = np.array(sunset)
Expand All @@ -305,19 +305,19 @@ def test_transit_sunrise_sunset(self):
dt.datetime(2015, 8, 2),
dt.datetime(2015, 12, 2)],
).tz_localize(
'UTC').astype(np.int64)*1.0/10**9
'UTC').view(np.int64)*1.0/10**9
sunrise = pd.DatetimeIndex([dt.datetime(2015, 1, 2, 7, 19),
dt.datetime(2015, 4, 2, 5, 43),
dt.datetime(2015, 8, 2, 5, 1),
dt.datetime(2015, 12, 2, 7, 1)],
).tz_localize(
'MST').astype(np.int64)*1.0/10**9
'MST').view(np.int64)*1.0/10**9
sunset = pd.DatetimeIndex([dt.datetime(2015, 1, 2, 16, 49),
dt.datetime(2015, 4, 2, 18, 24),
dt.datetime(2015, 8, 2, 19, 10),
dt.datetime(2015, 12, 2, 16, 38)],
).tz_localize(
'MST').astype(np.int64)*1.0/10**9
'MST').view(np.int64)*1.0/10**9
times = np.array(times)
sunrise = np.array(sunrise)
sunset = np.array(sunset)
Expand All @@ -331,18 +331,18 @@ def test_transit_sunrise_sunset(self):
dt.datetime(2015, 8, 2),
dt.datetime(2015, 12, 2)],
).tz_localize(
'UTC').astype(np.int64)*1.0/10**9
'UTC').view(np.int64)*1.0/10**9
sunrise = pd.DatetimeIndex([dt.datetime(2015, 1, 2, 7, 36),
dt.datetime(2015, 4, 2, 5, 58),
dt.datetime(2015, 8, 2, 5, 13),
dt.datetime(2015, 12, 2, 7, 17)],
).tz_localize('Asia/Shanghai').astype(
).tz_localize('Asia/Shanghai').view(
np.int64)*1.0/10**9
sunset = pd.DatetimeIndex([dt.datetime(2015, 1, 2, 17, 0),
dt.datetime(2015, 4, 2, 18, 39),
dt.datetime(2015, 8, 2, 19, 28),
dt.datetime(2015, 12, 2, 16, 50)],
).tz_localize('Asia/Shanghai').astype(
).tz_localize('Asia/Shanghai').view(
np.int64)*1.0/10**9
times = np.array(times)
sunrise = np.array(sunrise)
Expand All @@ -355,7 +355,7 @@ def test_transit_sunrise_sunset(self):
def test_earthsun_distance(self):
times = (pd.date_range('2003-10-17 12:30:30', periods=1, freq='D')
.tz_localize('MST'))
unixtimes = times.tz_convert('UTC').astype(np.int64)*1.0/10**9
unixtimes = times.tz_convert('UTC').view(np.int64)*1.0/10**9
unixtimes = np.array(unixtimes)
result = self.spa.earthsun_distance(unixtimes, 64.0, 1)
assert_almost_equal(R, result, 6)
Expand Down
44 changes: 22 additions & 22 deletions pvlib/tests/test_tracking.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pvlib
from pvlib import tracking
from .conftest import DATA_DIR, assert_frame_equal
from .conftest import DATA_DIR, assert_frame_equal, assert_series_equal
from pvlib._deprecation import pvlibDeprecationWarning

SINGLEAXIS_COL_ORDER = ['tracker_theta', 'aoi',
Expand Down Expand Up @@ -462,21 +462,21 @@ def test_slope_aware_backtracking():
"""
Test validation data set from https://www.nrel.gov/docs/fy20osti/76626.pdf
"""
expected_data = np.array(
[('2019-01-01T08:00-0500', 2.404287, 122.79177, -84.440, -10.899),
('2019-01-01T09:00-0500', 11.263058, 133.288729, -72.604, -25.747),
('2019-01-01T10:00-0500', 18.733558, 145.285552, -59.861, -59.861),
('2019-01-01T11:00-0500', 24.109076, 158.939435, -45.578, -45.578),
('2019-01-01T12:00-0500', 26.810735, 173.931802, -28.764, -28.764),
('2019-01-01T13:00-0500', 26.482495, 189.371536, -8.475, -8.475),
('2019-01-01T14:00-0500', 23.170447, 204.13681, 15.120, 15.120),
('2019-01-01T15:00-0500', 17.296785, 217.446538, 39.562, 39.562),
('2019-01-01T16:00-0500', 9.461862, 229.102218, 61.587, 32.339),
('2019-01-01T17:00-0500', 0.524817, 239.330401, 79.530, 5.490)],
dtype=[
('Time', '<M8[h]'), ('ApparentElevation', '<f8'),
('SolarAzimuth', '<f8'), ('TrueTracking', '<f8'),
('Backtracking', '<f8')])
index = pd.date_range('2019-01-01T08:00', '2019-01-01T17:00', freq='h')
index = index.tz_localize('Etc/GMT+5')
expected_data = pd.DataFrame(index=index, data=[
( 2.404287, 122.79177, -84.440, -10.899),
(11.263058, 133.288729, -72.604, -25.747),
(18.733558, 145.285552, -59.861, -59.861),
(24.109076, 158.939435, -45.578, -45.578),
(26.810735, 173.931802, -28.764, -28.764),
(26.482495, 189.371536, -8.475, -8.475),
(23.170447, 204.13681, 15.120, 15.120),
(17.296785, 217.446538, 39.562, 39.562),
( 9.461862, 229.102218, 61.587, 32.339),
( 0.524817, 239.330401, 79.530, 5.490),
], columns=['ApparentElevation', 'SolarAzimuth',
'TrueTracking', 'Backtracking'])
expected_axis_tilt = 9.666
expected_slope_angle = -2.576
slope_azimuth, slope_tilt = 180.0, 10.0
Expand All @@ -492,16 +492,16 @@ def test_slope_aware_backtracking():
90.0-expected_data['ApparentElevation'], expected_data['SolarAzimuth'],
axis_tilt, axis_azimuth, max_angle=90.0, backtrack=True, gcr=0.5,
cross_axis_tilt=cross_axis_tilt)
np.testing.assert_allclose(
sat['tracker_theta'], expected_data['Backtracking'],
rtol=1e-3, atol=1e-3)
assert_series_equal(sat['tracker_theta'],
expected_data['Backtracking'].rename('tracker_theta'),
check_less_precise=True)
truetracking = tracking.singleaxis(
90.0-expected_data['ApparentElevation'], expected_data['SolarAzimuth'],
axis_tilt, axis_azimuth, max_angle=90.0, backtrack=False, gcr=0.5,
cross_axis_tilt=cross_axis_tilt)
np.testing.assert_allclose(
truetracking['tracker_theta'], expected_data['TrueTracking'],
rtol=1e-3, atol=1e-3)
assert_series_equal(truetracking['tracker_theta'],
expected_data['TrueTracking'].rename('tracker_theta'),
check_less_precise=True)


def test_singleaxis_aoi_gh1221():
Expand Down
19 changes: 18 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,21 @@ exclude = pvlib/_version.py docs dist

[tool:pytest]
junit_family=xunit2
testpaths = pvlib/tests
testpaths = pvlib/tests
filterwarnings =
# warning messages to suppress from pytest output. useful in cases
# where a dependency hasn't addressed a deprecation yet, and there's
# nothing we can do to fix it ourselves.
# syntax is: action:message:category:module:lineno
# `message` is a regex matching start of warning message
# https://docs.python.org/3/library/warnings.html#the-warnings-filter

ignore:Using or importing the ABCs:DeprecationWarning:.*patsy:

# deprecation warnings from numpy 1.20
ignore:`np.long` is a deprecated alias:DeprecationWarning:.*numba:
ignore:`np.int` is a deprecated alias:DeprecationWarning:.*(numba|scipy):
ignore:`np.bool` is a deprecated alias:DeprecationWarning:.*numba:
# warnings from netcdf4, but reported as coming from pvlib
ignore:`np.bool` is a deprecated alias:DeprecationWarning:.*(ecmwf_macc|forecast):
ignore:tostring\(\) is deprecated:DeprecationWarning:.*ecmwf_macc: