Fix omission in snow_coverage_nrel#2292
Conversation
IoannisSifnaios
left a comment
There was a problem hiding this comment.
Some ideas from my side. Otherwise looks good to me!
| if snow_depth is not None: | ||
| # no coverage when there's no snow on the ground | ||
| # described in [2] to avoid non-sliding snow for low-tilt systems. | ||
| snow_coverage[snow_depth <= 0] = 0. |
There was a problem hiding this comment.
I don't think this check can be applied at the end like this. In cases where the check takes effect (snow_depth = 0 --> coverage = 0), that effect should propagate forward in time and influence values for future timestamps. As it is now, I don't think this code allows that.
See for example this input:
times = pd.date_range("2019-01-01", freq="h", periods=4)
snowfall = pd.Series([10, 0, 0, 0.1], index=times) # last value is below threshold_snowfall
snow_depth = pd.Series([10, 5, 0, 0.1], index=times)
poa_irradiance = pd.Series(100, index=times)
temp_air = pd.Series(-1, index=times)
surface_tilt = 10
coverage_nrel(snowfall, poa_irradiance, temp_air, surface_tilt, snow_depth)
# output:
2019-01-01 00:00:00 1.000000
2019-01-01 01:00:00 0.965791
2019-01-01 02:00:00 0.000000
2019-01-01 03:00:00 0.897374 # this value doesn't make sense, should be zeroThere was a problem hiding this comment.
I think you are correct. The SAM implementation appears to iterate over timesteps.
There was a problem hiding this comment.
In the SAM algorithm, these lines set coverage to full if both of two conditions are met:
if ((snowDepth - previousDepth) >= deltaThreshold*dt && snowDepth >= depthThreshold){
coverage = 1;
}
So change in snow depth exceeds deltaThreshold (*dt converts to hourly), and snowDepth exceeds a different threshold so the snow is "sticking" around.
There was a problem hiding this comment.
@kandersolar I think I've corrected the implementation of the check
times = pd.date_range("2019-01-01", freq="h", periods=4)
snowfall = pd.Series([10, 0, 0, 0.1], index=times) # last value is below threshold_snowfall
snow_depth = pd.Series([10, 5, 0, 0.1], index=times)
poa_irradiance = pd.Series(100, index=times)
temp_air = pd.Series(-1, index=times)
surface_tilt = 10
coverage_nrel(snowfall, poa_irradiance, temp_air, surface_tilt, snow_depth)
Out[3]:
2019-01-01 00:00:00 1.000000
2019-01-01 01:00:00 0.965791
2019-01-01 02:00:00 0.000000
2019-01-01 03:00:00 0.000000
Freq: H, dtype: float64
kandersolar
left a comment
There was a problem hiding this comment.
The new approach makes sense to me. A few minor comments, and there's a merge conflict.
| # all slides off if there is no snow on the ground | ||
| # described in [2] to avoid non-sliding snow for low-tilt systems. | ||
| # default threshold_depth of 1cm is from SAM's implementation and | ||
| # is different than the value of 0cm implied in [2]. |
There was a problem hiding this comment.
Is this comment regarding the value in [2] correct? In the last paragraph on page 3 ("Implementation in SAM"), I see:
We set these thresholds equal to 1 cm for consistency with snow depth measurement uncertainties
There was a problem hiding this comment.
I read that paragraph as describing the detection of new snow fall. I think the intent is clear, however - no snow on the panels if there's minimal snow on the ground.
Co-authored-by: Kevin Anderson <kevin.anderso@gmail.com>
docs/sphinx/source/referencefor API changes.docs/sphinx/source/whatsnewfor all changes. Includes link to the GitHub Issue with:issue:`num`or this Pull Request with:pull:`num`. Includes contributor name and/or GitHub username (link with:ghuser:`user`).remote-data) and Milestone are assigned to the Pull Request and linked Issue.Additional scope if I can get clarity: describe whether
snowfallis left- or right-aligned.