Skip to content

Commit f3a2eec

Browse files
committed
fixes
1 parent 3661d86 commit f3a2eec

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

pvlib/snowcoverage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
def _time_delta_in_hours(times):
1212
delta = times.to_series().diff()
13-
return delta.dt.total_seconds.div(3600)
13+
return delta.dt.total_seconds().div(3600)
1414

1515

1616
def snow_nrel_fully_covered(snowfall, threshold=1.):

pvlib/tests/test_snowcoverage.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ def test_snow_nrel_hourly():
2424
freq='1h')
2525
poa_irradiance = pd.Series([400, 200, 100, 1234, 134, 982, 100, 100],
2626
index=dt)
27-
temperature = pd.Series([10, 2, 10, 1234, 34, 982, 10, 10], index=dt)
28-
slide_amt = sliding_coefficient * sind(surface_tilt)
27+
temp_air = pd.Series([10, 2, 10, 1234, 34, 982, 10, 10], index=dt)
2928
snowfall_data = pd.Series([1, .5, .6, .4, .23, -5, .1, .1], index=dt)
3029
snow_coverage = snowcoverage.snow_nrel(
31-
snowfall_data, poa_irradiance, temperature, surface_tilt,
30+
snowfall_data, poa_irradiance, temp_air, surface_tilt,
3231
threshold_snowfall=0.6)
32+
33+
slide_amt = sliding_coefficient * sind(surface_tilt)
3334
covered = np.append(np.array([0., 0.]),
3435
1.0 - slide_amt * np.array([0, 1, 2, 3, 4, 5]))
3536
expected = pd.Series(covered, index=dt)
@@ -41,16 +42,20 @@ def test_snow_nrel_subhourly():
4142
sliding_coefficient = 0.197
4243
dt = pd.date_range(start="2019-1-1 11:00:00", end="2019-1-1 14:00:00",
4344
freq='15T')
44-
poa_irradiance = pd.Series([400, 200, 100, 1234, 134, 982, 100, 100],
45+
poa_irradiance = pd.Series([400, 200, 100, 1234, 134, 982, 100, 100, 100,
46+
100, 1000, 1000, 0],
4547
index=dt)
46-
temperature = pd.Series([10, 2, 10, 1234, 34, 982, 10, 10], index=dt)
47-
slide_amt = sliding_coefficient * sind(surface_tilt)
48-
snowfall_data = pd.Series([1, .5, .6, .4, .23, -5, .1, .1], index=dt)
48+
temp_air = pd.Series([10, 2, 10, 1234, 34, 982, 10, 10, 10, 10, 10, 10,
49+
10], index=dt)
50+
snowfall_data = pd.Series([1, .5, .6, .4, .23, -5, .1, .1, 0., 1., 0., 0.,
51+
0.], index=dt)
4952
snow_coverage = snowcoverage.snow_nrel(
50-
snowfall_data, poa_irradiance, temperature, surface_tilt,
51-
threshold_snowfall=0.6)
52-
covered = np.append(np.array([0., 0.]),
53-
1.0 - slide_amt * np.array([0, 1, 2, 3, 4, 5]))
53+
snowfall_data, poa_irradiance, temp_air, surface_tilt,
54+
threshold_snowfall=0.5)
55+
slide_amt = sliding_coefficient * sind(surface_tilt) * 0.25
56+
covered = np.append(np.array([0., 1., 1.]),
57+
1.0 - slide_amt * np.array([1, 2, 3, 4, 5, 6]))
58+
covered = np.append(covered, np.array([1., 1., 1., 1. - slide_amt]))
5459
expected = pd.Series(covered, index=dt)
5560
assert_series_equal(snow_coverage, expected)
5661

0 commit comments

Comments
 (0)