<commit_before>
-- Author: <NAME> (zwim)
-- Date: 2021-10-29
-- The current source code of this file can be found on https://github.com/zwim/suntime.

--[[--
Module to calculate ephemeris and other times depending on the sun position.

Maximal errors from 2020-2050 (compared to https://midcdmz.nrel.gov/spa/) are:

* -43.52° Christchurch 66s
* -20.16° Mauritius:   25s
* 20.30° Honolulu:     47s
* 33.58° Casablanca:   24s
* 35.68° Tokio:        50s
* 37.97° Athene:       24s
* 38°    Sacramento:   67s
* 41.91° Rome:         27s
* 47.25° Innsbruck:    13s
* 52.32° Berlin:       30s
* 59.92° Oslo:         42s
* 64.14° Reykjavik:    66s
* 65.69° Akureyri:    <24s (except *)
* 70.67° Hammerfest: <105s (except **)

*) A few days around beginning of summer (error <290s)

**) A few days after and befor midnight sun (error <1200s)

@usage
    local SunTime = require("suntime")

    time_zone = 0
    altitude = 50
    degree = true
    SunTime:setPosition("Reykjavik", 64.14381, -21.92626, timezone, altitude, degree)

    SunTime:setAdvanced()

    SunTime:setDate()

    SunTime:calculateTimes()

    print(SunTime.rise, SunTime.set, SunTime.set_civil) -- or similar see calculateTime()

@module suntime
--]]--

-- math abbrevations
local pi = math.pi
local pi_2 = pi/2

local abs = math.abs
local floor = math.floor
local sin = math.sin
local cos = math.cos
local tan = math.tan
local asin = math.asin
local acos = math.acos
local atan = math.atan

local toRad = pi/180
local toDeg = 1/toRad

local function Rad(x)
    return x*toRad
end

--------------------------------------------
local speed_of_light = 2.99792E8
local sun_radius = 6.96342e8
local average_earth_radius = 6371e3
local semimajor_axis = 149598022.96E3 -- earth orbit's major semi-axis in meter
local average_speed_earth = 29.7859e3
local aberration = asin(average_speed_earth/speed_of_light) -- Aberration relativistic
local average_speed_equator = (2*pi * average_earth_radius) / (24*3600)
--------------------------------------------

 -- minimal twillight times in hours
local min_civil_twilight = 20/60
local min_nautic_twilight = 45/60 - min_civil_twilight
local min_astronomic_twilight = 20/60 - min_nautic_twilight

local SunTime = {
        astronomic = Rad(-18),
        nautic =  Rad(-12),
        civil = Rad(-6),
        -- eod = Rad(-49/60), -- approx. end of day
        earth_flatten = 1 / 298.257223563, -- WGS84
        average_temperature = 10, -- °C

        times = {},
    }
<commit_msg>Fix unused variable (#8518)<commit_after>
-- Author: <NAME> (zwim)
-- Date: 2021-10-29
-- The current source code of this file can be found on https://github.com/zwim/suntime.

--[[--
Module to calculate ephemeris and other times depending on the sun position.

Maximal errors from 2020-2050 (compared to https://midcdmz.nrel.gov/spa/) are:

* -43.52° Christchurch 66s
* -20.16° Mauritius:   25s
* 20.30° Honolulu:     47s
* 33.58° Casablanca:   24s
* 35.68° Tokio:        50s
* 37.97° Athene:       24s
* 38°    Sacramento:   67s
* 41.91° Rome:         27s
* 47.25° Innsbruck:    13s
* 52.32° Berlin:       30s
* 59.92° Oslo:         42s
* 64.14° Reykjavik:    66s
* 65.69° Akureyri:    <24s (except *)
* 70.67° Hammerfest: <105s (except **)

*) A few days around beginning of summer (error <290s)

**) A few days after and befor midnight sun (error <1200s)

@usage
    local SunTime = require("suntime")

    time_zone = 0
    altitude = 50
    degree = true
    SunTime:setPosition("Reykjavik", 64.14381, -21.92626, timezone, altitude, degree)

    SunTime:setAdvanced()

    SunTime:setDate()

    SunTime:calculateTimes()

    print(SunTime.rise, SunTime.set, SunTime.set_civil) -- or similar see calculateTime()

@module suntime
--]]--

-- math abbrevations
local pi = math.pi
local pi_2 = pi/2

local abs = math.abs
local floor = math.floor
local sin = math.sin
local cos = math.cos
local tan = math.tan
local asin = math.asin
local acos = math.acos
local atan = math.atan

local toRad = pi/180
local toDeg = 1/toRad

local function Rad(x)
    return x*toRad
end

--------------------------------------------
local speed_of_light = 2.99792E8
local sun_radius = 6.96342e8
local average_earth_radius = 6371e3
local semimajor_axis = 149598022.96E3 -- earth orbit's major semi-axis in meter
local average_speed_earth = 29.7859e3
local aberration = asin(average_speed_earth/speed_of_light) -- Aberration relativistic
--local average_speed_equator = (2*pi * average_earth_radius) / (24*3600)
--------------------------------------------

 -- minimal twillight times in hours
local min_civil_twilight = 20/60
local min_nautic_twilight = 45/60 - min_civil_twilight
local min_astronomic_twilight = 20/60 - min_nautic_twilight

local SunTime = {
        astronomic = Rad(-18),
        nautic =  Rad(-12),
        civil = Rad(-6),
        -- eod = Rad(-49/60), -- approx. end of day
        earth_flatten = 1 / 298.257223563, -- WGS84
        average_temperature = 10, -- °C

        times = {},
    }

{'fraction_non_alphanumeric': 0.14799196787148594, 'fraction_numerical': 0.0859437751004016, 'mean_word_length': 2.614658925979681, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1069078', 'n_tokens_mistral': 2079, 'n_tokens_neox': 1732, 'n_words': 487}