Skip to content

Download Taiwan local weather data for advanced analysis and application

Notifications You must be signed in to change notification settings

JackyWeng526/Taiwan_Weather_Data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Taiwan Weather Data Downloader

Download Taiwan local weather data for advanced analysis and application.

Install packages and libraries

Install python libraries with requirements.txt in src folder.

  pip install -r requirements.txt

Weather Station Information

You can reach the information table of CWB stations on CWB e-service.

Or you can also extract the table as following:

  webpage = "https://e-service.cwb.gov.tw/wdps/obs/state.htm"
  read_html = pd.read_html(webpage)
  html_table = read_html[0]
  html_df = html_table.loc[:, ["站號", "站名", "海拔高度(m)", "城市", "經度", "緯度", "地址"]]
  display(html_df)

Get the station number and the station name you need. information table

Read hourly weather data

Take the date-time, station number, altitude, and the station name with the url below.

Then, you will gather the data of 2020-01-01 at Taipei station.

  • The Mandarin characters in the station name must be transcoded twice with urllib.
  • There is some problems with requests library for merging the url, so using F-string here.
  stnum = "466920"
  stname = urllib.parse.quote(urllib.parse.quote("臺北"))
  date = datetime.date(2020, 1, 1)
  altitude = "1017.5m"
  
  html_data = pd.read_html(F"https://e-service.cwb.gov.tw/HistoryDataQuery/DayDataController.do?command=viewMain&station={stnum}&stname={stname}&datepicker={date}&altitude={altitude}")

hourly data

Gather annual data

Use a for-loop to download the rest data of 2020. annual data

Check the weather data with a chain chart. chain chart

Now, you have the hourly data of 2020 at Taipei for analysis and advanced application to other fields.

WebAPI Service Test

This repository is recently packaged as a WebAPI for a test.

You can try the WebAPI here: @Taiwan Weather Downloader API

If there are any questions/problems with using the API, please don't hesitate to contact me.

Author

@Jacky Weng

Reference

CWB Observation Data Inquire System.

About

Download Taiwan local weather data for advanced analysis and application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages