发现 GRD 是一个“网格数据集文件”,但无法使用cat
. 我认为它是二进制格式,因此必须以不同的方式阅读。问题是:仅在 Fortran、R、MATLAB 中找到示例...我必须将下面的 shell 脚本转换为 PHP(这只是部分代码):
if test -s /path/${datemax}00tx.grd
then
# creating ctl file
echo DSET /path/${datamax}00tx.grd >> $DIR/new-$customer.ctl
echo UNDEF 777.7 >> $DIR/new-$customer.ctl
echo TITLE CTL to view interpolated files >> $DIR/new-$customer.ctl
echo XDEF 176 LINEAR -76 .25 >> $DIR/new-$customer.ctl
echo YDEF 160 LINEAR -34 .25 >> $DIR/new-$customer.ctl
echo ZDEF 1 LINEAR 1 1 >> $DIR/new-$customer.ctl
echo TDEF 1 LINEAR 00Z01apr$yearmax 24HR >> $DIR/new-$customer.ctl
echo VARS 1 >> $DIR/new-$customer.ctl
echo maxval 0 99 Maximum Value>> $DIR/new-$customer.ctl
echo ENDVARS >> $DIR/new-$customer.ctl
echo MAXVAL
cat << eof | grads -bpc "$DIR/getvalues.gs"
maxval
$customer
eof
fi
rm -f $DIR/new-$customer.ctl
是否有可能使用另一种语言,如 PHP、Java(我的首选)或 Python 来做到这一点?这个丑陋的脚本让我想起了大会。