-
Notifications
You must be signed in to change notification settings - Fork 229
Figure.solar: Support terminator datetime with timezone #4112
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
base: main
Are you sure you want to change the base?
Conversation
Summary of changed imagesThis is an auto-generated report of images that have changed on the DVC remote
Image diff(s)Report last updated at commit caba47b |
pygmt/src/solar.py
Outdated
Set the date and time for the terminator calculation. It can be provided as a | ||
string or any datetime-like object recognized by :func:`pandas.to_datetime`. The | ||
time can be specified in UTC or using a UTC offset. The offset must be an | ||
integer number of hours (e.g., -8 or +5); fractional hours (e.g., -8.5 or +5.5) | ||
are cast to integer. [Default is the current UTC date and time]. |
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.
Maybe we can mention that it is the lower integer, e.g. 8.5 -> 8, not 9.
Set the date and time for the terminator calculation. It can be provided as a | |
string or any datetime-like object recognized by :func:`pandas.to_datetime`. The | |
time can be specified in UTC or using a UTC offset. The offset must be an | |
integer number of hours (e.g., -8 or +5); fractional hours (e.g., -8.5 or +5.5) | |
are cast to integer. [Default is the current UTC date and time]. | |
Set the date and time for the terminator calculation. It can be provided as a | |
string or any datetime-like object recognized by :func:`pandas.to_datetime`. The | |
time can be specified in UTC or using a UTC offset. The offset must be an | |
integer number of hours (e.g., -8 or +5); fractional hours (e.g., -8.5 or +5.5) | |
are cast to the lower integer. [Default is the current UTC date and time]. |
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.
I've changed it to "fractional hours (e.g., -8.5 or +5.5) are truncated towards zero (e.g., -8.5 becomes -8 and +5.5 becomes +5)."
The
solar
module can accept datetime with a timezone offset with a syntax like-Td+d2010-01-01T00:00:00+z08:00
, but currentlyFigure.solar
doesn't support it.This PR adds the support for timezone.
Internally, GMT's solar module uses the C
atoi
function to parse the timezone after +z, so "08:00" -> 8, "-05:00"->-5, and fractional offsets are cast to integers, e.g. "08:30"->8, "-05:30"->-5.Preview: https://pygmt-dev--4112.org.readthedocs.build/en/4112/api/generated/pygmt.Figure.solar.html
Address #4110.