setupforecast.sh 841 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. #KAL -- This script sets up the forecast for the EnKF. Input
  3. #KAL -- is the "base" of the analysis file name
  4. [ $# -ne 1 ] && { echo "No base file name supplied" ; exit 1 ;}
  5. # HYCOM files
  6. if ! ls ${1}.[ab] > /dev/null || ! ls ${1}_mem???.[ab] > /dev/null ; then
  7. echo "Could not find files with base $1"
  8. exit 1
  9. fi
  10. for i in ${1}.[ab] ${1}_mem???.[ab] ; do
  11. tailpart1=$(echo $i | tail -c9 )
  12. tailpart2=$(echo $i | tail -c9 | cut -c1-3)
  13. post=$(echo $i | sed "s/.*\.//")
  14. if [ ! "$tailpart2" == "mem" ] ; then
  15. tailpart1="mem001.${post}"
  16. fi
  17. finalname=$( echo $tailpart1 | sed "s/mem/forecast/")
  18. echo "$finalname -- > $i"
  19. ln -s $i $finalname
  20. done
  21. # Ice file
  22. if [ -f ${1}ICE.uf ] ; then
  23. finalname=forecastICE.uf
  24. echo "$finalname -- > ${1}ICE.uf"
  25. ln -s ${1}ICE.uf forecastICE.uf ;
  26. fi