-
Notifications
You must be signed in to change notification settings - Fork 368
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
Adding a nightshade/terminator feature #1135
Conversation
1575dbe
to
bb3f5d4
Compare
c68e3d8
to
4304a6b
Compare
lib/cartopy/mpl/solar.py
Outdated
0.019994643*np.sin(2*M_sun*deg2rad)) | ||
|
||
# obliquity of the ecliptic (epsilon in Vallado's notation) | ||
epsilon = 23.439291 - 0.0130042*T_UT1 |
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.
Use np.deg2rad
here so you don't need to convert units twice below.
4304a6b
to
e07c1fc
Compare
@QuLogic, thanks for the excellent review. I didn't know a lot of the test features and other standards you pointed out, so I learned something too! I've amended the commit with all of the changes, other than the deg/rad which I replied to above in my thinking. |
Thanks @greglucas! |
For the record, I followed this up in #1181 in order to reduce the impact on the GeoAxes namespace, and to keep a clean separation between cartopy functionality and cartopy's matplotlib interface. An example of how to use the nightshade Feature is in that PR, and has been added to the gallery. |
Rationale
Adding a nightshade() feature, with refraction to visualize the day/night terminator. This has been requested several times, and I've followed the Aurora example myself numerous times. I blended the Aurora example and old basemap features together for this. I have also implemented refraction/extra daylight hours to be a little more precise.
It addresses the following previous issues: #1038, fixes #1128, follows on from #737.
Implications
I've implemented a solar.py file similar to the one from mpl/basemap to calculate the sun's position in latitude longitude coordinates.
.nightshade() is callable from any geoaxes, let me know if somewhere else would be preferable.