prepare_oce_ic.sh 741 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/bin/bash
  2. #
  3. set -xuve
  4. date
  5. grid=ORCA1L46
  6. expid=m01x
  7. src=/esnas/releases/ic/ocean/$grid/$expid
  8. dst=/esnas/releases/ic/ocean/$grid/$expid.new
  9. ref=/esnas/exp/MERCATOR/GLORYS2V1/restarts/ocean/$grid/restart_glorys2v1_oce_19930504_$grid.nc
  10. tmpdir=/scratch/masif
  11. mkdir -p $dst
  12. list=$PWD/$expid
  13. if [[ ! -a ${list} ]]; then
  14. ls -1 $src | cut -d '.' -f 1 | sort | uniq >> $list
  15. fi
  16. tmp=$tmpdir/prepare_oce_ic_$expid
  17. rm -rf $tmp
  18. mkdir -p $tmp
  19. cd $tmp
  20. for l in $(cat $list); do
  21. cp -p $src/$l.nc.gz .
  22. gunzip $l.nc.gz
  23. ncwa -O -a t $l.nc $l.nc # removing t
  24. ncks -A -v z $ref $l.nc # appending z from ref.
  25. gzip -9 -f $l.nc
  26. mv $l.nc.gz $dst
  27. cat ${list} | sed -e '1d' > ${list}.tmp
  28. mv ${list}.tmp ${list}
  29. done
  30. rm ${list}
  31. cd; rm -rf $tmp
  32. date