#!/bin/sh
set -e
# For some fields they should be positive definite but may be negative
# due to numerical issues.  This script just sets points less than
# zero to zero.

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

access inp ${pfx}_${inp}

# Convert from DATA TO GRID
echo "C*RELABL   DATA
C*         GRID" | ccc relabl inp x

echo "C* FMSKPLT        -1 NEXT   GT        0.    1        0.    1" | ccc fmskplt x ${pfx}_${out}

release inp x

