Skip to content
/ go-cwb Public

Taiwan Central Weather Administration Open Data API library for Go (台灣中央氣象署放資料平臺)

License

Notifications You must be signed in to change notification settings

minchao/go-cwb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-cwb

Tests Go Report Card codecov

An unofficial Taiwan Central Weather Bureau RESTful API library for Go.

This package is inspired by go-github.

Installation

go get github.com/minchao/go-cwb

Usage

import "github.com/minchao/go-cwb/cwb"

You will need an account on opendata.cwa.gov.tw to get an API key.

Construct a new CWB client, then use to access the CWB API. For example:

client := cwb.NewClient("APIKEY", nil)

Get the 36 hour weather forecasts:

forecast, _, err := client.Forecasts.Get36HourWeather(context.Background(), nil, nil)
if err != nil {
    fmt.Println(err)
}

Get the 2 day townships weather forecasts by specific country:

forecast, _, err := client.Forecasts.GetTownshipsWeatherByDataId(context.Background(), cwb.FTW2DayTaipeiCity, nil, nil)

Get the 7 day township weather forecasts by specific locations and elements:

forecast, _, err := client.Forecasts.GetTownshipsWeatherByDataId(context.Background(),
    cwb.FTW7DayChiayiCity,
    []string{"阿里山鄉"},
    []string{"MinT", "MaxT", "WeatherDescription"})

Implemented APIs

  • 一般天氣預報 - 今明 36 小時天氣預報 (F-C0032-001)
  • 鄉鎮天氣預報 - 單一鄉鎮市區預報資料 (F-D0047-001 - F-D0047-091)
  • 鄉鎮天氣預報 - 全臺灣各鄉鎮市區預報資料 (F-D0047-093)
  • 自動氣象站 - 氣象觀測資料 (O-A0001-001)
  • 自動雨量站 - 雨量觀測資料 (O-A0002-001)
  • 潮汐預報 - 未來 1 個月潮汐預報(F-A0021-001)

CWB Open data API documentation

License

See the LICENSE file for license rights and limitations (MIT).

About

Taiwan Central Weather Administration Open Data API library for Go (台灣中央氣象署放資料平臺)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published