Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add albedo function for inland water bodies #2079
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
Add albedo function for inland water bodies #2079
Changes from all commits
0e87325
163cf82
47efb47
7e44696
c3c2fc1
357cb38
55b9271
187b6f6
2a20e8c
75ae142
5c93bfe
e487893
b5cef90
d8b214d
0e5b464
79406e2
0340389
f469db3
d2e83f3
c9ef664
4a089ab
7595216
93b6ff8
7c99fd2
2fce253
98a5006
94b3f03
7738020
7d55e30
4bfc6d1
eaaced0
7776c33
0645463
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible to get an array out despite putting a Series in:
This is not an uncommon problem when using numpy tricks like
np.where
. Our usual workaround is to fix up the types at the end of the function like this:A little inelegant, but it gets the job done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't the type check of int/floats I suggested earlier do the job?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type checking has some tricky edge cases (e.g.
isinstance(np.array([45.])[0], (int, float))
isFalse
because it is annp.float64
, not afloat
). A test based onnp.isscalar
might be ok.But I think it is generally better to fix up types at the end instead of following different calculation paths based on type. Less chance of accidentally calculating different output values for different types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kandersolar the problem is that
np.where
returns an array (even if you pass a pd.Series for the solar_elevation) - so the if statement is never true. I did a fix, but it might not be the prettiest one... can you approve it (or suggest an alternative)?