poi2png.sh 1.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
#!/bin/bash

EWPATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../utils" && pwd )"
SSHFILE=eWave.poi.summary
FONT=$EWPATH/FreeMonoBold.ttf

while test $# -gt 0; do
  case "$1" in
    -h|--help)
	echo ""
	echo "Usage: poi2png.cmd poi-filename"
	echo "   e.g., poi2png.cmd poiIndonesia.poi"
	exit 0
        ;;
    -grd)
        shift
        if test $# -gt 0; then
       	  f=$1  
        else
          echo "Error: no grid specified."
          exit 1
        fi
        shift
        ;;
    *)
	break
	;;
  esac
done

# Check command line parameters
if [ $# -eq 1 ]; then
  POIFILE=$1
else
  echo "Error: no poi file specified."
  exit 1
fi

# Check number of grd-files in current directory
# We assume presence of a single grd -- bathymetry
ngrids=0
if test "$f" = ""; then
  for f in *.grd
  do
    let ngrids+=1
  done
  if [ $ngrids -gt 1 ]; then
    echo "More than one grid. Do not know which one to use!"
    exit 2
  fi
fi

# Execute converter
$EWPATH/poi2png -grdB $f -palB $EWPATH/topo4sshmaxBW.cpt -poi $POIFILE -ssh $SSHFILE -levels 0.1 0.5 3.0 -font $FONT