GMT

gmtset

gmtset でいろいろいじったのをリセット

$ gmtdefaults -D > .gmtdefaults4

PLOT_DEGREE_FORMAT, D_FORMAT(地理座標系での目盛りの数値)

  • いちからはじめる GMT その67

    • 小数表示にする

    • 小数表示のフォーマットの設定

        • l: 倍精度の浮動少数点数をあつかう

        • e: 指数表示: 1.0e-3

        • f: 小数表示: 0.001

        • g: e,f の適したほうになる。小数点以下の末尾の連続する0が省略される。

psbasemap

軸について: 参考

        • $ gmtset PLOT_DEGREE_FORMAT D

        • $ gmtset D_FORMAT %.1lf #小数点以下1桁まで描く

    • −N: 地図の枠からはみ出す記号を省略しない[デフォルトでは枠内の点 のみ描画する]。線と多角形については常に地図領域にクリップされる ためこのオプションは適用されない。

折れ線とプロットグラフのサンプル

8.1.1.1. Regular floating point coordinates

gmt math -T0/100/10 T SQRT = sqrt.d10 gmt psxy -R0/100/0/10 -JX3i/1.5i -Bag -BWSne+gsnow -Wthick,blue,- -P -K sqrt.d > GMT_linear.ps gmt psxy -R -J -St0.1i -N -Gred -Wfaint -O sqrt.d10 >> GMT_linear.ps

時系列データ

参考HP

  • rffbl気象学的データ解析

  • A First Course in GMT

  • 様々な時間軸

    • 各種設定

    • 日付・時刻の設定

    • gmtset INPUT_DATE_FORMAT yyyy-mm-dd

    • gmtset INPUT_CLOCK_FORMAT hh:mm:ss

    • gmtset PLOT_DATE_FORMAT mm-dd

    • gmtset PLOT_CLOCK_FORMAT hh:mm

    • Rオプションの書き方

    • 時系列データのRオプションでは、年月日と時刻の間にTを挟む。つまりX軸に時刻データが来るならば例えば

    • -R2009-08-21T08:35:00/2009-08-22T08:35:00/20/35

    • のように書く。

    • Jオプションの書き方

    • Jオプションでも、やはりTを使う。例えば

    • -JX30T/10

    • のように書く。

makecpt

オプション

    • -Z: 連続的な cpt ファイルを作成

    • -D: cpt ファイルに書き出される背景及び前景色となる出力 cpt ファ イルの最低及び最高の z 値に対する色を選択する

        • [デフォルトではマ スターファイルで指定された色、又はパラメータ COLOR_BACKGROUND, COLOR_FOREGROUND, 及び COLOR_NAN により定義された色を使う]。

    • -N: 背景、前景、及び NANの色のフィールドを書き出さない

    • 偏差に対するカラーパレット(デフォルトの polar の色を連続的に用いる)

2次元描画

-Sn 内挿しない

補間

1次元の補間【sample1dHP

sample1d tt.txt -Fl -H -I0.01 -T2 -S0.3 > tt_0.01.txt

-Fl : 線形補間

-H : ヘッダーを 1 行読み飛ばす

-l0.01 : 0.01 間隔

-T2: 独立変数の列番号

-S0.3: 0.3 スタート

grd2xyz(補完したgrdデータをアスキーにする)

grd2xyz d3.grd > daski.txt

3次元描画

GMTでの3次元描画を行うコマンドは「線」を描画する psxyz と 「面」を描画する grdview がある

grdview (grdデータから2次元平面を陰影で描画する)

NetCDFデータの読み込み

マニュアルより抜粋

Consider a 4-dimensional grid with the following variables:

        • $ makecpt -Z -D -Cpolar -T-0.5/0.5/0.05 > polar.cpt

If one or more of the selected variables are two-dimensional, and have the same leading dimension as the other selected variables they will be plotted in their entirety. For example, if a netCDF files contains 6 time steps recording temperature at 4 points, and the variable temp is a 6 by 4 array, then the command gmt convert “file.nc?time/temp” can result in:

Programs that generally deal with columns of one-dimensional data, like or can use multi-dimensional netCDF files in a very similar way. If a variable in a netCDF file is one-dimensional, there is nothing more needed than name the variables on the command line. For example:

or (only in case the coordinates increase linearly):

To get information on the 10x10 grid of pressure at depth 10 and at time 24, one would use:

lat(lat): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 lon(lon): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 depth(depth): 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 time(time): 0, 12, 24, 36, 48 pressure(time,depth,lat,lon): (5000 values)

gmt grdinfo "file.nc?pressure[2,1]"

gmt grdinfo "file.nc?pressure(24,10)"

gmt psxy "file.nc?lon/lat" ... gmt convert "file.nc?time/lat/lon"

2012-06-25T00:00:00 20.1 20.2 20.1 20.3 2012-06-25T12:00:00 24.2 23.2 24.5 23.5 2012-06-26T00:00:00 16.1 16.2 16.1 16.3 2012-06-26T12:00:00 22.1 23.0 23.9 23.5 2012-06-27T00:00:00 17.5 16.9 17.2 16.8 2012-06-27T12:00:00 27.2 27.2 27.5 27.5

If, for example, only the second temperature column is needed, use gmt convert “file.nc?time/temp[1]” (indices start counting at 0).

使えそうなコマンド

  • grdcut

    • gmt grdcut earth_relief_05m.grd -R-66/-60/30/35 -Gtut_bathy.nc -V