An unofficial Taiwan Central Weather Bureau RESTful API library for Go.
This package is inspired by go-github.
go get github.com/minchao/go-cwb
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"})
- 一般天氣預報 - 今明 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
See the LICENSE file for license rights and limitations (MIT).