12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- #!/bin/bash
- ##### BASH:
- # - launch p_prep_obs slurm
- # prepare obs in observation.txt and observation.uf files
- # - creat dir in scratch
- # - copy exe + mask (=src dir) in scratch
- # - launch p_prep with input path/file.nc var tag_date
- #
- # 2024/06/17 A. Delhasse alison.delhasse@uclouvain.be
- #
- #########
- #SBATCH -n 1
- #SBATCH -t 00:10:00
- #SBATCH -J post_perturbation
- #SBATCH -o log/slurm_conversion-%j.out
- #SBATCH -e log/slurm_conversion-%j.err
- #SBATCH --partition=debug # Partition sur laquelle lancer le travail
- ##SBATCH --exclusive # Ressources exclusives
- #SBATCH --account=limhr # Compte associé au travail
- #SBATCH --mem-per-cpu=64000
- ### LOAD MODULES
- #module load Python/3.10.4-GCCcore-11.3.0
- module --force purge
- module load EasyBuild/2023a
- module load netCDF-Fortran/4.6.1-gompi-2023a
- module load Perl-bundle-CPAN/5.36.1-GCCcore-12.3.0
- module load ScaLAPACK/2.2.0-gompi-2023a-fb
- module load FFTW.MPI/3.3.10-gompi-2023a
- set -x
- set -e
- ## add read txt where obs are avail
- indir=/gpfs/scratch/acad/limhr/adelhass/obs/OSI-450-430-a/interpo
- outdir=/gpfs/scratch/acad/limhr/adelhass/obs/OSI-450-430-a/uf-siconc
- yb=1988
- ye=1988
- for year in $yb $ye; do
- for mm in `seq 1 12`; do
- #year=1990
- #month="02"
- ### upgrade with good date if not the 1sr of the month ??
- day='01'
- month=$(printf "%02d" $mm)
-
- tagdate=${year}${month}${day}
- #create scratch_conversion_uf_dir_${tagdate}
- rm -rf /gpfs/scratch/acad/limhr/adelhass/conversion_uf_${tagdate}
- mkdir /gpfs/scratch/acad/limhr/adelhass/conversion_uf_${tagdate}
- cd /gpfs/scratch/acad/limhr/adelhass/conversion_uf_${tagdate}
- cp -r ~/git/EnKF/src_conversion/* .
-
- ## test if file exist, else, skip the date
- if [ -f ${indir}/ice_conc_OSISAF-eORCA1_${tagdate}.nc ] ; then
- ## launch conversion itself
- ./prep_obs_ORCA1 ${indir}/ice_conc_OSISAF-eORCA1_${tagdate}.nc sic ${tagdate}
- cpt=0
- while [ ! -f observations.uf ] && [ ! -f observations.txt ] ; do
- cpt=$((cpt+1))
- sleep 20
- if [ ${cpt} -gt 10 ] ; then
- [ $? -ne 0 ] && exit 1
- fi
- done
- cp observations.txt ${outdir}/observations_${tagdate}.txt
- cp observations.uf ${outdir}/observations_${tagdate}.uf
-
- if [ ! -f ${outdir}/observations_${tagdate}.txt ] || [ ! -f ${outdir}/observations_${tagdate}.uf ] ; then
- echo "Something wrong ${outdir}/observations_${tagdate}.* don't exist! "
- exit 2
- else
- echo "conversion ${tagdate} DONE! and file in ${outdir}/observations_${tagdate}.*"
- echo "Remove tmp working dir /gpfs/scratch/acad/limhr/adelhass/conversion_uf_${tagdate} "
- rm -rf /gpfs/scratch/acad/limhr/adelhass/conversion_uf_${tagdate}
- fi
- else
- echo "File ${indir}/ice_conc_OSISAF-eORCA1_${tagdate}.nc doesn't exist, skip until next date."
- ### create an empty file "observations_${tagdate}_missing" in the output rep
- echo '' > ${outdir}/observations_${tagdate}_missing
- fi
- done #month
- done #year
|