#!/bin/csh -f

if ($#argv != 2) then
  echo "USAGE: 00_chips.cmd (label) [commit]"
  exit 2
endif

set label = $1
if ("$2" == "commit") then
  set pretend = ""
else
  set pretend = "-pretend"
endif

set common_opts = ""
set common_opts = "$common_opts -dbname gpc1"
set common_opts = "$common_opts -definebyquery"
set common_opts = "$common_opts -obs_mode SAS2"
set common_opts = "$common_opts -set_label $label"
set common_opts = "$common_opts -set_data_group $label"
set common_opts = "$common_opts -set_end_stage warp"
set common_opts = "$common_opts -set_tess_id RINGS.V3"
set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
set common_opts = "$common_opts -simple -set_dist_group SAS"

set common_opts = "$common_opts -dateobs_begin 2011-07-03T00:00:00"
set common_opts = "$common_opts -dateobs_end 2011-07-06T23:59:59"

set common_opts = "$common_opts -set_reduction LAP_SCIENCE"

chiptool $pretend $common_opts -filter g.00000
chiptool $pretend $common_opts -filter i.00000
chiptool $pretend $common_opts -filter r.00000
chiptool $pretend $common_opts -filter y.00000
chiptool $pretend $common_opts -filter z.00000
