malgleam/weather
단기예보·중기예보 공용 기상 응답 타입. 하늘상태, 강수형태, 풍향 등을 패턴 매칭 가능한 variant로 제공한다.
Types
예보 파일 타입.
pub type ForecastType {
UltraShortObservation
UltraShortForecast
ShortForecast
}
Constructors
-
UltraShortObservationODAM — 초단기실황
-
UltraShortForecastVSRT — 초단기예보
-
ShortForecastSHRT — 단기예보
중기예보의 날씨 상태 (11개 variant).
pub type MidWeather {
MidClear
MidMostlyCloudy
MidMostlyCloudyWithRain
MidMostlyCloudyWithSnow
MidMostlyCloudyWithRainSnow
MidMostlyCloudyWithShower
MidOvercast
MidOvercastWithRain
MidOvercastWithSnow
MidOvercastWithRainSnow
MidOvercastWithShower
}
Constructors
-
MidClear맑음
-
MidMostlyCloudy구름많음
-
MidMostlyCloudyWithRain구름많고 비
-
MidMostlyCloudyWithSnow구름많고 눈
-
MidMostlyCloudyWithRainSnow구름많고 비/눈
-
MidMostlyCloudyWithShower구름많고 소나기
-
MidOvercast흐림
-
MidOvercastWithRain흐리고 비
-
MidOvercastWithSnow흐리고 눈
-
MidOvercastWithRainSnow흐리고 비/눈
-
MidOvercastWithShower흐리고 소나기
강수형태 코드. 단기: 0(없음), 1(비), 2(비/눈), 3(눈), 4(소나기) 초단기: 0~3 + 5(빗방울), 6(빗방울눈날림), 7(눈날림)
pub type PrecipitationType {
NoPrecipitation
Rain
RainAndSnow
Snow
Shower
Drizzle
DrizzleAndSnowDrift
SnowDrift
}
Constructors
-
NoPrecipitation -
Rain -
RainAndSnow -
Snow -
Shower -
Drizzle -
DrizzleAndSnowDrift -
SnowDrift
하늘상태 코드 (1: 맑음, 3: 구름많음, 4: 흐림).
pub type Sky {
Clear
MostlyCloudy
Overcast
}
Constructors
-
Clear -
MostlyCloudy -
Overcast
16방위 풍향.
pub type WindDirection {
N
NNE
NE
ENE
E
ESE
SE
SSE
S
SSW
SW
WSW
W
WNW
NW
NNW
}
Constructors
-
N -
NNE -
NE -
ENE -
E -
ESE -
SE -
SSE -
S -
SSW -
SW -
WSW -
W -
WNW -
NW -
NNW
Values
pub fn forecast_type_to_string(ft: ForecastType) -> String
ForecastType을 API 요청용 문자열로 변환한다.
pub fn parse_forecast_type(
value: String,
) -> Result(ForecastType, Nil)
예보 타입 문자열(“ODAM”,“VSRT”,“SHRT”)을 파싱한다.
pub fn parse_mid_weather(text: String) -> Result(MidWeather, Nil)
중기예보 날씨 한국어 문자열을 파싱한다.
pub fn parse_precipitation_type(
value: String,
) -> Result(PrecipitationType, Nil)
강수형태 코드 문자열(“0”~“7”)을 파싱한다.
pub fn wind_direction_from_degrees(
degrees: Float,
) -> WindDirection
풍향 각도(도)를 16방위로 변환한다. 공식: floor((degrees + 22.5 * 0.5) / 22.5) → 0~16 인덱스