Skip to content

New default solar position algorithm #2455

Open

Description

@kurt-rhee

Is your feature request related to a problem? Please describe.

[Solar Position Documentation](https://pvlib-python.readthedocs.io/en/stable/reference/solarposition.html
https://pvlib-python.readthedocs.io/en/stable/reference/generated/) recommends using the default solar position algorithm. Should we update to a faster algorithm given @AdamRJensen's poster at this year's PVPMC which shows that most algorithms have minimal impact on energy regardless of run-time?

With permission I can edit this comment and add a photo of the poster.

Describe the solution you'd like
A fast implementation of the SG2, USNO or NOAA solar position algorithms set as the default model for the get_solarposition wrapper.

Describe alternatives you've considered
We could leave the default as nrel_numpy

Additional context

  • Increased run-time speed of pvlib reduces carbon output of running models (no matter how small or large that might be)
  • I am happy to re-implement one of the above models in Rust with python bindings and open source the rust backend. I know that this comment will open up a can of worms. I think one way to go about this is to implement the model twice, once in python as a reference for the community and once in rust/julia/c++ etc. for use in practice. Users would be able to select which model to use at their prerogative.

Activity

  1. williamhobbs commented on May 17, 2025

    @williamhobbs
    Contributor

    I like the idea. A picture of the poster (with permission) would definitely be nice.

  2. mikofski commented on May 17, 2025

    @mikofski
    Member

    Solpos is a great algorithm as fast as usno but as accurate as spa and it already has a c implementation. Try pip install solarutils or see https://sunpower.github.io/SolarUtils/

  3. kurt-rhee commented on May 17, 2025

    @kurt-rhee
    ContributorAuthor

    @mikofski that is awesome, would it be feasible to add the algorithm to pvlib to make it easier for newcomers to use? I wouldn't mind doing the work.

  4. mikofski commented on May 17, 2025

    @mikofski
    Member
  5. adriesse commented on May 18, 2025

    @adriesse
    Member

    Are there issues here?

    1. Changing the default algorithm
    2. Adding another algorithm

    I admit SPA sometimes takes longer than I would like, but I can cache the results if needed. Consistency is most important to me.

    Here's a slide from software comparisons I did (what!? it's already) 6 years ago.

    Image

  6. kandersolar commented on May 18, 2025

    @kandersolar
    Member

    Should we update to a faster algorithm given @AdamRJensen's poster at this year's PVPMC which shows that most algorithms have minimal impact on energy regardless of run-time?

    A paper is in the works with more detail on this topic. Note that we already have a faster alternative to SPA (pvlib.solarposition.ephemeris), but quoting #2323 (comment):

    A bit of context: @AdamRJensen, @IoannisSifnaios, and I have a project underway comparing solar position algorithms. We plan to contribute implementations of one or more algorithms to pvlib-python, depending on the results of the comparison. We expect some of them to be better than ephemeris in all respects (speed, accuracy, period of validity, clear reference).

    #2152 and #2167 are candidates, but those PRs are on hold for now while we work towards clear recommendations for choice of algorithm.

    Solpos is a great algorithm as fast as usno but as accurate as spa

    I do not think this is true, unless "accurate as spa" means "produces practically equivalent solar energy simulations", which is also the case for half a dozen other algorithms :)

  7. kurt-rhee commented on May 19, 2025

    @kurt-rhee
    ContributorAuthor

    Nice! @kandersolar can do this way better so I'll leave this up, but I won't do any work on the topic.

  8. adriesse commented on May 21, 2025

    @adriesse
    Member

    A paper is in the works with more detail on this topic. Note that we already have a faster alternative to SPA

    Looking forward to both of these! The poster made some claims but lacked justification. :(

  9. adriesse commented on Apr 3, 2026

    @adriesse
    Member

    Just wondering, is the paper out yet?

  10. kandersolar commented on Apr 8, 2026

    @kandersolar
    Member

    Alas, not even submitted yet. It's on the backburner. Hopefully we will return to it sometime this year.

    A paper is in the works with more detail on this topic. Note that we already have a faster alternative to SPA

    Looking forward to both of these!

    One clarification: by "we already have a faster alternative to SPA", I meant that pvlib already has one, not that a new one has been developed.

  11. adriesse commented on Apr 9, 2026

    @adriesse
    Member

    Alas, not even submitted yet. It's on the backburner. Hopefully we will return to it sometime this year.

    A paper is in the works with more detail on this topic. Note that we already have a faster alternative to SPA

    Looking forward to both of these!

    One clarification: by "we already have a faster alternative to SPA", I meant that pvlib already has one, not that a new one has been developed.

    Ah, that's a significant clarification. I had the impression a something new was in the works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions