Skip to content

Adds k parameter to temperature.ross #2521

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

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

ramaroesilva
Copy link
Contributor

@ramaroesilva ramaroesilva commented Jul 31, 2025

I think the issue is clear enough.

@ramaroesilva
Copy link
Contributor Author

In #2506 @cwhanse mentions that it is difficult to find the 1981 paper from Ross, to which @kandersolar provided a wayback machine url. Should I add it to the documentation of temperature.ross? If so, how?

Copy link
Member

@RDaxini RDaxini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution @ramaroesilva
I added a few suggestions for formatting the docstring and references. Have a look, and if you look under the "files changed" tab you can "add suggestion to batch" and implement more than one suggestion in a single commit

@@ -638,6 +638,9 @@ def ross(poa_global, temp_air, noct):
noct : numeric
Nominal operating cell temperature [C], determined at conditions of
800 W/m^2 irradiance, 20 C ambient air temperature and 1 m/s wind.
k: numeric
Ross coefficient [Km^2/W], which is an alternative to employing
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ross coefficient [Km^2/W], which is an alternative to employing
Ross coefficient [Km²W⁻¹], which is an alternative to employing

Copy link
Member

@cwhanse cwhanse Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last comment for me: We should mark both noct and k as optional. I can't suggest for a line that isn't being modified, but it would be like this:

    noct: numeric, optional
        Nominal operating cell temperature [C], determined at conditions of
        800 W/m^2 irradiance, 20 C ambient air temperature and 1 m/s wind.
        If ``noct`` is not provided, ``k`` is required.

And similar for k

The double ticks "``" format the enclosed string as a parameter.

Comment on lines 658 to 659
where :math:`S` is the plane of array irradiance in :math:`mW/{cm}^2`.
This function expects irradiance in :math:`W/m^2`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let others comment, but I think Wm⁻² looks cleaner than the larger font bolt+italic math type for units. Might be worth saving that for variables(?)
At least if sticking with :math: then I think superscript would be better than a /: `:math:`mW{cm}^{-2}

Suggested change
where :math:`S` is the plane of array irradiance in :math:`mW/{cm}^2`.
This function expects irradiance in :math:`W/m^2`.
where :math:`S` is the plane of array irradiance in mWm⁻².
This function expects irradiance in Wm⁻².

Comment on lines 689 to 690
Energy, vol. 34, no. 1, pp. 23–29, Jan. 2009, doi:
https://doi.org/10.1016/j.renene.2008.04.009.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the sphinx doi role here to hyperlink the doi to the paper automatically

Suggested change
Energy, vol. 34, no. 1, pp. 2329, Jan. 2009, doi:
https://doi.org/10.1016/j.renene.2008.04.009.
Energy, vol. 34, no. 1, pp. 2329, Jan. 2009,
:doi:`10.1016/j.renene.2008.04.009`

Comment on lines 22 to 26
* Rename parameter name ``aparent_azimuth`` to ``solar_azimuth`` in :py:func:`~pvlib.tracking.singleaxis`.
(:issue:`2479`, :pull:`2480`)
* Adds k coefficient in :py:func:`~pvlib.temperature.ross`
(:issue:`2506`, :pull:`2521`)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds --> Add for the whatsnew

Suggested change
* Rename parameter name ``aparent_azimuth`` to ``solar_azimuth`` in :py:func:`~pvlib.tracking.singleaxis`.
(:issue:`2479`, :pull:`2480`)
* Adds k coefficient in :py:func:`~pvlib.temperature.ross`
(:issue:`2506`, :pull:`2521`)
* Rename parameter name ``aparent_azimuth`` to ``solar_azimuth`` in :py:func:`~pvlib.tracking.singleaxis`.
(:issue:`2479`, :pull:`2480`)
* Add k coefficient in :py:func:`~pvlib.temperature.ross`
(:issue:`2506`, :pull:`2521`)


where :math:`S` is the plane of array irradiance in :math:`mW/{cm}^2`.
This function expects irradiance in :math:`W/m^2`.

Reference values for k are provided in [2]_, covering different types
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Reference values for k are provided in [2]_, covering different types
Representative values for k are provided in [2]_, covering different types

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this in latest commit, thanks!

+---------------------+-----------+
| Mounting | :math:`k` |
+=====================+===========+
| well_cooled | 0.02 |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Completely optional: you could replace the underscore with a space, because pvlib isn't providing these values in a dict with e.g. well_cooled as a key value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Followed your suggestion in latest commit, thanks!

# factor of 0.1 converts irradiance from W/m2 to mW/cm2
return temp_air + (noct - 20.) / 80. * poa_global * 0.1
if (noct is None) & (k is None):
raise ValueError("noct or k need to be provided as numeric input.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise ValueError("noct or k need to be provided as numeric input.")
raise ValueError("Either noct or k is required.")

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these new warnings need to be tested?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cwhanse added this in latest commit, thanks!

@RDaxini I did some light testing on my local dev repository (providing one of the two variables and both). Do you need me to do something more specific?

Let me know if you need me to do something more to advance this PR :-)

if (noct is None) & (k is None):
raise ValueError("noct or k need to be provided as numeric input.")
elif (noct is not None) & (k is not None):
raise ValueError("Provide only noct or k, not both.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
raise ValueError("Provide only noct or k, not both.")
raise ValueError("Provide only one of noct or k, not both.")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this in latest commit, thanks!

@cwhanse
Copy link
Member

cwhanse commented Aug 1, 2025

@ramaroesilva if you can fix the merge conflicts in the whatsnew file, we can launch the CI. To fix the conflicts, just keep both sets of lines - this sometimes happens when two PRs are adding lines at the same position.

@ramaroesilva
Copy link
Contributor Author

@ramaroesilva if you can fix the merge conflicts in the whatsnew file, we can launch the CI. To fix the conflicts, just keep both sets of lines - this sometimes happens when two PRs are adding lines at the same position.

@cwhanse merge conflict fixed :-)


expected = expected.values
assert_allclose(expected, result1)
assert_allclose(expected, result2)
Copy link
Member

@cwhanse cwhanse Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a test for the errors, to raise the code coverage.

Suggested change
assert_allclose(expected, result2)
assert_allclose(expected, result2)
def test_noct_sam_errors():
with pytest.raises(ValueError, match='Either noct or k need is required'):
temperature.ross(1000., 30.)
with pytest.raises(ValueError, match='Provide only one of noct or k'):
temperature.ross(1000., 30., noct=45., k=0.02)

@cwhanse
Copy link
Member

cwhanse commented Aug 1, 2025

You can ignore the test failure for py3.9

@@ -638,6 +638,9 @@ def ross(poa_global, temp_air, noct):
noct : numeric
Nominal operating cell temperature [C], determined at conditions of
800 W/m^2 irradiance, 20 C ambient air temperature and 1 m/s wind.
k: numeric
Ross coefficient [Km^2/W], which is an alternative to employing
Copy link
Member

@cwhanse cwhanse Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last comment for me: We should mark both noct and k as optional. I can't suggest for a line that isn't being modified, but it would be like this:

    noct: numeric, optional
        Nominal operating cell temperature [C], determined at conditions of
        800 W/m^2 irradiance, 20 C ambient air temperature and 1 m/s wind.
        If ``noct`` is not provided, ``k`` is required.

And similar for k

The double ticks "``" format the enclosed string as a parameter.

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

Successfully merging this pull request may close these issues.

pvlib.temperature.ross could accept ross parameter as a NOCT alternative
4 participants