dpdyh86002 2016-07-08 14:45
浏览 81

在PHP中读取.grd文件

Found out GRD is a "gridded dataset file", but cannot see its contents using cat. I think it's in binary format, so it must be read in a different way. The problem is: only found examples in Fortran, R, MATLAB... I must convert the shell script below to PHP (that's only a partial code):

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

Is it even possible to do this using another language like PHP, Java (my preferred one) or Python? This ugly script reminds me of Assembly.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥88 实在没有想法,需要个思路
    • ¥15 MATLAB报错输入参数太多
    • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
    • ¥15 有赏,i卡绘世画不出
    • ¥15 如何用stata画出文献中常见的安慰剂检验图
    • ¥15 c语言链表结构体数据插入
    • ¥40 使用MATLAB解答线性代数问题
    • ¥15 COCOS的问题COCOS的问题
    • ¥15 FPGA-SRIO初始化失败
    • ¥15 MapReduce实现倒排索引失败