Views
気候値
緯度・経度による月平均気温などの入手と利用法
- 気象庁の DDB (Distributed DataBase) サイトに、 緯度・経度のグリッドになったデータが公開されている。
- DDB
- Climate -> Monthly/Pentad Global Analysis products
- FTP -> Month -> Temperature -> 1000 には 1000 hPa 面の月平均気温
- ここからたとえば t000200611m を取る
- このファイルは GRIB 形式なので、すぐには読めない
- 読むツール wgrib
- C source code を取ってきて、コンパイル (make wgrib) する
- 使い方
- $ ./wgrib t000200611m -d 1 -text -o t000200611m.dat
- とすると、ヘッダ情報が表示され、ASCIIテキスト形式のデータ t000200611.dat ができる
- 第1行が 144 73 で、0 ~ 357.5度 N90 ~ S90度 まで 2.5度ごと 144x73=10152行のデータがある。(2行目以降は1行1点のデータ)
- 気温の単位は K (絶対温度)
- 以下補足
- データ部分を 144 個ごとに改行を追加してあげると、 gnuplot で利用できるデータ形式になる
# text2dat.py ... wgrib dump text -> gnuplot'able data import sys f = file(sys.argv[1]) w, h = f.readline().split()[:2] w = int(w); h = int(h) for y in range(h): for x in range(w): sys.stdout.write(f.readline()) print
- gnuplot 起動
gnuplot> splot "t000200611m.dat" with lines