convert.bash 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #! /bin/bash
  2. #
  3. # François Massonnet
  4. # April 2016
  5. # Conversion of NetCDF to "UF" format (that the ensemble
  6. # Kalman filter can read and treat).
  7. #
  8. # This uses a Fortran executable called prep_obs_${resolution}
  9. # where resolution is either ORCA1 or ORCA25
  10. #
  11. # DON'T FORGET TO SOURCE THE RIGHT modules (source ../enkf_modules_to_load.txt)
  12. #
  13. # NOTE THAT TWO INSTANCES OF THIS SCRIPT CAN'T RUN AT THE SAME TIME
  14. # (a temporary observation.uf file is produced)
  15. set -o nounset
  16. set -o errexit
  17. echo ""
  18. echo "?DID YOU SOURCE THE RIGHT MODULES FIRST?"
  19. echo "source ../enkf_modules_to_load.txt"
  20. echo ""
  21. sleep 2
  22. yearb=2000
  23. yeare=2017
  24. resolution=ORCA1 # ORCA1 or ORCA25
  25. product=osisaf # osisaf or esa
  26. rootdir=/gpfs/projects/bsc32/repository/enkf/${product}_sic/netcdf/
  27. for year in `seq $yearb $yeare`
  28. do
  29. for file in `ls ${rootdir}/at_i_OSISAF-${resolution}_${year}????.nc`
  30. do
  31. tag=`basename $file | sed -e "s/at_i_OSISAF-${resolution}_//" -e "s/.nc//"`
  32. echo $tag
  33. ./prep_obs_${resolution} $file sic $tag
  34. mv observations.uf ${rootdir}/../uf/observations-${resolution}_${tag}.uf
  35. mv observations.txt ${rootdir}/../txt/observations-${resolution}_${tag}.txt
  36. done
  37. done