feat: 노을 점수 맑은 하늘 구간을 매끄럽게 하고 가시거리·습도·비 갠 뒤로 공기 보정
This commit is contained in:
1 parent
3c8e8984af
commit
0c168d1ffe
6 files changed
+144
-13
No files matched your search
@@ -2,7 +2,9 @@ from datetime import date, datetime, timedelta, timezone
|
||||
|
||||
from common.enums import Confidence, SkyGrade, SkyType
|
||||
from common.utils.geo import destination, haversine_km
|
||||
from services.calc.sky_score import GRADE_LABEL, Layers, best_times, confidence, grade, reason, score, situation, sunset_timeline, verdict
|
||||
from services.calc.sky_score import (
|
||||
GRADE_LABEL, Air, Layers, air_factor, best_times, confidence, grade, reason, score, situation, sunset_timeline, verdict,
|
||||
)
|
||||
from services.calc.sun import sun_times
|
||||
|
||||
CLEAR = Layers(0, 0, 0)
|
||||
@@ -17,6 +19,20 @@ def test_clear_sky_is_only_soft():
|
||||
assert grade(score(CLEAR, CLEAR)) is SkyGrade.SOFT
|
||||
|
||||
|
||||
def test_score_rises_steadily_with_a_few_clouds():
|
||||
scores = [score(Layers(0, c, 0), CLEAR) for c in (0, 5, 9, 10, 15, 20, 30, 50)]
|
||||
assert scores == sorted(scores) and len(set(scores)) == len(scores) # 맑은 날도 구름 몇 %로 갈리고 10%에서 꺾이지 않는다
|
||||
|
||||
|
||||
def test_air_factor_hazy_humid_lowers_and_clearing_rain_raises():
|
||||
assert air_factor(Air()) == 1.0
|
||||
assert air_factor(Air(visibility_km=40, humidity=50)) == 1.0
|
||||
assert air_factor(Air(visibility_km=5)) == 0.6 and air_factor(Air(humidity=90)) == 0.75
|
||||
assert 0.6 < air_factor(Air(visibility_km=30)) < 1.0
|
||||
assert air_factor(Air(rain_before=70, rain_now=10)) == 1.15
|
||||
assert air_factor(Air(rain_before=70, rain_now=60)) == 1.0 # 아직 비 오는 중이면 가산 없음
|
||||
|
||||
|
||||
def test_low_clouds_toward_sun_block_the_light():
|
||||
canvas = Layers(low=0, mid=20, high=50)
|
||||
assert grade(score(canvas, Layers(low=90, mid=50, high=0))) is SkyGrade.GRAY
|
||||
|
||||
Reference in new issue
Block a user