#!/bin/sh
set -e
# compute area of atmospheric grid cells in m^2

if [ $# -ne 3 ] ; then
  echo "Error in $0: invalid number of arguments $#"
  exit 1
fi

pfx=$1
inp=$2
out=$3

release inp
access  inp  ${pfx}_${inp}

echo "C*MKWGHT     48    1   96    1   480 1  0" | ccc mkwght wght
echo "C*XLIN    5100996991" | ccc xlin wght wght1
echo "C*XLIN          1.E5" | ccc xlin wght1 ${pfx}_${out}
release inp wght wght1
