prepare_atm_ic_i05f.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #!/bin/bash
  2. # -----------------------------------------------------------------
  3. # Description: Short script to merge atmospheric intial conditions
  4. # with a re-run of ERA-Land analysis. This script has
  5. # been used to create the initial conditions i05f.
  6. #
  7. # Date: 7.8.2012
  8. #
  9. # Author: Omar Bellprat (omar.bellprat@ic3.cat)
  10. #
  11. #-------------------------------------------------------------------
  12. indir='/esnas/releases/ic/atmos/T511L91' # Dir of initical conditions (ic)
  13. landdir='/esnas/releases/ic/atmos/T511L91/g53m' # Dir of ERA-Land analysis
  14. refic='b0it' # ERA-Interim ic's
  15. newic='i05f' # New atmospheric ic's using land parameters from g53m
  16. smonths=("05" "11") # Start dates (May,Nov)
  17. param="32.128/33.128/39.128/40.128/41.128/42.128/139.128/141.128/170.128/183.128/235.128/236.128/238.128" # List of parameters from ERA-Land
  18. param=("asn/rsn/swvl1/swvl2/swvl3/swvl4/stl1/sd/stl2/stl3/skt/stl4/tsn") # Short Names of parameters
  19. tmpdir='/scratch/${USER}/tmp'
  20. if [ ! -d "${tmpdir}" ]; then
  21. mkdir -p ${tmpdir}
  22. fi
  23. if [ ! -d "${indir}/${newic}" ]; then
  24. mkdir -p ${indir}/${newic}
  25. fi
  26. cd ${tmpdir}
  27. for i in $(seq 1993 2009) # Time window of ic's
  28. do
  29. echo 'GRIB copying year' ${i}
  30. for f in $(seq 0 9)
  31. do
  32. echo 'GRIB copying member fc'${f}
  33. for j in "${smonths[@]}"
  34. do
  35. rm ${tmpdir}/*
  36. tar -xf ${indir}/${refic}/${refic}_fc${f}_${i}${j}0100.tar.gz -C .
  37. grib_copy -w shortName!=$param ICMGGXXXXINIT ICMGGXXXXINIT_noland # Copy atmosperhic fields excluding land parameters
  38. cat ${landdir}/land_ini-gr3m_${i}${j}01.grb >> ICMGGXXXXINIT_noland # Concatenate new land parameters to original ic's
  39. mv ICMGGXXXXINIT_noland ICMGGXXXXINIT
  40. tar -zcvf ${indir}/${newic}/${newic}_fc${f}_${i}${j}0100.tar.gz ICM*
  41. done
  42. done
  43. done
  44. rm -r ${tmpdir}