Skip to main content

1 HistoricalWeatherTW 台灣歷史天氣爬蟲

This script is to crawl the information of 觀測資料查詢 website

Data from 觀測資料查詢系統

2 Usage

  1. Prepare station.csv.

  2. run the function of collect_weather_tw you will see the result!

    def collect_weather_tw(station_csv_path: Path, output_path,
                           end_date: datetime.date, begin_date: datetime.date,
                           query_format,
                           convert2num):

You can refer to __init__.py for more help

  1. Prepare config.yaml and use this path as input parameter

  2. run __init__.py

2.1 QUICKLY START

from Carson.Tool.HistoricalWeatherTW import collect_weather_tw, QueryFormat
from pathlib import Path
import datetime
import os

if __name__ == '__main__':
    STATION_CSV = '../config/CSV/station_test.csv'
    OUTPUT_PATH = Path(f'../temp/year_result.csv')
    BEGIN_DATE = datetime.date(2019, 10, 1)
    END_DATE = datetime.date(2019, 10, 2)
    QUERY_FORMAT = QueryFormat.DAY
    CONVERT2NUM = True
    collect_weather_tw(Path(STATION_CSV), OUTPUT_PATH,
                       BEGIN_DATE, END_DATE,
                       QUERY_FORMAT,
                       CONVERT2NUM)
    os.startfile(OUTPUT_PATH)

3 Data

資料會以觀測站ID+站名儲存

3.1 資料欄位如下

ObsTime 觀測時間(LST)

StnPres 測站氣壓(hPa)

SeaPres 海平面氣壓(hPa)

Temperature 氣溫(℃)

Tddewpoint 露點溫度(℃)

RH 相對溼度(%)

WS 風速(m/s)

WD 風向(360degree)

WSGust 最大陣風(m/s)

WDGust 最大陣風風向(360degree)

Precp 降水量(mm)

PrecpHour 降水時數(hr)

SunShine 日照時數(hr)

GloblRad 全天空日射量(MJ/㎡)

Visb 能見度(km)

4 Release note

4.1 v4.0

Encapsulated as API

4.2 v3.0

Features:

  • All outputs into a single file. (making it easier to use for SQL)

  • The output header field will automatically grab the content on the web page (not use hard coding)

  • You can choose the type of query (year, month, day) according to your needs.

Other:

  • Make the code easier to read.

4.3 V2.0

加入全台觀測站

4.4 V1.0

第一版

Metadata

Release files for carson-tool.HistoricalWeatherTW 4.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for carson-tool.HistoricalWeatherTW 4.1.0
File Size Uploaded
carson-tool.HistoricalWeatherTW-4.1.0.tar.gz 6.8 kB Details

Release files / carson-tool.HistoricalWeatherTW-4.1.0.tar.gz

Download URL carson-tool.HistoricalWeatherTW-4.1.0.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
014a9591196ee7481a9958812742d4a01bc74ddb91fe00ced2b356263e07e536
BLAKE2b-256 checksum
How to use checksums
e24dfa7433a8cb20840f67fc068d968fffa4406c43a93af47a1b8fa06c2c7d34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Python-urllib/3.7

Release history Release notifications | RSS feed

This release

4.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page