Skip to content
Snippets Groups Projects
job_cdogrid.sbatch 753 B
Newer Older
Guillaume S's avatar
Guillaume S committed
#!/bin/bash
#SBATCH --job-name=cdogrid
#SBATCH --output=JOBS/%x-%j.out 
#SBATCH --qos=nf
#SBATCH --time=00:30:00
#SBATCH --gres=ssdtmp:10G
Guillaume S's avatar
Guillaume S committed

module purge
module load cdo/2.2.0
module list

set +xv

Guillaume S's avatar
Guillaume S committed
if [ -n "$1" ]; then pinp=$1; else exit 1; fi
if [ -n "$2" ]; then pout=$2; else exit 1; fi
Guillaume S's avatar
Guillaume S committed

Guillaume S's avatar
Guillaume S committed
time cp -av ${pinp} $TMPDIR/.
Guillaume S's avatar
Guillaume S committed
if [[ ${GRID:0:1} == "N" ]]; then
  cdo -v -t ecmwf -z zip -k grid -f nc4 -setgridtype,regular $TMPDIR/$(basename ${pinp}) $TMPDIR/$(basename ${pout})
elif [[ ${GRID:0:1} == "F" ]]; then
  cdo -v -t ecmwf -z zip -k grid -f nc4 copy $TMPDIR/$(basename ${pinp}) $TMPDIR/$(basename ${pout})
else
  echo "ERROR: ${GRID} grid unsupported"
  exit 1
fi
Guillaume S's avatar
Guillaume S committed
time mv -v $TMPDIR/$(basename ${pout}) ${pout}
Guillaume S's avatar
Guillaume S committed

exit 0