Added circular average logic to wind direction, and removed condition code from the current conditions endpoint
Some checks failed
ci/woodpecker/push/build-image Pipeline failed
Some checks failed
ci/woodpecker/push/build-image Pipeline failed
This commit is contained in:
@@ -22,7 +22,20 @@ SELECT
|
||||
AVG(dewpoint_c) AS dewpoint_c,
|
||||
AVG(relative_humidity_percent) AS relative_humidity_percent,
|
||||
AVG(wind_speed_kmh) AS wind_speed_kmh,
|
||||
AVG(wind_direction_degrees) AS wind_direction_degrees,
|
||||
CASE
|
||||
WHEN atan2d(
|
||||
avg(sind(wind_direction_degrees)),
|
||||
avg(cosd(wind_direction_degrees))
|
||||
) < 0
|
||||
THEN atan2d(
|
||||
avg(sind(wind_direction_degrees)),
|
||||
avg(cosd(wind_direction_degrees))
|
||||
) + 360.0
|
||||
ELSE atan2d(
|
||||
avg(sind(wind_direction_degrees)),
|
||||
avg(cosd(wind_direction_degrees))
|
||||
)
|
||||
END AS wind_direction_degrees,
|
||||
MAX(condition_code) AS condition_code,
|
||||
(
|
||||
SELECT is_day
|
||||
|
||||
@@ -56,7 +56,6 @@ func (s *Service) GetCurrent(ctx context.Context, unitSystem string) (Response,
|
||||
resp := Response{
|
||||
RelativeHumidity: summary.RelativeHumidity,
|
||||
WindDirectionDegrees: summary.WindDirectionDegrees,
|
||||
ConditionCode: summary.ConditionCode,
|
||||
IsDay: summary.IsDay,
|
||||
}
|
||||
if summary.ConditionCode != nil {
|
||||
|
||||
Reference in New Issue
Block a user