Skip to content

Commit b6424e3

Browse files
committed
clarify threshold_depth
1 parent 11cf12e commit b6424e3

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

pvlib/snow.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,23 @@ def _time_delta_in_hours(times):
1313
return delta.dt.total_seconds().div(3600)
1414

1515

16-
def fully_covered_nrel(snowfall, snow_depth=None, threshold_snowfall=1.):
16+
def fully_covered_nrel(snowfall, snow_depth=None, threshold_snowfall=1.,
17+
threshold_depth=1.):
1718
'''
1819
Calculates the timesteps when modules are fully covered by snow.
1920
2021
Parameters
2122
----------
2223
snowfall: Series
23-
Accumulated snowfall in each time period. [cm]
24+
Snowfall in each time period. [cm]
2425
snow_depth: Series, optional
2526
Snow depth on the ground at the beginning of each time period.
2627
Must have the same index as ``snowfall``. [cm]
2728
threshold_snowfall: float, default 1.0
2829
Hourly snowfall above which the row is fully covered for that hour.
2930
[cm/hr]
31+
threshold_depth: float, default 1.0
32+
Snow depth on the ground, above which snow can affect the modules. [cm]
3033
3134
Returns
3235
----------
@@ -38,9 +41,9 @@ def fully_covered_nrel(snowfall, snow_depth=None, threshold_snowfall=1.):
3841
-----
3942
Implements the model described in [1]_ with minor improvements in [2]_.
4043
41-
``snow_depth`` is used to return `False` (not fully covered) when no snow
42-
is present on the ground. This check is described in [2]_ as needed for
43-
systems with low tilt angle.
44+
``snow_depth`` is used to return `False` (not fully covered) when snow
45+
is less than ``threshold_depth. This check is described in [2]_ as needed
46+
for systems with low tilt angle.
4447
4548
References
4649
----------
@@ -64,13 +67,14 @@ def fully_covered_nrel(snowfall, snow_depth=None, threshold_snowfall=1.):
6467
covered = (hourly_snow_rate > threshold_snowfall)
6568
# no coverage when no snow on the ground
6669
if snow_depth is not None:
67-
covered = covered & (snow_depth > 0.)
70+
covered = covered & (snow_depth >= threshold_depth)
6871
return covered
6972

7073

7174
def coverage_nrel(snowfall, poa_irradiance, temp_air, surface_tilt,
7275
snow_depth=None, initial_coverage=0, threshold_snowfall=1.,
73-
can_slide_coefficient=-80., slide_amount_coefficient=0.197):
76+
threshold_depth=1., can_slide_coefficient=-80.,
77+
slide_amount_coefficient=0.197):
7478
'''
7579
Calculates the fraction of the slant height of a row of modules that is
7680
covered by snow at every time step.
@@ -83,7 +87,7 @@ def coverage_nrel(snowfall, poa_irradiance, temp_air, surface_tilt,
8387
Parameters
8488
----------
8589
snowfall : Series
86-
Accumulated snowfall within each time period. [cm]
90+
Snowfall within each time period. [cm]
8791
poa_irradiance : Series
8892
Total in-plane irradiance [W/m^2]
8993
temp_air : Series
@@ -100,6 +104,8 @@ def coverage_nrel(snowfall, poa_irradiance, temp_air, surface_tilt,
100104
threshold_snowfall : float, default 1.0
101105
Hourly snowfall above which snow coverage is set to the row's slant
102106
height. [cm/hr]
107+
threshold_depth: float, default 1.0
108+
Snow depth on the ground, above which snow can affect the modules. [cm]
103109
can_slide_coefficient : float, default -80.
104110
Coefficient to determine if snow can slide given irradiance and air
105111
temperature. [W/(m^2 C)]
@@ -118,9 +124,9 @@ def coverage_nrel(snowfall, poa_irradiance, temp_air, surface_tilt,
118124
In [1]_, ``can_slide_coefficient`` is termed `m`, and the value of
119125
``slide_amount_coefficient`` is given in tenths of a module's slant height.
120126
121-
``snow_depth`` is used to set ``snow_coverage`` to 0 when no snow is
122-
present on the ground. This check is described in [2]_ as needed for
123-
systems with low tilt angle.
127+
``snow_depth`` is used to set ``snow_coverage`` to 0 (not fully covered)
128+
when snow is less than ``threshold_depth. . This check is described in
129+
[2]_ as needed for systems with low tilt angle.
124130
125131
References
126132
----------
@@ -133,7 +139,8 @@ def coverage_nrel(snowfall, poa_irradiance, temp_air, surface_tilt,
133139
'''
134140

135141
# find times with new snowfall
136-
new_snowfall = fully_covered_nrel(snowfall, snow_depth, threshold_snowfall)
142+
new_snowfall = fully_covered_nrel(snowfall, snow_depth, threshold_snowfall,
143+
threshold_depth)
137144

138145
# set up output Series
139146
snow_coverage = pd.Series(np.nan, index=poa_irradiance.index)
@@ -162,7 +169,7 @@ def coverage_nrel(snowfall, poa_irradiance, temp_air, surface_tilt,
162169
if snow_depth is not None:
163170
# no coverage when there's no snow on the ground
164171
# described in [2] to avoid non-sliding snow for low-tilt systems.
165-
snow_coverage[snow_depth <= 0] = 0.
172+
snow_coverage[snow_depth < threshold_depth] = 0.
166173
# clean up periods where row is completely uncovered
167174
return snow_coverage.clip(lower=0)
168175

pvlib/tests/test_snow.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def test_fully_covered_nrel_with_snow_depth():
2727
expected = pd.Series([False, True, False, True, False, False, False],
2828
index=dt)
2929
fully_covered = snow.fully_covered_nrel(snowfall_data,
30-
snow_depth=snow_depth)
30+
snow_depth=snow_depth,
31+
threshold_depth=0.)
3132
assert_series_equal(expected, fully_covered)
3233

3334

@@ -53,6 +54,7 @@ def test_coverage_nrel_hourly():
5354
def test_coverage_nrel_hourly_with_snow_depth():
5455
surface_tilt = 45
5556
slide_amount_coefficient = 0.197
57+
threshold_depth = 0.5
5658
dt = pd.date_range(start="2019-1-1 10:00:00", end="2019-1-1 17:00:00",
5759
freq='1h')
5860
poa_irradiance = pd.Series([400, 200, 100, 1234, 134, 982, 100, 100],
@@ -62,12 +64,13 @@ def test_coverage_nrel_hourly_with_snow_depth():
6264
snow_depth = pd.Series([1, 1, 1, 1, 0, 1, 0, .1], index=dt)
6365
snow_coverage = snow.coverage_nrel(
6466
snowfall_data, poa_irradiance, temp_air, surface_tilt,
65-
snow_depth=snow_depth, threshold_snowfall=0.6)
67+
snow_depth=snow_depth, threshold_snowfall=0.6,
68+
threshold_depth=threshold_depth)
6669

6770
slide_amt = slide_amount_coefficient * sind(surface_tilt)
6871
covered = 1.0 - slide_amt * np.array([0, 1, 2, 3, 4, 5, 6, 7])
6972
expected = pd.Series(covered, index=dt)
70-
expected[snow_depth <= 0] = 0
73+
expected[snow_depth < threshold_depth] = 0
7174
assert_series_equal(expected, snow_coverage)
7275

7376

0 commit comments

Comments
 (0)