GrADS コマンドクイックレファレンス

GrADS 実行プログラム

grads 以下の実行プログラムのひとつへのリンク
gradsnc netCDF 取り扱い可能な grads
gradshdf HDF 取り扱い可能な grads
gradsc netCDF/HDF/Athena GUI などが使えない “classic” な grads

コマンドラインオプション

Program: grads [-lbpC] [-c ‘command’]
-c ‘command’ GrADS を開始するときに‘command’を実行
-b grads をバッチモードで実行。グラフィック出力ウィンドウは開かない。
-l grads をランドスケープ(横向き)モードで実行。向きの質問はない。
-p grads をポートレート(縦向き)モードで実行。向きの質問はない。
-C 100 未満の年に対する世紀の自動設定を可能とする

一般設定

help 操作の要約を表示
set grads on | off GrADS ロゴの表示を する/しない
set display <option <color>> 表示モードの設定
grey|greyscale モードを greyscale に設定
color <black|white> レインボーカラーで表示 標準
set frame <option> フレームの制御 
on クリップした領域の周囲に長方形のフレームを描く
off フレームを描かない
circle 緯度経度投影では長方形のフレームを描き、極中心の全半球プロットでは最も外側の緯度で円形のフレームを描く
set background ic 背景色を color もしくは color インデックス ic に設定
display expression
d expression
グラフィック出力ウィンドウにデータを表示 最も簡単な expression は変数の略語
open filename ディスクリプター(コントロール)ファイルを開く
sdfopen file.nc <template #timesteps> opens a netCDF or HDF-SDS format file that conforms to the COARDS conventions. The optional arguments are for string a timeseries of files together as one GrADS data object.
xdfopen file opens a non-COARDS-conformant netCDF or HDF-SDS file via a data descriptor file similar to those used with the ‘open‘ command.
close file# 最後に開いたディスクリプターファイルを閉じる
set dfile number 現在のファイルに対してディスクリプターファイルの番号を number に変更
define var=expr var=expr 新しい変数を作成 以降の式で使える
undefine var 定義変数で使っていたリソースを解放
modify varname <time type> define variable, which is climatological. varname is the defined grid. Time types are:
seasonal monthly or multi-monthly means
diurnal over some time period less than a day
query <option>
q <option>
query options are:

config list GrADS configuration informationi
files lists open files
file n gives info on particular file
define lists currently defined variables
dims gives current dimension environment
gxinfo gives graphics environment info
shades gives colors and levels of shaded contours
pos waits for mouse click, returns the position
time gives info about time settings
fwrite print name of fwrite ouput file
string s gives the width of string s
defval v1 i j gives the value of a defined variable v1 at point i,j
udft list the user defined function table
lats state of the GrADS-LATS interface
xy2w v1 v2 XY coords to world coords
xy2gr v1 v2 XY coords to grid coords
w2xy v1 v2 world coords to XY coords
w2gr v1 v2 world coords to grid coords
gr2w v1 v2 grid coords to world coords
gr2xy v1 v2 grid coords to XY coords
ll2xy lon lat LON/LAT coords to XY coords
pp2xy ppx ppy page coords to XY coords

set imprun script すべての display コマンドの前に自動的に script を実行
run file-name <params> スクリプトを(パラメータをつけて)実行
exec fname <arg0,..,arg9> fname というファイルから GrADS コマンド列を実行 もし clear コマンドがあれば、消去して次のコマンド処理に進む前に改行が入力されるまで待つ
clear <option>
c <option>
表示を消去する オプションは
events イベントバッファをフラッシュ
graphics グラフィックを消去し、ウィジェットは消去しない
hbuff ダブルバッファモードの時、ディスプレイバッファを消去
reset <option> GrADS を次を除いて初期状態に戻す 1) ファイルは閉じない 2) 定義されたものは解放しない 3) ‘set display’ で設定したものは変更しない オプションは events; graphics; hbuff; norset
reinit reset と同じだが、さらにすべての開いているファイルを閉じ、定義されたものを解放する
quit 終了
!shell-command

GrADS のコマンドライン上でシェルコマンドを実行する 出力はただ表示される

次元環境

set lon val1 <val2> 経度が val1 から val2 までに設定
set lat val1 <val2> 緯度が val1 から val2 までに設定
set lev val 鉛直レベルを val に固定
set t val1 <val2> 時刻をデータセットの “val”時間に設定
set x val1 <val2> x の範囲を設定、あるいはある値に固定
set y val1 <val2> y の範囲を設定、あるいはある値に固定
set z val1 <val2> z の範囲を設定、あるいはある値に固定

ページ制御

set vpage off リアルページが “仮想ページ”と同じとする 標準
set vpage xmn xmx ymn ymx ひとつの “仮想”ページを定義
set parea xmn xmx ymn ymx 仮想ページの中の領域を制御

グラフィックタイプ

set gxout graphic-type where graphic-type could be:
bar Bar chart 
barb Plot wind barb at station
contour Contour plot
errbar Error bar
fgrid specific value grid fill plot
findstn Find closest station to x,y point
fwrite Write data to file instead of displaying
grfill Filled grid boxes
grid Grid boxes with values
line Line graph
linefill Color fill between two lines 
model Plot station model
scatter Scatter graph plot
shaded Shaded contour plot
stat Display information about data
stream Streamline plot
tserwx Plot time series of weather symbols at a point (1-D station)
tserbarb Plot time series of wind barbs at a point (1-D)
value Plot station values
vector Vector wind arrows
wxsym Plot weather symbols at station

標準色、ラインスタイル、マーカータイプ

colors used by many settings (i.e. ccolor, line, string button, clopts, lfcols, .....):
0 black 4 blue 8 orange 12 dark yellow
1 white 5 cyan 9 purple 13 aqua
2 red 6 magenta 10 yellow/green 14 dark purple
3 green 7 yellow 11 med.blue 15 grey
line styles used by many settings (i.e. cstyle, line, mpt, map, grid, ...):
0 none 4 long short dash
1 solid 5 dots
2 long dash 6 dot dash
3 short dash 7 dot dot dash
marker types used by many settings (i.e. cmark, mark, .....):
0 none 6 X
1 cross 7 diamond
2 open circle 8 triangle
3 closed circle 9 none
4 open square 10 open circle with vertical line
5 closed square 11 open oval

グラフィックオプション

set clip xlo xhi ylo yhi グラフィックプリミティブを描画するクリッピング領域を設定
set ccolor index 等値線の色を index に設定 標準色とラインスタイルを参照 他にも rainbow (レインボーカラー列) や revrain (レインボーカラー列の逆) を指定できる
set cstyle style 等値線やラインのスタイルを設定 標準色とラインスタイルを参照 (gxout = contour の場合は、スタイル 1,2,3 と 5 のみが利用可能)
set cmark marker ラインマーカーを設定 標準色とラインスタイルを参照
set cterp on | off スプライン内挿を する/しない
set clab on | off | forced | string | auto 等値線のラベリングを設定
set clopts col <thick <size>>

等値線オプションを設定

set clskip val 等値線のラベリングを val 毎に
set cthick thckns

等値線の太さを設定 [1-10]

set csmooth on | off | linear 3次あるいは線形内挿により細かい格子へ内挿
set cint value 等値線間隔を指定した“value”に設定
set cmax value この値より上では等値線を描かない
set cmin value この値より下では等値線を描かない
set clevs lev1 lev2 ... 等値線を描くレベルを指定
set ccols col1 col2 ... 等値値を描くレベルに対する色を指定
set line col <style> <thick> 現在のライン属性を設定 太さの範囲は 1-6(標準色とラインスタイルを参照)
set lfcols col1 col2 線の下と上の色を設定 (gxout linefill の場合)
set black off | val1 val2 この値の中は等値線を描かない
set rbcols c1 c2 <c3 ... cn> 新しい "rainbow" 色列を指定
set rbcols <auto> 標準の "rainbow" 色列を使用
set rbrange low high 値と rainbow 色の割り当てを決める時の値の範囲を設定
set grid on | off | <style> <color> | horizontal | vertical 指定したオプションを持ちて格子線を描くかどうか
set bargap val バーの間隔をパーセントで設定
set barbase value | bottom | top バーの範囲
set baropts filled | outline バーが外枠か塗りつぶしか 標準は塗りつぶし
set dignum number 小数点以下の数字の数
set digsize size 数字の大きさをインチかプロッター単位で指定
set arrlab on|off 矢印のラベリングをする/しない
set arrscl size <magnitude> 矢印の長さスケーリングを指定
set arrowhead size 矢印の頭の部分の大きさを指定
set fgvals v1 c1 <v2 c2>... fgrid output type treats the grid values as rounded integers, and will shade a specified integer valued grid with the specified color.
set zlog on | off Z次元のスケーリングを対数にする/しない
set strmden value specifies the streamline density, where value is from 1 to 10. Default: 5
set stnopts <dig3> <nodig3> plot the number in the slp location as a three digit number with only the last three digits of the whole number plotted
set mdlopts noblank | blank | dig3 | nodig3 plot the number of the model data as a three digit
set stid on | off controls whether the station id is displayed next to the values or not
set wxcols c1 c2 c3 c4 c5 c6

set colors for weather symbols c1 - c6

軸ラベリング/アノテーション/ラベリング

set xaxis start end <incr> X軸の設定
set yaxis start end <incr> Y軸の設定
set xlevs lab1 lab2 ...

X軸について描くラベルレベルを指定

set ylevs lab1 lab2 ...

Y軸について描くラベルレベルを指定

set xlint interval X軸のラベル間隔を指定
set ylint interval Y軸のラベル間隔を指定
set xyrev on プロット軸を反転
set xflip on 水平軸の向きを反対に
set yflip on 鉛直軸の向きを反対に
set xlab on | off | auto | string X軸ラベルを制御・描画
set ylab on | off | auto | string Y軸ラベルを制御・描画
set xlabs lab1 | lab2 | .... X軸を lab1, lab2, lab3, . ラベリング
set ylabs lab1 | lab2 | .... Y軸を lab1, lab2, lab3, . ラベリング
draw xlab string X軸ラベルを描く
draw ylab string

Y軸ラベルを描く

set xlopts col <thick <size>> X軸を設定
set ylopts col <thick <size>>

Y軸を設定

set xlpos offset side X軸ラベルの位置を設定 offset はインチで指定、side は b(bottom) または t(top)
set ylpos offset side Y軸ラベルの位置を設定 offset はインチで指定、side は r(right) または l(left)
set zlog on | off | swap | undefine Z軸を対数スケーリングに設定
set annot col <thick> 上の3つの描画コマンドについて、色と線の太さを設定
set vrange vlo vhi Set range for plotting 1-D or scatter plots; range of the variable values for y-axis scaling
set vrange2 vlo vhi

Set range for plotting 1-D or scatter plots; range of the variable values for x-axis scaling

set missconn on | off 欠測データをまたいで線を接続
draw title string 図の上に title を描く

地図投影・描画

set mproj proj sets current map projection. Keywords are:
latlon Lat/lon projection with aspect ratio maintained. Default.
scaled latlon projection where aspect ratio is not maintained.The plot fills the plotting area.
nps north polar stereographic
sps south polar stereographic
robinson Robinson projection
orthogr Orthographic projection
mollweide Mollweide projection
lambert Lambert conformal conic projection
off same as scaled, but no map is drawn and lables are not interpreted as lat/ lon labels
set mpt type off | <<col> <style> <thick>> command to control map background behavior. type is the map type; it can be a number from 0 to 255, or it can be an asterick (*) to indicate this command applies to all the type values. The color can be set to -1, which indicates to GrADS to use the set map settings for this map type, rather than the settings specified by the set mpt command.
set mpvals off | lnmn lnmx ltmn ltmx sets reference longitudes and latitudes for polar stereogr. plots
set mpdset lowres | mres | hires | nmap

mres and hires have state and country outlines. nmap covers only North America. Default:lowres.

set map auto | color <style <thick>>

draws the map background using the requested line attributes or auto mode

set mpdraw on | off

if off, does not draw the map background

set grid on | off <style <col>> | horizontal | vertical draw or do not draw lat/lon lines on polar plots using the specified color and linestyle
set poli on | off  selects whether you want political boundries drawn for the mres or hires map data sets. Default is on

グラフィックプリミティブ

draw line x1 y1 x2 y2 現在の描画属性を用いて x1, y1 から x2, y2 へ線を描く
draw rec xlo ylo xhi yhi 塗りつぶしなしの長方形を描く
draw recf xlo ylo xhi yhi 塗りつぶしありの長方形を描く
draw mark marktype x y size マーカーを描く 標準の色、ラインスタイルとマーカータイプを参照
draw polyf x1 y1 x2 y2 ... xn yn

塗りつぶしありの多角形を描く xn=x1, yn=y1

draw wxsym symbol x y size <color <thickness>> 指定した場所へ指定した wx 記号を描く

文字列プリミティブ

set string col <justification> <thick> <rotation> 文字描画属性を設定 Justification: l - left; c - center; r - right; tl - top left; tc - center top; tr - right top; bl - bottom left; tc - center bottom; tr - right bott. Roation: 90 - counterclockwise, -90 - clockwise..
set strsiz width <height> 文字列のサイズを設定
draw string x y string x, y の位置に文字列を描く
draw title string 図の上に ‘string’というタイトルを描く

カラー設定

set rgb num red green blue GrADS 中で新しい色を定義し、それを新しいカラーナンバーに割り付ける。カラーナンバーは 16 から 99 の間でなければならない。(0 から 15 は定義済み)

フォント設定

set font number

change to font number [0-5]

ウィジェット

set button 1 bcol1 bcol2 bcol3 0 fcol1 fcol2 fcol3 thickness set button colors. 1 - “on” state; 0 - “off” state
draw button number x y width height string draws a button on position x,y with the attributes
redraw button number 0 | 1 redraws button number; 1 - “on”; 0 - “off”
set rband wn mode x1 y1 x2 y2

rubber banding. wn = widget #; mode = box or line x1, y1 = lowest point in x/y page units x2, y2 = highest point in x/y page units

draw dropmenu number x y width height text display a dropmenu similar to ‘draw button’ command widget number (0 to 64); x and y are the center location for the ‘base’ of the dropmenu; width and height are the size of the ‘base’ of the dropmenu.

ダブルバッファリング

set dbuff on|off ダブルバッファモードを on/off に設定
swap ダブルバッファモードが on の時、バッファをスワップする

アニメーション

set looping on|off アニメーションを on/off に設定
set loopdim x|y|z|t x,y,z,t に対してアニメーションする 標準は t
set loopincr incr

ループのインクリメント(増分値)を設定

ハードコピー出力

enable print fname ファイル fname に対する印刷コマンドを有効にする
print 現在のディスプレイの内容をメタコード形式でファイルにコピー
disable print 印刷出力ファイルを閉じる
outxwd file グラフィックウィンドウを windows のダンプ形式でファイルに出力
wi file.format ファイルに(ImageMagick を用いて) format で出力 例えば wi test.gif

grid ファイルの作成・書き出し

set fwrite fname grid ファイル fname に出力する。もし設定されなければ、fname は grads.fwrite となる。
set gxout fwrite grid ファイル出力を有効にする
disable fwrite grid ファイル出力を閉じる

数学関数

abs(expr) expr の結果の絶対値 格子データや地点データで用いられる。
acos(expr) applies the cos-1 function to the result of expr
asin(expr) applies the sin-1 function to the result of expr
atan2(expr1,expr2) applies the tan-1 function to the result of the two expr, using tanθ = y/x
cos(expr) takes the cosine of the expr
exp(expr) performs the ex operation, where expr is x. gridded and station data
gint(expr) general integral, same as ave except do not devide by the total area
log(expr) takes the natural logarithm of expr
log10(expr) takes the logarithm base 10 of the expr
pow(expr1,expr2) raises the values of expr1 to the power of expr2
sin(expr) takes the sine of the provided expr (in radians)
sqrt(expr) takes the square root of the result of the expr
tan(expr) takes the trigonometric tangent of the expr

平均関数

ave(expr,dim1,dim2<,tinc<,flags>>) 一般的な平均関数 gexpr が dim1 と dim2 で指定された次元範囲で平均される
aave(expr,xdim1,xdim2,ydim1,ydim2)

領域平均を行う xdim1 と xdim2 は lon もしくは x に対するもの、ydim1 と ydim2 は lat もしくは y に対するもの(例えば aave(t,lon=0,lon=180,lat=0,lat=90))

mean(expr,dexpr1,dexpr2<,tinc<,flags>>) ave と同じ ただし領域の重みを考慮しない
amean(expr,xdim1,xdim2,ydim1,ydim2) aave と同じ ただし領域の重みを考慮しない
vint(psexpr,expr,top) hpa での気圧座標で質量を考慮した鉛直積分を行う ここでexpr は積分される量、psexpr はhpa単位での地上気圧で、積分の下限を示す top はhpa 単位での上端気圧で、式であってはならない

格子関数

const(expr,const<,flag>) function allows you to set various parts of a grid to a constant
maskout(expr,mask) whenever the mask values are less than zero, the values in expr are set to the missing data value
skip(expr,skipx,skipy) sets alternating values of the expr to the missing data value.This function is used while displaying wind arrows or barbs to thin the number of arrows or barbs

フィルター関数

smth9(expr) expr の格子上の結果に対して 9 点スムージングを行う

有限差分関数

cdiff(expr,dim) dim で指定したた方向に、expr に対して中央差分を計算する

気象関数

tvrh2q(tvexpr,rhexpr) given virtual temperature and relative humidity, tvrh2q returns specific humidity, q, in g/g
tvrh2t(tvexpr,rhexpr) given virtual temperature and relative humidity, tvrh2t returns the temperature in degrees Kelvin

特殊目的の関数

tloop(expr) when time is varying dimension in the dimension environment, tloop function evaluates the expr at fixed times, then constructs the time series to obtain a final result that is the time varying

ベクトル関数

hcurl(uexpr,vexpr) calculates the vertical component of the curl (i.e. vorticity) at each grid point using finite differencing on the grids provided
hdivg(expr1,expr2) calculates the horizontal divergence using the finite differencing
mag(uexpr,vexpr) performs the calculation: sqrt(uexpr*uexpr+vexpr*vexpr)

地点データ関数

gr2stn(grid_expr,stn_expr) performs an interpolation from grid space back to station locations
oacres(grid_expr,stn_expr<,radii<first guess>>) a Cressman objective analysis is performed on the station data to yield a gridded result representing the station data
stnave(expr,dexpr1,dexpr2<,-m cnt>) takes an average of station data over time
stnmin(expr,dexpr1,dexpr2<,-m cnt>) examines a time series of station data and returns the minimum value encountered for each station
stnmax(expr,dexpr1,dexpr2<,-m cnt>) examines a time series of station data and returns the maximum value encountered for each station

PostScript ファイル作成

Program: gxps [-c] [-r] [-d] [-i mfile] [-o ofile]
converts the GrADS meta file into a PostScript file. Command line options:
-c color on a white background (=old gxpscw)
-r color on a black background (=old gxpsc)
-d add ctrl-d to the end of the file, useful if printing on HP 1200C/PS printer
-i mfile where mfile is the name of the input GrADS meta file
-o ofile where ofile is the name of the output PostScript file
Program: gxeps [-1][-2][-a | -l][-c][-r][-d][-L][-n][-s][-v] [-i mfile] [-o ofile]
converts the GrADS meta file into a PostScript file. Command line options:
-1 PostScript Level 1 output
-2 PostScript Level 2 output
-a DIN A4 paper size
-c color on a white background
-d add ctrl-d to the end of the file, useful if printing on HP 1200C/PS printer
-l US letter paper size
-L ask for a label to be printed on the plot
-n ask for a note to include in postscript file header
-r color on a black background
-s add a file & time stamp
-v verbose
-i mfile where mfile is the name of the input GrADS meta file
-o ofile where ofile is the name of the output PostScript file

GIF ファイル作成

Program: gxgif [-i mfile] [-o ofile]
converts the GrADS meta file into a GIF file. Command line options:
-i mfile where mfile is the name of the input GrADS meta file
-o ofile where ofile is the name of the output GIF file

変数

complete specification for a variable name
abbrev.file#(dimexpr,dimexpr,...)
abbrev is the abbreviation for the variable as specified in the data descriptor file file# is the file number that contains this variable. The default initially is 1. dimexpr is a dimension expression that locally modifies the current dimension environment.