malgleam/weather

단기예보·중기예보 공용 기상 응답 타입. 하늘상태, 강수형태, 풍향 등을 패턴 매칭 가능한 variant로 제공한다.

Types

예보 파일 타입.

pub type ForecastType {
  UltraShortObservation
  UltraShortForecast
  ShortForecast
}

Constructors

  • UltraShortObservation

    ODAM — 초단기실황

  • UltraShortForecast

    VSRT — 초단기예보

  • ShortForecast

    SHRT — 단기예보

중기예보의 날씨 상태 (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 parse_sky(value: String) -> Result(Sky, Nil)

하늘상태 코드 문자열(“1”,“3”,“4”)을 파싱한다.

pub fn wind_direction_from_degrees(
  degrees: Float,
) -> WindDirection

풍향 각도(도)를 16방위로 변환한다. 공식: floor((degrees + 22.5 * 0.5) / 22.5) → 0~16 인덱스

Search Document