use offset parameter instead of calculating bday in cdrom

Open Beginner friendly
#2,902 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@chenyi6758-source is already working on this.

Since Oct 19, 2026.

  • #2911 by @chenyi6758-source — open

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
92/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
data

Research direction

Start at _calculate_simple_day_angle in pvlib/solarposition.py and compare its current calculation with the provided offset=81 example. Replace the explicit birthday adjustment, then run the relevant solar-position tests; completion means the simplified call preserves the existing numerical result.

Written by the indexing model from the issue text.

Description

I believe this line in equation_of_time_pvcdrom:

https://github.com/pvlib/pvlib-python/blob/49530b4dc49bdf401e198ba99218802b2f85df44/pvlib/solarposition.py#L1148

could be replaced by passing 81 to the offset parameter:

>>> from pvlib import solarposition
>>> import numpy as np

>>> solarposition._calculate_simple_day_angle(122, offset=81)
# 0.7057824591626384

>>> solarposition._calculate_simple_day_angle(122) - (2.0 * np.pi / 365.0) * 80.0
# 0.7057824591626387

and ditto in declination_cooper69:

https://github.com/pvlib/pvlib-python/blob/49530b4dc49bdf401e198ba99218802b2f85df44/pvlib/solarposition.py#L1239-L1240

could be replaced by passing -284 to offset parameter

>>> import pvlib as pvl
>>> import numpy as np

>>> pvl.solarposition._calculate_simple_day_angle(180) + (2.0 * np.pi / 365.0) * 285.0
7.987391732962541

>>> pvl.solarposition._calculate_simple_day_angle(180, offset=-284)
7.987391732962542
Dominant language
Python
Stars
1.7k
Forks
1.2k
Avg merge
3d 4h
Merged PRs (30d)
8

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pvlib/pvlib-python

All issues in pvlib/pvlib-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.