#!/bin/bash function get_grid() { GRID=$1 if [ -f $GRID ]; then echo "Grid file $GRID is already there." else FILE=$2 rm -f $FILE # wget "http://www2.mmm.ucar.edu/projects/mpas/atmosphere_meshes/$FILE" scp ${user}@forge.ipsl.fr:/home/dubos/grids/$FILE . && tar xzf $FILE $GRID fi } echo "Usage : get_MPAS_grids.sh username SIZE1 SIZE2 ..." echo "where username is your username on forge.ipsl.fr ;" echo "optional arguments SIZEx are among : x1.163842 x1.655362 x1.2621442 x1.5898242 x4.163842" echo "By default, download small meshes for sizes 2562 10242 40962" user=$1 ; shift SIZES="x1.2562 x1.10242 x1.40962 x4.163842 $*" cd grids for SIZE in $SIZES ; do get_grid "$SIZE.grid.nc" "$SIZE.tar.gz" done