はじめに
grib2ctl 、g2ctl はそれぞれ GRIB 、 GRIB2 ファイルから GrADS のコントロールファイルを作成するプログラムで、アメリカ海洋大気庁(NOAA)を構成するアメリカ国立気象局(NWS)の国立環境予測センター(National Centers for Environmental Prediction:NCEP)が配布している。
実行環境
OS:macOS Ventura 13.4
準備
必要な実行ファイル:wgrib
、wgrib2
、grads
これらのインストール、セットアップについては、以下の記事に詳述。
grib2ctl のインストール
NOAA から grib2ctl をダウンロード
User@Computer ~ % wget ftp://ftp.cpc.ncep.noaa.gov/wd51we/wgrib.scripts/grib2ctl.pl
grib2ctl.pl
の 45〜51 行目を書き換え
$wgrib=
と $pdef_dir=
に、 which wgrib
、 which grads
で返ってきたパスをそれぞれ設定する( $pdef_dir
の変更はオプショナル)。
~/grib2ctl.pl(45〜51 行目:変更前)
# ***** if wgrib is not on path, add it here
# $wgrib='/u/wx51we/home/bin/wgrib';
$wgrib='wgrib';
# **** directory of interpolation files
$pdef_dir='/usr/local/lib/grads';
#$pdef_dir=$ENV{"HOME"}/grads;変更後
~/grib2ctl.pl(45〜51 行目:変更後)
# ***** if wgrib is not on path, add it here
# $wgrib='/u/wx51we/home/bin/wgrib';
$wgrib='/opt/local/bin/wgrib';
# **** directory of interpolation files
$pdef_dir='/opt/local/bin/grads';
#$pdef_dir=$ENV{"HOME"}/grads;
実行可能にする
User@Computer ~ % chmod 755 grib2ctl.pl
パスが通っているディレクトリへ移動
User@Computer ~ % sudo mv grib2ctl.pl /opt/local/bin/grib2ctl
g2ctl のインストール
NOAA から g2ctl をダウンロード
User@Computer ~ % wget ftp://ftp.cpc.ncep.noaa.gov/wd51we/g2ctl/g2ctl
g2ctl.pl
の 40〜42 行目を書き換え
$wgrib2=
に which wgrib2
で返ってきたパスを設定する。
~/g2ctl.pl(40〜42 行目:変更前)
# ***** if wgrib2 is not on path, add it here
$wgrib2='wgrib2';
# $wgrib2='/export/cpc-lw-webisuzak/wd51we/grib2/wgrib2/wgrib2';
~/g2ctl.pl(40〜42 行目:変更後)
# ***** if wgrib2 is not on path, add it here
$wgrib2='/opt/local/bin/wgrib2';
# $wgrib2='/export/cpc-lw-webisuzak/wd51we/grib2/wgrib2/wgrib2';
実行可能にする
User@Computer ~ % chmod 755 g2ctl
パスが通っているディレクトリへ移動
User@Computer ~ % mv g2ctl /opt/local/bin