1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

macOSへのgrib2ctl・g2ctlのインストール(Apple silicon)

Last updated at Posted at 2023-06-17

はじめに

grib2ctlg2ctl はそれぞれ GRIB 、 GRIB2 ファイルから GrADS のコントロールファイルを作成するプログラムで、アメリカ海洋大気庁(NOAA)を構成するアメリカ国立気象局(NWS)の国立環境予測センター(National Centers for Environmental Prediction:NCEP)が配布している。

実行環境

OS:macOS Ventura 13.4

準備

必要な実行ファイル:wgribwgrib2grads

これらのインストール、セットアップについては、以下の記事に詳述。

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 wgribwhich 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
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?