Skip to content

DOC: dead code and wrong parameter in _liujordan function description #2764

Closed

Description

@JoLo90

The current _liujordan function description mentions pressure but uses air mass. This internal function isn't used; maybe the intended use was to make it public like the other function in the irradiance.py

def _liujordan(zenith, transmittance, airmass, dni_extra=1367.0):
'''
Determine DNI, DHI, GHI from extraterrestrial flux, transmittance,
and optical air mass number.
Liu and Jordan, 1960, developed a simplified direct radiation model.
DHI is from an empirical equation for diffuse radiation from Liu and
Jordan, 1960.
Parameters
----------
zenith: pd.Series
True (not refraction-corrected) zenith angles in decimal
degrees. If Z is a vector it must be of the same size as all
other vector inputs. [°]
transmittance: float
Atmospheric transmittance between 0 and 1.
pressure: float, default 101325.0
Air pressure
dni_extra: float, default 1367.0
Direct irradiance incident at the top of the atmosphere.
Returns
-------
irradiance: DataFrame
Modeled direct normal irradiance, direct horizontal irradiance,
and global horizontal irradiance in Wm⁻²
References
----------
.. [1] Campbell, G. S., J. M. Norman (1998) An Introduction to
Environmental Biophysics. 2nd Ed. New York: Springer.
.. [2] Liu, B. Y., R. C. Jordan, (1960). "The interrelationship and
characteristic distribution of direct, diffuse, and total solar
radiation". Solar Energy 4:1-19
'''
tau = transmittance
dni = dni_extra*tau**airmass
dhi = 0.3 * (1.0 - tau**airmass) * dni_extra * np.cos(np.radians(zenith))
ghi = dhi + dni * np.cos(np.radians(zenith))
irrads = OrderedDict()
irrads['ghi'] = ghi
irrads['dni'] = dni
irrads['dhi'] = dhi
if isinstance(ghi, pd.Series):
irrads = pd.DataFrame(irrads)
return irrads

Activity

  1. echedey-ls commented on May 29, 2026

    @echedey-ls
    Member

    It's better to link to code here in GitHub instead of copy-pasting it.

    Here is a permalink to it:

    def _liujordan(zenith, transmittance, airmass, dni_extra=1367.0):
    '''
    Determine DNI, DHI, GHI from extraterrestrial flux, transmittance,
    and optical air mass number.
    Liu and Jordan, 1960, developed a simplified direct radiation model.
    DHI is from an empirical equation for diffuse radiation from Liu and
    Jordan, 1960.
    Parameters
    ----------
    zenith: pd.Series
    True (not refraction-corrected) zenith angles in decimal
    degrees. If Z is a vector it must be of the same size as all
    other vector inputs. [°]
    transmittance: float
    Atmospheric transmittance between 0 and 1.
    pressure: float, default 101325.0
    Air pressure
    dni_extra: float, default 1367.0
    Direct irradiance incident at the top of the atmosphere.
    Returns
    -------
    irradiance: DataFrame
    Modeled direct normal irradiance, direct horizontal irradiance,
    and global horizontal irradiance in Wm⁻²
    References
    ----------
    .. [1] Campbell, G. S., J. M. Norman (1998) An Introduction to
    Environmental Biophysics. 2nd Ed. New York: Springer.
    .. [2] Liu, B. Y., R. C. Jordan, (1960). "The interrelationship and
    characteristic distribution of direct, diffuse, and total solar
    radiation". Solar Energy 4:1-19
    '''
    tau = transmittance
    dni = dni_extra*tau**airmass
    dhi = 0.3 * (1.0 - tau**airmass) * dni_extra * np.cos(np.radians(zenith))
    ghi = dhi + dni * np.cos(np.radians(zenith))
    irrads = OrderedDict()
    irrads['ghi'] = ghi
    irrads['dni'] = dni
    irrads['dhi'] = dhi
    if isinstance(ghi, pd.Series):
    irrads = pd.DataFrame(irrads)
    return irrads

    It seems it was deprecated in v0.8.1 and claimed to be removed in v0.9.0:

    It was forgotten to be removed in #1136 - exactly at this commit in the pull request: c1ad827 (#1136)

    Feel free to open a PR. I don't have a strong opinion, but I suggest to remove it in v0.16.0. NB it has existed without a deprecation warning for quite some time.

  2. added
    deprecation
    on May 29, 2026
  3. added this to the v0.16.0 milestone on May 29, 2026
  4. kandersolar commented on Jun 10, 2026

    @kandersolar
    Member

    No need to deprecate private functions, and no need to wait for a .0 release to delete them, either.

    I suggest skipping the deprecation and going straight to deletion for _liujordan. It can happen in the next release, or 0.16.0.

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

    apideprecation

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions