Skip to content
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 tests for time conversions in tools package #2340

Open
markcampanelli opened this issue Dec 23, 2024 · 1 comment · May be fixed by #2341
Open

Add tests for time conversions in tools package #2340

markcampanelli opened this issue Dec 23, 2024 · 1 comment · May be fixed by #2341
Labels
Milestone

Comments

@markcampanelli
Copy link
Contributor

markcampanelli commented Dec 23, 2024

Is your feature request related to a problem? Please describe.
I am looking into replacing pytz with the standard library's zoneinfo, and I found three untested functions that use pytz:

  • pvlib.tools.localize_to_utc
  • pvlib.tools.datetime_to_djd
  • pvlib.tools.djd_to_datetime

Describe the solution you'd like
Add tests for these three functions before attempting to replace pytz in a refactor.

Describe alternatives you've considered
Adding tests should be a welcome endeavor, no matter if pytz is replaced or not.

Additional context
None.

UPDATE: #2341 that addresses this issue moves to the Python 3.9+ standard library's zoneinfo.ZoneInfo as the single source of truth that represents a timezone internally in Location objects. Also, the interface to this object was made consistent between the Location intializer and updating the tz string attribute after object initialization (and tz is now always a string, as previous advertised). However, Location objects still all existing types for initializing tz, as well as still exposing a pytz representation of the Location's timezone as the read-only pytz attribute.

@markcampanelli markcampanelli linked a pull request Dec 23, 2024 that will close this issue
8 tasks
@kandersolar kandersolar added this to the v0.11.3 milestone Dec 23, 2024
@markcampanelli
Copy link
Contributor Author

This ended up revealing some bugs in the Location objects time-zone implementation, which were also addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants