-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Lookup altitude2 #1547
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
Lookup altitude2 #1547
Conversation
Changing fixture to parametrize because is not reused
Moving lookup_altitude up to prevent confusion in code And credits
The coverage for the spa_c solar position method keeps failing even though it is covered in tests. |
Yep, we don't include the SPA C code in the pvlib repository and tests due to licensing issues (#9). Any CI coverage issues around SPA C can/should be ignored. |
@nicomt we're on the cusp of releasing 0.9.3, which includes your last PR. Do you agree that there is no problem making that release without including this PR? Since some defaults are changing, I think it makes sense to wait for 0.10.0 here, just want to confirm that the previous PR can stand on its own without this one. |
@kanderso-nrel You are right the last release should stand on its own. I don't see any problem delaying this PR. |
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.
Took a brief look and everything seems to check out.
Still a little skeptical about relying on an external file, which may be updated in the future and cause inconsistencies between versions.
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.
Thanks again @nicomt for this PR. I think I like the Location
class looking up its own altitude, but I'm not sure it's a good idea to also do the lookup inside the pvlib.solarposition
functions. It's okay for the classes to have a little "magic" under the hood if it makes things more convenient, but I think we want more transparency in the functions. I'm also nervous about the (probably small) runtime cost of the lookup, since most people will not be specifying altitude themselves. I lean towards keeping the current static defaults in the pvlib.solarposition.*
functions, but I'm curious what other maintainers think about it.
We'll also need a "what's new" entry, but let's decide where to go with this PR first.
I lean to agree with @kandersolar: leave the default |
Those concerns are valid, and leaving sea level as the default seems reasonable.
loc = Location(latitude, longitude) # altitude == location.lookup_altitude
spa_c(times, latitude, longitude) # altitude == 0
loc = Location(latitude, longitude) # altitude == 0
spa_c(times, latitude, longitude) # altitude == 0
loc = Location(latitude, longitude, altitude="lookup") # altitude == location.lookup_altitude
spa_c(times, latitude, longitude, altitude="lookup") # altitude == location.lookup_altitude
loc = Location(latitude, longitude) # altitude == 0
loc = Location(latitude, longitude, altitude="lookup") # altitude == location.lookup_altitude
spa_c(times, latitude, longitude) # altitude == 0
loc = Location(latitude, longitude, altitude=location.lookup_altitude(latitude, longitude))
spa_c(times, latitude, longitude, altitude=location.lookup_altitude(latitude, longitude)) What do you guys think? |
Closing for now. |
Set altitude automatically from built-in map when not specified. See pvlib#1547
* Adding altitude lookup for location class Set altitude automatically from built-in map when not specified. See #1547 * Readding change removed by accident by patch * Note about fallback to zero when there is no data * Adding description to "what's new" * Update pvlib/location.py Better type definition Co-authored-by: Kevin Anderson <[email protected]> * Fix wording for altitude param * move whatsnew entry to 0.11.0 * docstring tweak * fix 0.10.2 whatsnew file --------- Co-authored-by: Kevin Anderson <[email protected]>
docs/sphinx/source/reference
for API changes.docs/sphinx/source/whatsnew
for 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.In this pull request, I fix the outstanding issues from the last pull request and replace functions to use lookup_altitude by default