Skip to content

Consider updating pvlib.tracking.singleaxis() to return zeros (or similar) for nighttime instead of NaNs #2539

@williamhobbs

Description

@williamhobbs

Is your feature request related to a problem? Please describe.
pvlib.tracking.singleaxis returns NaNs for intervals where the sun is below the horizon. This can result in NaNs propogating to lots of other pvlib outputs and can cause confusion, other issues, etc. See https://groups.google.com/g/pvlib-python/c/ZeVmTC7eddY as an example.

It appears to happen here:

omega_ideal[zen_gt_90] = np.nan

Describe the solution you'd like
Perhaps change the default to be zero for surface_tilt and tracker_theta (and whatever is most appropriate for aoi and surface_azimuth). Or have an optional input for pvlib.tracking.singleaxis to specify whether it returns NaNs or numbers at night.

Describe alternatives you've considered
Applying .fillna(0) (or similar) to the output of pvlib.tracking.singleaxis is what I typically do.

Additional context
It looks like this zero vs nan situation was briefly discussed in #569. It seems it would be worth further discussion. Is there a significant reason that NaN is the output at night?

fillna(0) is used in the gallery here and here, but not here.

Tagging @cwhanse.

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