Weather Research Forecast (WRF) モデル構成に関連する Perl スクリプトに問題があります。問題のスクリプトは、ここにあるダウンロードの一部です(ログインが必要、簡単なサインアップ)。最新の WRF-NMM コアをダウンロードすると、解凍されたディレクトリに arch/Config_new.pl があります。私が抱えているエラーは、262 ~ 303 行目のどこかにあります。
until ( $validresponse ) {
print "------------------------------------------------------------------------\n" ;
print "Please select from among the following supported platforms.\n\n" ;
$opt = 1 ;
open CONFIGURE_DEFAULTS, "< ./arch/configure_new.defaults"
or die "Cannot open ./arch/configure_new.defaults for reading" ;
while ( <CONFIGURE_DEFAULTS> )
{
for $paropt ( @platforms )
{
if ( substr( $_, 0, 5 ) eq "#ARCH"
&& ( index( $_, $sw_os ) >= 0 ) && ( index( $_, $sw_mach ) >= 0 )
&& ( index($_, $paropt) >= 0 ) )
{
$optstr[$opt] = substr($_,6) ;
$optstr[$opt] =~ s/^[ ]*// ;
$optstr[$opt] =~ s/#.*$//g ;
chomp($optstr[$opt]) ;
$optstr[$opt] = $optstr[$opt]." (".$paropt.")" ;
if ( substr( $optstr[$opt], 0,4 ) ne "NULL" )
{
print " %2d. %s\n",$opt,$optstr[$opt] ;
$opt++ ;
}
}
}
}
close CONFIGURE_DEFAULTS ;
$opt -- ;
print "\nEnter selection [%d-%d] : ",1,$opt ;
$response = <STDIN> ;
if ( $response == -1 ) { exit ; }
if ( $response >= 1 && $response <= $opt )
{ $validresponse = 1 ; }
else
{ print("\nInvalid response (%d)\n",$response);}
}
具体的には、何のプロンプトもオプションの一覧も表示されずに、入力行に送られます。有効な選択肢を選択した後でのみ、前のオプションが表示されます。これは、さらに下の別のコード チャンクで 2 回繰り返されます (478 ~ 528 行)。混乱したのは、デバッグ モードに入ったときに、コードのこの部分の開始前にブレークを挿入したことです。私は走っp $validresponse
て、次のものを手に入れました:
0
If you REALLY want Grib2 output from WRF, modify the arch/Config_new.pl script.
Right now you are not getting the Jasper lib, from the environment, compiled into WRF.
この段落はprintf
数行前のものであるため、これには興味をそそられます。この特定のスクリプトでは、これまでに実行された唯一の printf ですが、出力が次に作成された変数に保存された理由はわかりません。助言がありますか?
tee
編集: choroba の提案を見た後、パイピング、使用、stderr/stdout リダイレクトのいずれのタイプのリダイレクトでも同じ問題が発生します。そのため、bashに問題があるのではないかと思いますか?つまり、私がそれを実行できる唯一の方法は、いかなる種類のログも記録しないことです (少なくとも私の知る限りでは、これは確かにかなり制限されています)。