setupanalysis.sh 872 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  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 2 ] && { echo "No base file name and target supplied" ; exit 1 ;}
  5. # HYCOM files
  6. if ! ls ${1}[0-9][0-9][0-9].[ab] > /dev/null ; then
  7. echo "Could not find files with base $1"
  8. exit 1
  9. fi
  10. #ls ${1}[0-9][0-9][0-9].[ab]
  11. for i in ${1}[0-9][0-9][0-9].[ab] ; do
  12. numpart=$(echo $i | sed "s/.*$1//" | sed "s/\..*//")
  13. abpart=$(echo $i | sed "s/.*\.//")
  14. #echo $i $numpart $abpart
  15. if [ $numpart -gt 1 ] ; then
  16. #echo "yes"
  17. tailpart="_mem$numpart.$abpart"
  18. else
  19. tailpart=".$abpart"
  20. fi
  21. newfile=${2}$tailpart
  22. echo "$newfile -> $i"
  23. ln -sf $i $newfile
  24. done
  25. # Ice file
  26. if [ -f ${1}ICE.uf ] ; then
  27. finalname=${2}ICE.uf
  28. echo "$finalname -- > ${1}ICE.uf "
  29. ln -sf ${1}ICE.uf $finalname ;
  30. fi