#! /bin/csh -f
#
if ( $#argv == 6) then
  set inpcoo1 = $argv[1]
  set inpcoo2 = $argv[2]
  set regsiz = $argv[3]
  set outnam = $argv[4]
  set sl = $argv[5]
  set su = $argv[6]
else
  echo "Enter J2000 RA in format HHhMMmSSs or decimal degrees:"
  set inpcoo1 = $<
  echo "Enter J2000 Dec in format DDdMMmSSs: or decimal degrees"
  set inpcoo2 = $<
  echo "Enter region size (in degrees) for FITS image:"
  set regsiz = $<
  echo "Enter base name for output DSS FITS images:"
  set outnam = $<
  echo -n "Lower sigma limit for RGB stretch (recommended -1): "
  set sl = $<
  echo -n "Upper sigma limit for RGB stretch (recommended 5): "
  set su = $<
endif
#
# Create header
mHdr '"'"$inpcoo1 $inpcoo2 Equ J2000"'"' $regsiz $outnam\.hdr
echo mHdr -d '"'"$inpcoo1 $inpcoo2 Equ J2000"'"' $regsiz $outnam\.hdr
cat $outnam\.hdr
#
# Create B
echo "Processing...B"
mExec -d 1 -c -f $outnam\.hdr -o$outnam\-DSS2B DSS DSS2B $outnam\-DSS2B
#
# Create R
echo "Processing...R"
mExec -d 1 -c -f $outnam\.hdr -o$outnam\-DSS2R DSS DSS2R $outnam\-DSS2R
#
# Create IR
echo "Processing...IR"
mExec -d 1 -c -f $outnam\.hdr -o$outnam\-DSS2IR DSS DSS2IR $outnam\-DSS2IR
echo "Making RGB image from B,R,IR..."
#
# Create RGB jpg
mJPEG -red $outnam\-DSS2IR/mosaic.fits $sl\s $su\s -green $outnam\-DSS2R/mosaic.fits $sl\s $su\s -blue $outnam\-DSS2B/mosaic.fits $sl\s $su\s -out DSS2-BRIR.jpg
echo "Done!"

