-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Create plot_ghi_transposition.py example #933
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
Conversation
Hey @ericf900, cool example! This PR's version of the docs are built here, so you can check out how your example looks when it's live (the build takes a few minutes after you push an update): https://pvlib-python--933.org.readthedocs.build/en/933/ A couple notes:
|
Also can you merge upstream/master into your branch? Some fixes were recently made to clean up the documentation build log and it would make reviewing this a little easier. |
…vlib-python into Transposition-example
@kanderso-nrel Thanks for the suggestions! I made those updates and updated the 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.
Here are some suggestions. The :py:meth:...
stuff will auto-link the functions to their documentation entries (see here for an example of what it looks like). Otherwise looks good to me!
|
||
# For this example, we will be using Golden, Colorado | ||
tz = 'MST' | ||
lat, lon = 39.755, -105.221 |
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.
very nice choice of location, +1
dni=clearsky_ghi['dni'], | ||
ghi=clearsky_ghi['ghi'], | ||
dhi=clearsky_ghi['dhi'], | ||
solar_zenith=solar_position['zenith'], |
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.
solar_zenith=solar_position['zenith'], | |
solar_zenith=solar_position['apparent_zenith'], |
FYI I'd like someone else to confirm that using apparent solar position is appropriate before making this change
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.
According to the parameters for each transposition model option in get_total_irradiance
, apparent_zenith
should be passed through, rather than zenith
.
It's a different matter to verify that each model actually expects apparent_zenith
rather than zenith
. I'll look at the underlying references when I can find the opportunity.
Co-Authored-By: Kevin Anderson <[email protected]>
Co-Authored-By: Kevin Anderson <[email protected]>
Co-Authored-By: Kevin Anderson <[email protected]>
Co-Authored-By: Kevin Anderson <[email protected]>
Co-Authored-By: Kevin Anderson <[email protected]>
…vlib-python into Transposition-example
winter_irradiance = get_irradiance(site, '12-21-2020', 25, 180) | ||
|
||
# Plot GHI vs. POA for winter and summer | ||
fig, (ax1, ax2) = plt.subplots(1, 2) |
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.
This example is really great! Thanks!
I have a minor suggestion, can you vertically stack the plots and share the x-axis?
fig, ax = plt.subplots(2, 1, sharex=True) # stack plots (2, 1) and share the x axis
ax1, ax2 = ax # or you can just use ax[0] instead of ax1, and ax[1] instead ax2, minor preference
I'm having a hard time reading the dates on the x-axis because they're a bit crowded, so I thought trying them vertical and sharing them might look nicer, but your call - but not a blocker for me - also fine as is, THANKS!
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.
Unfortunately the indexes are 6 months apart so I don't think sharex=True
will look good. Could convert the datetime index to a nicer string form with df.index.strftime("%H:%M")
. Or could drop sharex=True
, but then the x-label for the upper axes might overlap the bottom axes.
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.
Hi Mike and Kevin! I am looking at this now- I agree the x-axis is a bit cluttered. I think the benefit of keeping the plots side-by-side is that it highlights that, while there is not much of a gain for POA compared to GHI in the summer, overall irradiance is higher.
I'll make some edits now and push up the new version!
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.
You're both right! Sorry for the distraction! Great work
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 @ericf900
plt.show() | ||
|
||
# %% | ||
# Note that in Summer, there is not much gain when comparing POA irradiance to |
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.
+1 for this note, answers a question often asked by newcomers to PV modeling
dni=clearsky_ghi['dni'], | ||
ghi=clearsky_ghi['ghi'], | ||
dhi=clearsky_ghi['dhi'], | ||
solar_zenith=solar_position['zenith'], |
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.
According to the parameters for each transposition model option in get_total_irradiance
, apparent_zenith
should be passed through, rather than zenith
.
It's a different matter to verify that each model actually expects apparent_zenith
rather than zenith
. I'll look at the underlying references when I can find the opportunity.
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.
Eric, this is a really great contribution! Thanks so much. I really like the comments, super thorough and easy to read. Very good explanation of the process of generating clear-sky and transposing to POA. Awesome!
winter_irradiance['POA'].plot(ax=ax2, label='POA') | ||
ax1.set_xlabel('Time of day (Summer)') | ||
ax2.set_xlabel('Time of day (Winter)') | ||
ax1.set_ylabel('Irradiance (W/m2)') |
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.
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 for the feedback Mike! Made these changes and am uploading a new version now :)
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.
Example showing transposition from GHi to POA, and comparing winter transposition gain to summer.