#author("2021-05-10T15:49:13+09:00","default:Miyashita","Miyashita") #author("2021-05-10T15:49:22+09:00","default:Miyashita","Miyashita") *psvelo メモ [#s31b03a5] ** 公式 doc [#h2247cc7] [[Modules (Classic Mode) » psvelo>https://docs.generic-mapping-tools.org/latest/supplements/geodesy/psvelo.html]] ベクトル場を矢印で描いたり,楕円を描いたりできる.詳細は~ ベクトル場を矢印で描いたり,楕円を描いたりできる.~ **ベクトル場,矢印 [#ia3acba4] #codeprettify{{ gmt psvelo -J -R -B -Se[velscale]/[confidence]/[fontsize] -A[params] -G[fill] inputfile.txt > output.ps }} ***-J, -R, -B [#rf481065] いつもの共通オプション.省略. ***input file [#u9af99c1] 例えば &ref(https://main-t-miyashita.ssl-lolipop.jp/hydrocoast/image/GMT/gradient.txt); のようなファイル. それぞれの点で,各列に以下の情報が格納されているファイルを入力する.~ -1,2列: lon(x), lat(y) -3,4列: east(x)方向, north(y)方向成分 -5,6列: east(x)方向, north(y)方向の不確実性(?) -7列: 2方向成分の相関(?) -8列: (空白でも可) 名前 ~ 上記の配列は -Se を指定した場合で,-Sr などの場合は入れるべき変数が異なる.~ 下記の例にあるような図を描く場合には,5〜7 列目の値を変えても何も変わらない. ***-Se[velscale]/[confidence]/[fontsize] [#m1e4bb1d] -velscale: 矢印全体の大きさを調節する. -confidence: 楕円を描く際に使う信頼限界.ここでは関係ない. -fontsize: caption のフォントサイズ.スケールを表示する時に使う.表示させない場合は0でOK. ***-A[params] [#v1f6d75d] 必須ではないがほとんどの場合で必要.矢印の形状について指定する.~ 指定方法は一つではなく #codeprettify{{ -A0.03/0.25/0.10 # LineWidth/HeadLength/HeadSize, 数値は例 }} という方法と #codeprettify{{ -A+a25+e # vector attributes, 数値は例 }} という方法がある.vector attributes の指定子は -+a: Arrow Headの傘(?)の開く角度(デフォルト30deg) -+e: 線の末端に Arrow Head を置く (+s, +m は始点,中間点) -+r: Arrow Headの半分右側だけ表示する(+l は左側だけ) -+g[fill]: Arrow Headの内部の着色 (fill attributes) -+p[pen]: 線のスペック(pen attributes) など. ***-G[fill] [#xf65f651] fill attributes で指定した矢印の着色.-A から vector attributes を指定した場合は -A のオプションが優先される(たぶん). Gの場合は Arrow Head も線もどちらも同じ色になる. ***例1, 2種類で描いてみる [#b40958cf] #codeprettify{{ #!/bin/bash # input file input="gradient.txt" # params and options wid=12 # paper size proj="X$wid" # -J region="-3/3/-3/3" # -R axes="-Ba1f1 -Bx+lX-axis -By+lY-axis -BWSne+ggray95" # -B # -Se velscale / confidence / fontsize sc=0.4 conf=0.0 fs=12 }} #codeprettify{{ # Output 1 psname="psveloA1.ps" # -A LineWidth / HeadLength / HeadSize LW=0.03 HL=0.25 HS=0.10 # vector field gmt psvelo -J$proj -R$region $axes -A$LW/$HL/$HS -Gblack -Se$sc/$conf/0 -P -V -K $input > $psname # arrow scale gmt psvelo -J -R -A$LW/$HL/$HS -Gblack -Se$sc/$conf/$fs -P -V -O <<EOF >> $psname # lon lat u1 u2 sig1 sig2 cor (option) name -2.00 2.80 1.00 0.00 0.00 0.00 0.0 1.0 [unit] EOF }} #codeprettify{{ ## Output 2 psname="psveloA2.ps" arrow="+a25+e+gred+p0.5" # Vector Attribute # vector field gmt psvelo -J$proj -R$region $axes -A$arrow -Gblack -Se$sc/$conf/0 -P -V -K $input > $psname # arrow scale gmt psvelo -J -R -A$arrow -Gblack -Se$sc/$conf/$fs -P -V -O <<EOF >> $psname # lon lat u1 u2 sig1 sig2 cor (option) name -2.00 2.80 1.00 0.00 0.00 0.00 0.5 1.0 [unit] EOF }} &ref(https://main-t-miyashita.ssl-lolipop.jp/hydrocoast/image/GMT/psveloA1.png,405x400); &ref(https://main-t-miyashita.ssl-lolipop.jp/hydrocoast/image/GMT/psveloA2.png,405x400); ***例2, 矢印のスケールを図の外側に配置する [#f9d135d2] 例1のようにオプションをベクトル場を描く場合と同一にすると,図の内側にしかスケールを配置できない.~ 単純に lon, lat または x, y の値を変更しても,範囲外になると矢印が表示されなくなってしまう. ~ 図の外に矢印のスケールを配置するには,スケールを描くときだけ図を大きくする.~ または,psvelo の時に図の原点位置をシフトする -X と -Y オプションに値を与えてずらし,外側に配置させる. #codeprettify{{ #!/bin/bash # input file input="gradient.txt" # Output psname="psvelo.ps" # params and options wid=12 # paper size proj="X$wid" # -J region="-3/3/-3/3" # -R axes="-Ba1f -Bx+lX-axis -By+lY-axis -BWSne+ggray95" # -B # -Se velscale / confidence / fontsize sc=0.4 conf=0.0 fs=12 # -A LineWidth / HeadLength / HeadSize LW=0.03 HL=0.25 HS=0.10 }} #codeprettify{{ # vector field gmt psvelo -J$proj -R$region $axes -A$LW/$HL/$HS -Gblack -Se$sc/$conf/0 -P -V -K $input > $psname }} #codeprettify{{ # scale (inside) gmt psvelo -J -R -A$LW/$HL/$HS -Gblack -Se$sc/$conf/$fs -P -V -O -K <<EOF >> $psname # lon lat u1 u2 sig1 sig2 cor (option) name -1.50 2.80 1.00 0.00 0.00 0.00 0.0 (in) 1.0 [unit] EOF }} #codeprettify{{ # scale (outside) gmt psvelo -Y1.0 -J -R -A$LW/$HL/$HS -Gblack -Se$sc/$conf/$fs -P -V -O <<EOF >> $psname # lon lat u1 u2 sig1 sig2 cor (option) name -1.50 2.80 1.00 0.00 0.00 0.00 0.0 (out) 1.0 [unit] EOF }} #ref(https://main-t-miyashita.ssl-lolipop.jp/hydrocoast/image/GMT/psvelo.png,405x416)