WRF后处理的一些常用操作

  • 重命名。将输出文件批量添加nc的后缀。
    for i in *
    do mv $i $i".nc"
    done
  • 批量转移数据。
    判断文件是否存在,若存在,则转移到其他文件夹。
wrfr_path="/path_users/Build_WRF/WRF-4.2.2/run/"
wrfo_path="/path_users//wrfout/"
wlog_path="/path_users//wrflog/"

filesrsl=$(ls ${wrfr_path}rsl.out*    2> /dev/null | wc -l)
filesrer=$(ls ${wrfr_path}rsl.error*  2> /dev/null | wc -l)
fileswot=$(ls ${wrfr_path}wrfout_d0*  2> /dev/null | wc -l)
  
if [ "$filesrsl" != "0" ]; then
mv -f ${wrfr_path}rsl.out.00* ${wlog_path}
else
echo $'rsl.out.* files don\'t exist'
fi
  
if [ "$filesrer" != "0" ]; then
mv -f ${wrfr_path}rsl.error* ${wlog_path}
else
echo $'rsl.error.* files don\'t exist'
fi
  
if [ "$fileswot" != "0" ]; then
mv -f ${wrfr_path}wrfout_d0*  ${wrfo_path}
else
echo $'wrfout_d0* files don\'t exist'
fi

As a side note,
echo打印单引号的用法:

echo  $'Zhangsan doesn\'t exist'

相关参考:

https://blog.csdn.net/lydawen/article/details/83489461
https://beijingngcc.blog.csdn.net/article/details/106975622

你可能感兴趣的:(WRF,linux)