#!/bin/sh
set -e
# 1. change the signs of the wind stress
# 2. mask wind stress to only leave sea ice area when GC > 0.5;
# 3. inp1: wind stress; inp2: gc.

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

pfx=$1
inp1=$2
inp2=$3
out=$4

access inp1 ${pfx}_${inp1}
access inp2 ${pfx}_${inp2}

echo "                 -1." | ccc xlin inp1 inp3
echo "C* FMSKPLT        -1 NEXT   GT       0.5                   1" | ccc fmskplt inp3 ${pfx}_${out} inp2

release inp1 inp2
rm -f inp3
