download_ic.sh 612 B

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. # Before downloading; the ic's should be well prepared at ECMWF's CCA.
  3. # nohup ./download_ic.sh atmos T255L62 b0ga >& download.log &
  4. # nohup ./download_ic.sh ocean ORCA1 fa9p >& download.log &
  5. #
  6. set -xuve
  7. date
  8. typ=$1
  9. grd=$2
  10. ver=$3
  11. src=ec:/c3m/ic/$typ/$grd/$ver
  12. dst=/esnas/releases/ic/$typ/$grd/$ver
  13. mkdir -p $dst
  14. list=${typ}-${grd}-${ver}
  15. if [[ ! -a $list ]]; then
  16. ecaccess-file-dir $src > $list
  17. fi
  18. for l in $(cat $list); do
  19. ecaccess-file-get $src/$l $dst/$l
  20. if [[ $? -ne 0 ]]; then
  21. exit 1
  22. fi
  23. cat $list | sed -e '1d' > ${list}.tmp
  24. mv ${list}.tmp $list
  25. done
  26. cat $list; rm $list
  27. date