#! /bin/csh


if ($#argv != 3) then
	echo "usage: $0 stem incInSec oDir"
	echo "  example: $0 w140n90 6 .."
	exit
endif 

set stem		= $1 ;	shift
set incInSec	= $1 ;	shift
set oDir		= $1 ;	shift

# grdmath \
# 	$oDir/srtm/grd/$stem.$incInSec.grd \
# 	$oDir/grd/$stem.Bathymetry.grd \
# 	AND \
# 	= $oDir/grd/$stem.Bathymetry.srtm.grd

set inc = `echo $incInSec | awk '{ printf "-I%sc\n", $1 }'`
# grdsample -V -T $inc ../../SRTM30+V7/srtm/grd/$stem.grd -G$oDir/tmp/`basename $0`.$stem.srtm.$incInSec.grd
# FIXME: if the -R is NOT an even multiple of "inc" then -R gets tweaked in polished, so tweak landmask to match
# grdedit -R$oDir/grd/$stem.Bathymetry.grd $oDir/tmp/`basename $0`.$stem.srtm.$incInSec.grd

grdmath \
	$oDir/srtm/grd/$stem.grd \
	$oDir/grd/$stem.Bathymetry.grd \
	AND \
	= $oDir/grd/$stem.Bathymetry.srtm.grd

exit

grdmath \
	$oDir/tmp/`basename $0`.$stem.srtm.$incInSec.grd \
	$oDir/grd/$stem.Bathymetry.grd \
	AND \
	= $oDir/grd/$stem.Bathymetry.srtm.grd

exit
