prepare_atm_perturb.cmd 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/ksh
  2. #
  3. #@ shell = /usr/bin/ksh
  4. #@ class = ns
  5. #@ job_type = serial
  6. #@ job_name = prepare_atm_perturb
  7. #@ output = $(job_name).$(jobid).log
  8. #@ error = $(job_name).$(jobid).log
  9. #@ notification = error
  10. #@ resources = ConsumableCpus(1) ConsumableMemory(1200mb)
  11. #@ wall_clock_limit = 24:00:00
  12. #@ queue
  13. #
  14. set -xuve
  15. date
  16. tar="/opt/freeware/bin/tar"
  17. grid=T255L91
  18. expid=e00l
  19. src=ec:/c3l/errfiles/$expid
  20. dst=ec:/c3m/perturb/atmos/$grid/$expid
  21. cup=$(pwd)
  22. list=$cup/$expid
  23. # Gather the list of original perturb files
  24. if [[ ! -a ${list} ]]; then
  25. emkdir -p $dst
  26. els -1 $src/* | cut -d '_' -f 4 | cut -d '.' -f 1 | sort | uniq >> $list
  27. fi
  28. tmp=$TMPDIR/prepare_atm_perturb_$expid
  29. rm -rf $tmp
  30. mkdir -p $tmp
  31. cd $tmp
  32. # Prepare and store the perturb file after reformatting properly
  33. for l in $(cat $list); do
  34. ecp $src/??_inierr_${expid}_${l}.grb .
  35. $tar -cvzf ${expid}_${l}.tar.gz ??_inierr_${expid}_${l}.grb
  36. emv ${expid}_${l}.tar.gz $dst
  37. rm -f ??_inierr_${expid}_${l}.grb
  38. cat ${list} | sed -e '1d' > ${list}.tmp
  39. mv ${list}.tmp ${list}
  40. done
  41. rm ${list}
  42. cd; rm -rf $tmp
  43. date