一応任意のアメダス観測所の計測データを取得できるようにしてみました。あまり使う予定はありませんが。
misohena/el-jma: Emacs Interface for Japan Meteorological Agency Data
使い方。
まずはアメダスの観測所番号を調べます。 jma-amedas-read-amedas-code
関数で補完付きの入力ができるようになっているのでそれを使います。
(require 'jma-amedas) (jma-amedas-read-amedas-code)
番号が分かったら jma-amedas-point-latest
に渡すだけです。
(jma-amedas-point-latest ;;最新のデータを取得 "44112");;八王子
結果は次のようになります。
(\20220226141000 (prefNumber . 44) (observationNumber . 112) (temp . [12.6 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [8.8 0]) (maxTempTime (hour . 4) (minute . 41)) (maxTemp . [13.4 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 4) (minute . 58)) (gustDirection . [8 0]) (gust . [15.2 0]))
一応アクセッサがあるのでそれを使うと楽にデータを取り出せます。
(let* ((amedas-code "44112") (sample (jma-amedas-point-latest amedas-code))) (format "%sの%sの気温は%s℃、降水量(前1時間)は%smmです" (jma-amedas-point-name (jma-amedas-point amedas-code)) (format-time-string "%Y-%m-%d %H:%M" (jma-amedas-sample-time sample)) (or (jma-amedas-sample-temp sample) "-") (or (jma-amedas-sample-precipitation1h sample) "-")))
"八王子の2022-02-26 14:10の気温は12.6℃、降水量(前1時間)は0.0mmです"
取り出せる情報は設備の種類によって異なります(気象庁 | アメダスあたりを参照のこと)。
また、計測値の品質に問題がある場合はnilを返します。生データの配列(上の例だと(temp . [12.6 0])等)の二番目の要素が品質を示す値で、0のとき正常を意味します。
期間を指定して取得することも可能です。
(let* ((max-time (jma-amedas-latest-time)) (min-time (time-add max-time (* -5 60 60)))) (jma-amedas-point-samples-between "44112" min-time max-time))
((\20220226093000 (prefNumber . 44) (observationNumber . 112) (temp . [9.6 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [6 0]) (wind . [1.0 0]) (maxTempTime (hour . 0) (minute . 27)) (maxTemp . [9.7 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 20) (minute . 31)) (gustDirection . [13 0]) (gust . [4.4 0])) (\20220226094000 (prefNumber . 44) (observationNumber . 112) (temp . [9.9 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [4 0]) (wind . [1.5 0]) (maxTempTime (hour . 0) (minute . 40)) (maxTemp . [9.9 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 20) (minute . 31)) (gustDirection . [13 0]) (gust . [4.4 0])) (\20220226095000 (prefNumber . 44) (observationNumber . 112) (temp . [10.0 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [5 0]) (wind . [2.3 0]) (maxTempTime (hour . 0) (minute . 46)) (maxTemp . [10.3 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 0) (minute . 50)) (gustDirection . [7 0]) (gust . [5.4 0])) (\20220226100000 (prefNumber . 44) (observationNumber . 112) (temp . [10.3 0]) (snow1h . [0 :null]) (snow6h . [0 :null]) (snow12h . [0 :null]) (snow24h . [0 :null]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [3.6 0]) (maxTempTime (hour . 0) (minute . 56)) (maxTemp . [10.8 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 0) (minute . 58)) (gustDirection . [8 0]) (gust . [5.8 0])) (\20220226101000 (prefNumber . 44) (observationNumber . 112) (temp . [10.1 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [6 0]) (wind . [3.1 0]) (maxTempTime (hour . 0) (minute . 56)) (maxTemp . [10.8 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 0) (minute . 58)) (gustDirection . [8 0]) (gust . [5.8 0])) (\20220226102000 (prefNumber . 44) (observationNumber . 112) (temp . [10.6 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [4.0 0]) (maxTempTime (hour . 1) (minute . 15)) (maxTemp . [10.9 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 1) (minute . 13)) (gustDirection . [8 0]) (gust . [7.5 0])) (\20220226103000 (prefNumber . 44) (observationNumber . 112) (temp . [11.2 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [3.2 0]) (maxTempTime (hour . 1) (minute . 29)) (maxTemp . [11.4 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 1) (minute . 13)) (gustDirection . [8 0]) (gust . [7.5 0])) (\20220226104000 (prefNumber . 44) (observationNumber . 112) (temp . [11.2 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [8 0]) (wind . [3.1 0]) (maxTempTime (hour . 1) (minute . 39)) (maxTemp . [11.7 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 1) (minute . 13)) (gustDirection . [8 0]) (gust . [7.5 0])) (\20220226105000 (prefNumber . 44) (observationNumber . 112) (temp . [10.8 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [3.0 0]) (maxTempTime (hour . 1) (minute . 39)) (maxTemp . [11.7 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 1) (minute . 13)) (gustDirection . [8 0]) (gust . [7.5 0])) (\20220226110000 (prefNumber . 44) (observationNumber . 112) (temp . [11.2 0]) (snow1h . [0 :null]) (snow6h . [0 :null]) (snow12h . [0 :null]) (snow24h . [0 :null]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [8 0]) (wind . [3.6 0]) (maxTempTime (hour . 1) (minute . 58)) (maxTemp . [11.8 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 1) (minute . 13)) (gustDirection . [8 0]) (gust . [7.5 0])) (\20220226111000 (prefNumber . 44) (observationNumber . 112) (temp . [11.5 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [4.5 0]) (maxTempTime (hour . 1) (minute . 58)) (maxTemp . [11.8 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 1) (minute . 13)) (gustDirection . [8 0]) (gust . [7.5 0])) (\20220226112000 (prefNumber . 44) (observationNumber . 112) (temp . [11.5 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [9 0]) (wind . [2.8 0]) (maxTempTime (hour . 2) (minute . 14)) (maxTemp . [12.3 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 1) (minute . 13)) (gustDirection . [8 0]) (gust . [7.5 0])) (\20220226113000 (prefNumber . 44) (observationNumber . 112) (temp . [11.8 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [6 0]) (wind . [2.6 0]) (maxTempTime (hour . 2) (minute . 14)) (maxTemp . [12.3 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 1) (minute . 13)) (gustDirection . [8 0]) (gust . [7.5 0])) (\20220226114000 (prefNumber . 44) (observationNumber . 112) (temp . [12.8 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [4.4 0]) (maxTempTime (hour . 2) (minute . 40)) (maxTemp . [12.9 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 1) (minute . 13)) (gustDirection . [8 0]) (gust . [7.5 0])) (\20220226115000 (prefNumber . 44) (observationNumber . 112) (temp . [12.6 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [9 0]) (wind . [3.0 0]) (maxTempTime (hour . 2) (minute . 50)) (maxTemp . [12.9 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 1) (minute . 13)) (gustDirection . [8 0]) (gust . [7.5 0])) (\20220226120000 (prefNumber . 44) (observationNumber . 112) (temp . [12.7 0]) (snow1h . [0 :null]) (snow6h . [0 :null]) (snow12h . [0 :null]) (snow24h . [0 :null]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [4.0 0]) (maxTempTime (hour . 2) (minute . 55)) (maxTemp . [13.0 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 3) (minute . 0)) (gustDirection . [8 0]) (gust . [7.5 0])) (\20220226121000 (prefNumber . 44) (observationNumber . 112) (temp . [12.9 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [8 0]) (wind . [4.9 0]) (maxTempTime (hour . 3) (minute . 3)) (maxTemp . [13.1 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 3) (minute . 6)) (gustDirection . [7 0]) (gust . [8.3 0])) (\20220226122000 (prefNumber . 44) (observationNumber . 112) (temp . [12.1 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [6 0]) (wind . [5.1 0]) (maxTempTime (hour . 3) (minute . 3)) (maxTemp . [13.1 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 3) (minute . 6)) (gustDirection . [7 0]) (gust . [8.3 0])) (\20220226123000 (prefNumber . 44) (observationNumber . 112) (temp . [12.1 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [6.1 0]) (maxTempTime (hour . 3) (minute . 3)) (maxTemp . [13.1 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 3) (minute . 21)) (gustDirection . [9 0]) (gust . [9.7 0])) (\20220226124000 (prefNumber . 44) (observationNumber . 112) (temp . [12.3 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [5.5 0]) (maxTempTime (hour . 3) (minute . 3)) (maxTemp . [13.1 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 3) (minute . 21)) (gustDirection . [9 0]) (gust . [9.7 0])) (\20220226125000 (prefNumber . 44) (observationNumber . 112) (temp . [12.8 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [6.8 0]) (maxTempTime (hour . 3) (minute . 3)) (maxTemp . [13.1 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 3) (minute . 21)) (gustDirection . [9 0]) (gust . [9.7 0])) (\20220226130000 (prefNumber . 44) (observationNumber . 112) (temp . [12.5 0]) (snow1h . [0 :null]) (snow6h . [0 :null]) (snow12h . [0 :null]) (snow24h . [0 :null]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [7.3 0]) (maxTempTime (hour . 3) (minute . 55)) (maxTemp . [13.3 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 3) (minute . 58)) (gustDirection . [7 0]) (gust . [10.1 0])) (\20220226131000 (prefNumber . 44) (observationNumber . 112) (temp . [12.8 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [6.6 0]) (maxTempTime (hour . 3) (minute . 55)) (maxTemp . [13.3 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 4) (minute . 7)) (gustDirection . [8 0]) (gust . [10.6 0])) (\20220226132000 (prefNumber . 44) (observationNumber . 112) (temp . [12.7 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [6.9 0]) (maxTempTime (hour . 3) (minute . 55)) (maxTemp . [13.3 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 4) (minute . 20)) (gustDirection . [8 0]) (gust . [10.9 0])) (\20220226133000 (prefNumber . 44) (observationNumber . 112) (temp . [12.6 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [8.0 0]) (maxTempTime (hour . 3) (minute . 55)) (maxTemp . [13.3 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 4) (minute . 28)) (gustDirection . [8 0]) (gust . [12.5 0])) (\20220226134000 (prefNumber . 44) (observationNumber . 112) (temp . [12.9 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [7.4 0]) (maxTempTime (hour . 3) (minute . 55)) (maxTemp . [13.3 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 4) (minute . 28)) (gustDirection . [8 0]) (gust . [12.5 0])) (\20220226135000 (prefNumber . 44) (observationNumber . 112) (temp . [12.9 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [8 0]) (wind . [7.9 0]) (maxTempTime (hour . 4) (minute . 41)) (maxTemp . [13.4 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 4) (minute . 28)) (gustDirection . [8 0]) (gust . [12.5 0])) (\20220226140000 (prefNumber . 44) (observationNumber . 112) (temp . [12.9 0]) (snow1h . [0 :null]) (snow6h . [0 :null]) (snow12h . [0 :null]) (snow24h . [0 :null]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [8 0]) (wind . [9.3 0]) (maxTempTime (hour . 4) (minute . 41)) (maxTemp . [13.4 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 4) (minute . 58)) (gustDirection . [8 0]) (gust . [15.2 0])) (\20220226141000 (prefNumber . 44) (observationNumber . 112) (temp . [12.6 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [8.8 0]) (maxTempTime (hour . 4) (minute . 41)) (maxTemp . [13.4 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 4) (minute . 58)) (gustDirection . [8 0]) (gust . [15.2 0])) (\20220226142000 (prefNumber . 44) (observationNumber . 112) (temp . [13.0 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [8.0 0]) (maxTempTime (hour . 4) (minute . 41)) (maxTemp . [13.4 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 4) (minute . 58)) (gustDirection . [8 0]) (gust . [15.2 0])) (\20220226143000 (prefNumber . 44) (observationNumber . 112) (temp . [13.0 0]) (sun10m . [10 0]) (sun1h . [1.0 0]) (precipitation10m . [0.0 0]) (precipitation1h . [0.0 0]) (precipitation3h . [0.0 0]) (precipitation24h . [0.0 0]) (windDirection . [7 0]) (wind . [7.2 0]) (maxTempTime (hour . 5) (minute . 29)) (maxTemp . [13.4 0]) (minTempTime (hour . 20) (minute . 22)) (minTemp . [-2.7 0]) (gustTime (hour . 4) (minute . 58)) (gustDirection . [8 0]) (gust . [15.2 0])))
1度のアクセスで10分毎の計測データが3時間分まとめて取得できるので、必要なだけアクセスして結果をつなぎ合わせてから不要な部分をカットしています。サーバへのアクセス頻度が高くなりがちなのでご注意ください(とは言え気象庁の観測データ一覧ページで行っていることと同じではあります)。
過去数日程度のデータしか取得できないようです。それ以前のデータは気象庁|各種データ・資料のあたりから取得しましょう。