我是shell脚本编程新手,我试图自动化一个进程。 我认为结构是好的,但我得到通知,我认为它不应该存在Bash-shell脚本修改和建议
# STEP 1#
echo " Untar the file s"
time tar -xf $tarfiles
time tar -xf *.tar
#STEP 2#
fname=(wnd10m.gdas.2010*.grb2)
echo " convert into .nc "
cdo -f nc copy $fname $fname.nc
#STEP 3#
ofile1=$fname.nc
echo "re-format into structured grid 0.5x0.5"
cdo remapbil,r720x361 $ofile1 remap$R.nc
#STEP 4#
ofile2=$remapR.nc
echo "produce desired mesh"
cdo sellonlatbox,lon1,lon2,lat1,lat2 $ofile2 $grid.nc
#STEP 5#
ofile3=$grid.nc
echo "merge the files based on tstep"
cdo mergetime $ofile3 final$R.nc
步骤1和2,尽管它只是操纵进行,并改变它被列入该文件的一个.tar文件。
方法到目前为止给出的步骤1 & 2,但在步骤3期间,我不其中R是这样产生的不与在先前步骤中产生的其它混淆的附加结束得到新的文件作为remap$R.nc
。
后,我运行它,这是我所得到的
convert into .nc
cdo copy: Processed 987365376 values from 2 variables over 744 timesteps (234.66s)
re-format into structured grid 0.5x0.5
cdo remapbil: Processed 987365376 values from 2 variables over 744 timesteps (53.59s)
produce desired mesh
Error (cdo sellonlatbox) : Output file name .nc is equal to input file name on position 1!
merge the files based on tstep
cdo mergetime: Open failed on >.nc<
No such file or directory
我试图去想跟我的文件,但不知道我做错了,因为这个过程应该处理很多文件将其转换为每个阶段,我非常重视分配正确的和不同的fnames
。
如果你能看一看,并给我你的意见,我将不胜感激。
p.s. CDO是我使用的,所以你可以忽略它的代码,我的重点是过程本身
感谢
@Bushmils。我做了这种形式,以便在转换中为每个文件添加一个不同的结尾,然后将其用作下一组命令的输入文件 尽管我认为我弄糟了那部分,但我会改变它,跑。 – George
没有改变,但结果是 CDO sellonlatbox:打开失败上> .NC < 没有这样的文件或目录 合并基于TSTEP CDO mergetime文件:打开失败上> .NC < 没有这样的文件或目录 – George
“做了这种形式,以便为每个文件添加一个不同的结尾”我不明白。你没有给变量R分配任何东西,因此其内容未定义,或者你没有显示你分配的内容。 –