Skip to content

SunriseSunsetCalculator.getSunrise/getSunset use wrong sign for degrees parameter #50

@guillerodriguez

Description

@guillerodriguez

SunriseSunsetCalculator.getSunrise(...) accepts a degrees parameter which is documented as the "angle under the horizon for which to compute sunrise. For example, 'civil sunrise' corresponds to 6 degrees".

X degrees below the horizon corresponds to a solar zenith angle of 90 + X. But the implementation actually uses the opposite sign, and constructs new Zenith(90 - degrees), which is the zenith for the sun being degrees above the horizon, not below. So a caller asking for e.g. civil sunrise by passing degrees=6 would actually get the time at which the sun reaches 6° above the horizon.

Same problem is also present in SunriseSunsetCalculator.getSunset().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions