Index: trunk/tools/eam/reprocess/SAS.2014/00_chips.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.2014/00_chips.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.2014/00_chips.cmd	(revision 40818)
@@ -0,0 +1,33 @@
+#!/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"
+
+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
Index: trunk/tools/eam/reprocess/SAS.2014/01_stacks.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.2014/01_stacks.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.2014/01_stacks.cmd	(revision 40818)
@@ -0,0 +1,32 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 01_stacks.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 -select_label $label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+set common_opts = "$common_opts -min_num 4"
+
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+
+set common_opts = "$common_opts  -set_reduction THREEPI_STACK_1DG"
+
+stacktool $pretend $common_opts -select_filter g.00000
+stacktool $pretend $common_opts -select_filter r.00000
+stacktool $pretend $common_opts -select_filter i.00000
+stacktool $pretend $common_opts -select_filter z.00000
+stacktool $pretend $common_opts -select_filter y.00000
Index: trunk/tools/eam/reprocess/SAS.2014/02_ssky.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.2014/02_ssky.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.2014/02_ssky.cmd	(revision 40818)
@@ -0,0 +1,58 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 02_ssky.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 -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_label $label"
+set common_opts = "$common_opts -ra_min 320"
+set common_opts = "$common_opts -ra_max 340"
+set common_opts = "$common_opts -simple"
+
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000
+staticskytool $pretend $common_opts  -select_filter r.00000
+staticskytool $pretend $common_opts  -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter y.00000
Index: trunk/tools/eam/reprocess/SAS.2014/03_skycal.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.2014/03_skycal.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.2014/03_skycal.cmd	(revision 40818)
@@ -0,0 +1,26 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 03_skycal.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 -defineskycalrun"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_label $label"
+set common_opts = "$common_opts -simple"
+
+staticskytool $pretend $common_opts
Index: trunk/tools/eam/reprocess/SAS.2014/04_dist.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.2014/04_dist.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.2014/04_dist.cmd	(revision 40818)
@@ -0,0 +1,17 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 04_dist.cmd (label) [commit]"
+  exit 2
+endif
+
+set label = $1
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "--pretend"
+endif
+
+set today = `date +%Y%m%d`
+
+dist_defineruns.pl --verbose --no_magic --dbname gpc1 $pretend --label $label --workdir neb://@HOST@.0/gpc1/dist/$label/$today
Index: trunk/tools/eam/reprocess/SAS.2014/05_fforce.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.2014/05_fforce.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.2014/05_fforce.cmd	(revision 40818)
@@ -0,0 +1,29 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 03_skycal.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 -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -select_warp_label $label"
+set common_opts = "$common_opts -select_skycal_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_good_frac_min 0.05"
+
+set common_opts = "$common_opts -simple"
+
+fftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/SAS.2014/06_diff.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.2014/06_diff.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.2014/06_diff.cmd	(revision 40818)
@@ -0,0 +1,31 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 06_diff.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 -definewarpstack"
+set common_opts = "$common_opts -available"
+set common_opts = "$common_opts -set_reduction WARPSTACK"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -warp_label $label"
+set common_opts = "$common_opts -stack_label LAP.ThreePi.20120706"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+set common_opts = "$common_opts -good_frac 0.2"
+set common_opts = "$common_opts -simple"
+
+echo $common_opts
+
+difftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/SAS.2014/dist.txt
===================================================================
--- trunk/tools/eam/reprocess/SAS.2014/dist.txt	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.2014/dist.txt	(revision 40818)
@@ -0,0 +1,24 @@
+
+SELECT DISTINCT
+    'chip' as stage,
+    chipRun.chip_id as stage_id,
+    chipRun.magicked,
+    rawExp.exp_name as run_tag,
+    chipRun.label,
+    chipRun.data_group,
+    chipRun.dist_group,
+ distTarget.target_id,
+    distTarget.clean
+FROM chipRun
+JOIN rawExp USING(exp_id)
+JOIN distTarget ON distTarget.stage = 'chip'
+    AND chipRun.dist_group = distTarget.dist_group 
+    AND rawExp.filter = distTarget.filter
+JOIN rcInterest USING(target_id)
+LEFT JOIN distRun ON distRun.stage_id = chipRun.chip_id
+    AND distRun.target_id = distTarget.target_id
+WHERE distTarget.state = 'enabled'
+    AND rcInterest.state = 'enabled'
+    AND rcInterest.state = 'enabled'
+    AND ((chipRun.state = 'full') OR (distTarget.clean AND chipRun.state = 'cleaned'))
+    AND (chipRun.label = 'SAS.20140614.pv3cr') AND (distRun.dist_id IS NULL)
Index: trunk/tools/eam/reprocess/SAS.40/00_chips.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.40/00_chips.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.40/00_chips.cmd	(revision 40818)
@@ -0,0 +1,33 @@
+#!/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"
+
+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
Index: trunk/tools/eam/reprocess/SAS.40/01_stacks.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.40/01_stacks.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.40/01_stacks.cmd	(revision 40818)
@@ -0,0 +1,32 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 01_stacks.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 -select_label $label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+set common_opts = "$common_opts -min_num 4"
+
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+
+set common_opts = "$common_opts  -set_reduction THREEPI_STACK_1DG"
+
+stacktool $pretend $common_opts -select_filter g.00000
+stacktool $pretend $common_opts -select_filter r.00000
+stacktool $pretend $common_opts -select_filter i.00000
+stacktool $pretend $common_opts -select_filter z.00000
+stacktool $pretend $common_opts -select_filter y.00000
Index: trunk/tools/eam/reprocess/SAS.40/02_ssky.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.40/02_ssky.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.40/02_ssky.cmd	(revision 40818)
@@ -0,0 +1,58 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 02_ssky.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 -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_label $label"
+set common_opts = "$common_opts -ra_min 320"
+set common_opts = "$common_opts -ra_max 340"
+set common_opts = "$common_opts -simple"
+
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000
+staticskytool $pretend $common_opts  -select_filter r.00000
+staticskytool $pretend $common_opts  -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter y.00000
Index: trunk/tools/eam/reprocess/SAS.40/03_skycal.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.40/03_skycal.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.40/03_skycal.cmd	(revision 40818)
@@ -0,0 +1,26 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 03_skycal.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 -defineskycalrun"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_label $label"
+set common_opts = "$common_opts -simple"
+
+staticskytool $pretend $common_opts
Index: trunk/tools/eam/reprocess/SAS.40/04_dist.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.40/04_dist.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.40/04_dist.cmd	(revision 40818)
@@ -0,0 +1,17 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 04_dist.cmd (label) [commit]"
+  exit 2
+endif
+
+set label = $1
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "--pretend"
+endif
+
+set today = `date +%Y%m%d`
+
+dist_defineruns.pl --verbose --no_magic --dbname gpc1 $pretend --label $label --workdir neb://@HOST@.0/gpc1/dist/$label/$today
Index: trunk/tools/eam/reprocess/SAS.40/05_fforce.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.40/05_fforce.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.40/05_fforce.cmd	(revision 40818)
@@ -0,0 +1,29 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 03_skycal.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 -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -select_warp_label $label"
+set common_opts = "$common_opts -select_skycal_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_good_frac_min 0.05"
+
+set common_opts = "$common_opts -simple"
+
+fftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/SAS.40/06_diff.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.40/06_diff.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.40/06_diff.cmd	(revision 40818)
@@ -0,0 +1,31 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 06_diff.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 -definewarpstack"
+set common_opts = "$common_opts -available"
+set common_opts = "$common_opts -set_reduction WARPSTACK"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -warp_label $label"
+set common_opts = "$common_opts -stack_label LAP.ThreePi.20120706"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+set common_opts = "$common_opts -good_frac 0.2"
+set common_opts = "$common_opts -simple"
+
+echo $common_opts
+
+difftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/SAS.40/06_diff2.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.40/06_diff2.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.40/06_diff2.cmd	(revision 40818)
@@ -0,0 +1,31 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 06_diff.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 -definewarpstack"
+set common_opts = "$common_opts -available"
+set common_opts = "$common_opts -set_reduction WARPSTACK_PV3"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -warp_label SAS.20151104"
+set common_opts = "$common_opts -stack_label LAP.PV3.20140730.final"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+set common_opts = "$common_opts -good_frac 0.2"
+set common_opts = "$common_opts -simple"
+
+echo $common_opts
+
+difftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/SAS.40/dist.txt
===================================================================
--- trunk/tools/eam/reprocess/SAS.40/dist.txt	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.40/dist.txt	(revision 40818)
@@ -0,0 +1,24 @@
+
+SELECT DISTINCT
+    'chip' as stage,
+    chipRun.chip_id as stage_id,
+    chipRun.magicked,
+    rawExp.exp_name as run_tag,
+    chipRun.label,
+    chipRun.data_group,
+    chipRun.dist_group,
+ distTarget.target_id,
+    distTarget.clean
+FROM chipRun
+JOIN rawExp USING(exp_id)
+JOIN distTarget ON distTarget.stage = 'chip'
+    AND chipRun.dist_group = distTarget.dist_group 
+    AND rawExp.filter = distTarget.filter
+JOIN rcInterest USING(target_id)
+LEFT JOIN distRun ON distRun.stage_id = chipRun.chip_id
+    AND distRun.target_id = distTarget.target_id
+WHERE distTarget.state = 'enabled'
+    AND rcInterest.state = 'enabled'
+    AND rcInterest.state = 'enabled'
+    AND ((chipRun.state = 'full') OR (distTarget.clean AND chipRun.state = 'cleaned'))
+    AND (chipRun.label = 'SAS.20140614.pv3cr') AND (distRun.dist_id IS NULL)
Index: trunk/tools/eam/reprocess/SAS.41/00_chips.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.41/00_chips.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.41/00_chips.cmd	(revision 40818)
@@ -0,0 +1,35 @@
+#!/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
Index: trunk/tools/eam/reprocess/SAS.41/01_stacks.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.41/01_stacks.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.41/01_stacks.cmd	(revision 40818)
@@ -0,0 +1,32 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 01_stacks.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 -select_label $label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+set common_opts = "$common_opts -min_num 4"
+
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+
+set common_opts = "$common_opts  -set_reduction THREEPI_STACK_1DG"
+
+stacktool $pretend $common_opts -select_filter g.00000
+stacktool $pretend $common_opts -select_filter r.00000
+stacktool $pretend $common_opts -select_filter i.00000
+stacktool $pretend $common_opts -select_filter z.00000
+stacktool $pretend $common_opts -select_filter y.00000
Index: trunk/tools/eam/reprocess/SAS.41/02_ssky.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.41/02_ssky.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.41/02_ssky.cmd	(revision 40818)
@@ -0,0 +1,58 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 02_ssky.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 -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_label $label"
+set common_opts = "$common_opts -ra_min 320"
+set common_opts = "$common_opts -ra_max 340"
+set common_opts = "$common_opts -simple"
+
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000
+staticskytool $pretend $common_opts  -select_filter r.00000
+staticskytool $pretend $common_opts  -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter y.00000
Index: trunk/tools/eam/reprocess/SAS.41/03_skycal.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.41/03_skycal.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.41/03_skycal.cmd	(revision 40818)
@@ -0,0 +1,26 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 03_skycal.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 -defineskycalrun"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_label $label"
+set common_opts = "$common_opts -simple"
+
+staticskytool $pretend $common_opts
Index: trunk/tools/eam/reprocess/SAS.41/04_dist.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.41/04_dist.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.41/04_dist.cmd	(revision 40818)
@@ -0,0 +1,17 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 04_dist.cmd (label) [commit]"
+  exit 2
+endif
+
+set label = $1
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "--pretend"
+endif
+
+set today = `date +%Y%m%d`
+
+dist_defineruns.pl --verbose --no_magic --dbname gpc1 $pretend --label $label --workdir neb://@HOST@.0/gpc1/dist/$label/$today
Index: trunk/tools/eam/reprocess/SAS.41/05_fforce.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.41/05_fforce.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.41/05_fforce.cmd	(revision 40818)
@@ -0,0 +1,29 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 03_skycal.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 -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -select_warp_label $label"
+set common_opts = "$common_opts -select_skycal_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_good_frac_min 0.05"
+
+set common_opts = "$common_opts -simple"
+
+fftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/SAS.41/06_diff.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.41/06_diff.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.41/06_diff.cmd	(revision 40818)
@@ -0,0 +1,31 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 06_diff.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 -definewarpstack"
+set common_opts = "$common_opts -available"
+set common_opts = "$common_opts -set_reduction WARPSTACK_PV3"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -warp_label $label" 
+set common_opts = "$common_opts -stack_label LAP.PV3.20140730.final"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+set common_opts = "$common_opts -good_frac 0.2"
+set common_opts = "$common_opts -simple"
+
+echo $common_opts
+
+difftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/SAS.41/06a_diff_internal.cmd
===================================================================
--- trunk/tools/eam/reprocess/SAS.41/06a_diff_internal.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.41/06a_diff_internal.cmd	(revision 40818)
@@ -0,0 +1,31 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 06_diff.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 -definewarpstack"
+set common_opts = "$common_opts -available"
+set common_opts = "$common_opts -set_reduction WARPSTACK_PV3"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/SAS.20151208.internal"
+set common_opts = "$common_opts -set_label SAS.20151208.internal"
+set common_opts = "$common_opts -warp_label $label" 
+set common_opts = "$common_opts -stack_label $label"
+set common_opts = "$common_opts -set_data_group SAS.20151208.20160119"
+set common_opts = "$common_opts -set_dist_group SAS"
+set common_opts = "$common_opts -good_frac 0.2"
+set common_opts = "$common_opts -simple"
+
+echo $common_opts
+
+difftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/SAS.41/README
===================================================================
--- trunk/tools/eam/reprocess/SAS.41/README	(revision 40818)
+++ trunk/tools/eam/reprocess/SAS.41/README	(revision 40818)
@@ -0,0 +1,45 @@
+README for run SAS41 -- 
+
+-- check reduction in scripts
+
+-- need to match processing user w/ tag used for LAP.PV3 
+--> ch/cam/wrp -- ipplanl/psconfig/ipp-pv3-20140717.lin64
+--> stk -- ipplanl/psconfig/ipp-pv3-20140717.lin64
+--> ss/sc -- ippsky/psconfig/ipp-trunk-20150624.lin64
+--> ff -- ippsky/psconfig/ipp-20150329.lin64 
+--> diff -- ipptest/psconfig/ipp-20150312.lin64
+
+-- manually add label to ippMonitor and restart czarPoll
+~ipp/src/ippMonitor/czartool/czartool/CzarDb.pm
+
+-- chip/cam/warp -- ~ipplanl/stdsas
+
+./00_chips.cmd SAS.20151208 commit
+
+-- stack -- ~ipplanl/stdsas
+
+./01_stacks.cmd SAS.20151208 commit
+ 
+-- ss -- ~ippsky/ss_sc_ffsas -- want new pantasks for logs
+
+./02_ssky.cmd SAS.20151208 commit
+
+-- skycal ~ippsky/ss_sc_ffsas
+
+./03_skycal.cmd SAS.20151208 commit
+
+-- fforce -- ~ippsky/ss_sc_ffsas
+
+./05_fforce.cmd SAS.20151208 commit
+
+-- diff -- ~ipptest/diffsas
+
+./06_diff.cmd SAS.20151208 commit
+
+
+
+
+
+
+
+
Index: trunk/tools/eam/reprocess/euclid.md.20180925/run.addtool
===================================================================
--- trunk/tools/eam/reprocess/euclid.md.20180925/run.addtool	(revision 40818)
+++ trunk/tools/eam/reprocess/euclid.md.20180925/run.addtool	(revision 40818)
@@ -0,0 +1,102 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: run.addtool (field) [commit]"
+  exit 2
+endif
+
+set field = $1
+
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+set in_label = "EUCLID.$field.PV0.FF1.V1"
+set outlabel = "EUCLID.$field.PV0.FFW.V3"
+set outdvo   = "EUCLID.$field.PV0.FFW.V3"
+
+# V1 failed due to not closing the file handles
+# V2 failed due to too many inputs (?)
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -definebyquery"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/euclid/$field/$outlabel"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+
+set common_opts = "$common_opts -stage fullforce"
+set common_opts = "$common_opts -uncensored"
+
+set common_opts = "$common_opts -set_dvodb $outdvo"
+
+set common_opts = "$common_opts -set_minidvodb_name  $outlabel"
+set common_opts = "$common_opts -set_minidvodb_group $outlabel"
+
+set common_opts = "$common_opts -label $in_label"
+
+set common_opts = "$common_opts -simple"
+
+# set common_opts = "$common_opts -trace db 10"
+
+if (0) then
+  # first: 
+  # addtool -addminidvodbrun
+  addtool -dbname gpc1 -addminidvodbrun -set_minidvodb_group $outlabel -set_minidvodb_name $outlabel -set_minidvodb_path /data/ipp121.0/ipptest/euclid.20181118.$field.ffw
+endif
+
+if (1) then
+  addtool $pretend $common_opts
+
+  # the below concept failed; needed to push the limits into addstar_multi_run.pl
+
+  # addstar loads the N exposures worth of data for a given skycell.  
+  # Within addstar, the stars are matched using the same algorithm
+  # used by DVO.  This match process gets slower and slower as the number 
+  # of input exposures increases.  It is more efficient to limit the 
+  # input exposures and rely on the match within DVO (I think).  Here,
+  # I am trying groups of 30 for i & z and 50 for g & r
+
+  ## # g-band : 266 exposures; 45 each -> need 6 passes
+  ## addtool $pretend $common_opts -filter g.00000 -limit 45
+  ## addtool $pretend $common_opts -filter g.00000 -limit 45
+  ## addtool $pretend $common_opts -filter g.00000 -limit 45
+  ## addtool $pretend $common_opts -filter g.00000 -limit 45
+  ## addtool $pretend $common_opts -filter g.00000 -limit 45
+  ## addtool $pretend $common_opts -filter g.00000 -limit 45
+  ## 
+  ## # r-band : 133 exposures; 45 each -> need 3 passes
+  ## addtool $pretend $common_opts -filter r.00000 -limit 45
+  ## addtool $pretend $common_opts -filter r.00000 -limit 45
+  ## addtool $pretend $common_opts -filter r.00000 -limit 45
+  ## 
+  ## # i-band : 52 exposures; 26 each -> need 2 passes
+  ## addtool $pretend $common_opts -filter i.00000 -limit 26
+  ## addtool $pretend $common_opts -filter i.00000 -limit 26
+
+  # z-band : 52 exposures; 26 each -> need 2 passes
+  # addtool $pretend $common_opts -filter z.00000 -limit 26
+  # addtool $pretend $common_opts -filter z.00000 -limit 26
+
+  # for a test limit to skycell.187.268 (MD03)
+  # -select_skycell_id skycell.187.268
+  # XXX : not allowed by addtool
+endif
+
+# example addtool command from HAF:
+# addtool
+#  -pretend
+#  -definebyquery
+#  -label LAP.ThreePi.20120706
+#  -set_dvodb LAP.20120706
+#  -set_minidvodb_group LAP.slice06.cam
+#  -set_minidvodb
+##  -set_label LAP.slice06.cam
+#  -stage cam
+#  -uncensored
+#  -ra_min 90 -ra_max 120 -decl_min 20 -decl_max 75
+#  -dbname gpc1
+#  -simple
Index: trunk/tools/eam/reprocess/euclid.md.20180925/run.addtool.fgal
===================================================================
--- trunk/tools/eam/reprocess/euclid.md.20180925/run.addtool.fgal	(revision 40818)
+++ trunk/tools/eam/reprocess/euclid.md.20180925/run.addtool.fgal	(revision 40818)
@@ -0,0 +1,65 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: run.addtool.fgal (field) [commit]"
+  exit 2
+endif
+
+set field = $1
+
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+set in_label = "EUCLID.$field.PV0.FF1.V1"
+set outlabel = "EUCLID.$field.PV0.FFG.V3"
+set outdvo   = "EUCLID.$field.PV0.FFG.V3"
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -definebyquery"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/euclid/$field/$outlabel"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+
+set common_opts = "$common_opts -stage fullforce_summary"
+set common_opts = "$common_opts -uncensored"
+
+set common_opts = "$common_opts -set_dvodb $outdvo"
+
+set common_opts = "$common_opts -set_minidvodb_name  $outlabel"
+set common_opts = "$common_opts -set_minidvodb_group $outlabel"
+
+set common_opts = "$common_opts -label $in_label"
+
+set common_opts = "$common_opts -simple"
+
+# set common_opts = "$common_opts -trace db 10"
+
+if (0) then
+  # first: 
+  # addtool -addminidvodbrun
+  addtool -dbname gpc1 -addminidvodbrun -set_minidvodb_group $outlabel -set_minidvodb_name $outlabel -set_minidvodb_path /data/ipp121.0/ipptest/euclid.20181118.$field.ffg
+endif
+
+if (1) then
+  addtool $pretend $common_opts
+endif
+
+# example addtool command from HAF:
+# addtool
+#  -pretend
+#  -definebyquery
+#  -label LAP.ThreePi.20120706
+#  -set_dvodb LAP.20120706
+#  -set_minidvodb_group LAP.slice06.cam
+#  -set_minidvodb
+##  -set_label LAP.slice06.cam
+#  -stage cam
+#  -uncensored
+#  -ra_min 90 -ra_max 120 -decl_min 20 -decl_max 75
+#  -dbname gpc1
+#  -simple
Index: trunk/tools/eam/reprocess/euclid.md.20180925/run.addtool.skycal
===================================================================
--- trunk/tools/eam/reprocess/euclid.md.20180925/run.addtool.skycal	(revision 40818)
+++ trunk/tools/eam/reprocess/euclid.md.20180925/run.addtool.skycal	(revision 40818)
@@ -0,0 +1,65 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: run.addtool.skycal (field) [commit]"
+  exit 2
+endif
+
+set field = $1
+
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+set in_label = "EUCLID.$field.PV0.SC1.V1"
+set outlabel = "EUCLID.$field.PV0.SKY.V3"
+set outdvo   = "EUCLID.$field.PV0.SKY.V3"
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -definebyquery"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/euclid/$field/$outlabel"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+
+set common_opts = "$common_opts -stage skycal"
+set common_opts = "$common_opts -uncensored"
+
+set common_opts = "$common_opts -set_dvodb $outdvo"
+
+set common_opts = "$common_opts -set_minidvodb_name  $outlabel"
+set common_opts = "$common_opts -set_minidvodb_group $outlabel"
+
+set common_opts = "$common_opts -label $in_label"
+
+set common_opts = "$common_opts -simple"
+
+# set common_opts = "$common_opts -trace db 10"
+
+if (0) then
+  # first: 
+  # addtool -addminidvodbrun
+  addtool -dbname gpc1 -addminidvodbrun -set_minidvodb_group $outlabel -set_minidvodb_name $outlabel -set_minidvodb_path /data/ipp121.0/ipptest/euclid.20181118.$field.sky
+endif
+
+if (1) then
+  addtool $pretend $common_opts
+endif
+
+# example addtool command from HAF:
+# addtool
+#  -pretend
+#  -definebyquery
+#  -label LAP.ThreePi.20120706
+#  -set_dvodb LAP.20120706
+#  -set_minidvodb_group LAP.slice06.cam
+#  -set_minidvodb
+##  -set_label LAP.slice06.cam
+#  -stage cam
+#  -uncensored
+#  -ra_min 90 -ra_max 120 -decl_min 20 -decl_max 75
+#  -dbname gpc1
+#  -simple
Index: trunk/tools/eam/reprocess/euclid.md.20180925/run.chiptest
===================================================================
--- trunk/tools/eam/reprocess/euclid.md.20180925/run.chiptest	(revision 40818)
+++ trunk/tools/eam/reprocess/euclid.md.20180925/run.chiptest	(revision 40818)
@@ -0,0 +1,23 @@
+#!/bin/csh
+
+set options = ""
+
+# set options = "$options -dbname gpc1" 
+set options = "$options -dbname gpc2"
+
+set options = "$options -definebyquery"
+set options = "$options -random"
+set options = "$options -simple"
+# set options = "$options -pretend"
+
+set options = "$options -set_label eam.formattest.20180928"
+set options = "$options -set_workdir neb:///gpc1/eamtest/formattest.20180928"
+
+set options = "$options -set_reduction MD_DEFAULT"
+set options = "$options -set_tess_id CFIS.V0"
+
+# gpc1 image:
+# chiptool $options -exp_name o8352g0613o
+
+# gpc2 image:
+chiptool $options -exp_name o8386h0196o
Index: trunk/tools/eam/reprocess/euclid.md.20180925/run.chiptool
===================================================================
--- trunk/tools/eam/reprocess/euclid.md.20180925/run.chiptool	(revision 40818)
+++ trunk/tools/eam/reprocess/euclid.md.20180925/run.chiptool	(revision 40818)
@@ -0,0 +1,60 @@
+#!/bin/csh
+
+## caution with this script : it is not itempotent because of the -random option.  
+## Each time it is run it will generate another set of the requested exposures (until 
+## there are no more matching.
+
+if ($#argv != 1) then
+  echo "USAGE: run.chiptool [commit]"
+  exit 2
+endif
+
+if ("$1" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+# nominal exposures times required to reach Euclid goals
+# g : 30,000s = 266 x 113s (we have 604 @ 113s, 80 @ 120s, 70 @ 240s)
+# r : 15,000s = 133 x 113s (we have 579 @ 113s, 81 @ 120s, 64 @ 240s)
+# i : 12,500s =  52 x 240s (we have 988 @ 240s)
+# z : 12,500s =  52 x 240s (we have 1262 @ 240s, 32 @ 60s)
+
+# I need to process MD03, MD05, MD06, MD07, MD08:
+
+# set field = MD03 -- done
+# set field = MD05 -- done
+# set field = MD06 -- done
+# set field = MD07 -- done
+# set field = MD08 -- done
+
+set options = ""
+set options = "$options -dbname gpc1"
+set options = "$options -definebyquery"
+set options = "$options -random"
+set options = "$options -simple"
+
+set options = "$options $pretend"
+
+set options = "$options -dateobs_begin 2010/01/01"
+set options = "$options -obs_mode MD"
+set options = "$options -comment %$field%"
+
+set options = "$options -set_label EUCLID.$field.PV0.T1"
+set options = "$options -set_workdir neb:///gpc1/euclid/$field/pv0.t1"
+
+set options = "$options -set_reduction MD_DEFAULT"
+set options = "$options -set_tess_id CFIS.V0"
+
+# g-band: 
+chiptool $options -limit 266 -filter g.00000 -exp_time_min 110 -exp_time_max 115
+
+# r-band: 
+chiptool $options -limit 133 -filter r.00000 -exp_time_min 110 -exp_time_max 115
+
+# i-band:
+chiptool $options -limit 52  -filter i.00000 -exp_time_min 230 -exp_time_max 250
+
+# z-band:
+chiptool $options -limit 52  -filter z.00000 -exp_time_min 230 -exp_time_max 250
Index: trunk/tools/eam/reprocess/euclid.md.20180925/run.fforce
===================================================================
--- trunk/tools/eam/reprocess/euclid.md.20180925/run.fforce	(revision 40818)
+++ trunk/tools/eam/reprocess/euclid.md.20180925/run.fforce	(revision 40818)
@@ -0,0 +1,39 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: run.fforce (field) [commit]"
+  exit 2
+endif
+
+set field = $1
+
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+set warp_label = "EUCLID.$field.PV0.T1"
+set skycal_label = "EUCLID.$field.PV0.SC1.V1"
+
+set outlabel = "EUCLID.$field.PV0.FF1.V1"
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -definebyquery"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/euclid/$field/$outlabel"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+set common_opts = "$common_opts -set_reduction STACKPHOT_EUCLID"
+
+set common_opts = "$common_opts -select_good_frac_min 0.05"
+
+set common_opts = "$common_opts -select_warp_label $warp_label"
+set common_opts = "$common_opts -select_skycal_label $skycal_label"
+
+set common_opts = "$common_opts -simple"
+
+# set common_opts = "$common_opts -trace db 10"
+
+fftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/euclid.md.20180925/run.skycal
===================================================================
--- trunk/tools/eam/reprocess/euclid.md.20180925/run.skycal	(revision 40818)
+++ trunk/tools/eam/reprocess/euclid.md.20180925/run.skycal	(revision 40818)
@@ -0,0 +1,30 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: run.skycal (field) [commit]"
+  exit 2
+endif
+
+set field = $1
+
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+set inlabel = "EUCLID.$field.PV0.SS1.V1"
+set outlabel = "EUCLID.$field.PV0.SC1.V1"
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -defineskycalrun"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/euclid/$field/$outlabel"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+
+set common_opts = "$common_opts -select_label $inlabel"
+set common_opts = "$common_opts -simple"
+
+staticskytool $pretend $common_opts
Index: trunk/tools/eam/reprocess/euclid.md.20180925/run.stacktool
===================================================================
--- trunk/tools/eam/reprocess/euclid.md.20180925/run.stacktool	(revision 40818)
+++ trunk/tools/eam/reprocess/euclid.md.20180925/run.stacktool	(revision 40818)
@@ -0,0 +1,52 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: run.stacktool (field) [commit]"
+  exit 2
+endif
+
+set field = $1
+
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+# T0 : initial test run
+# T1 : full run for all Euclid / MD fields (03, 05 - 08)
+# T2 : test run using GAUSS kernel
+
+set inlabel = "EUCLID.$field.PV0.T1"
+set outlabel = "EUCLID.$field.PV0.ST1"
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -definebyquery"
+set common_opts = "$common_opts -select_label $inlabel"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+set common_opts = "$common_opts -min_num 4"
+
+# other filter options:
+# set common_opts = "$common_opts -select_astrom"
+# set common_opts = "$common_opts -select_zpt_obs_max"
+# set common_opts = "$common_opts -select_bg_max"
+# set common_opts = "$common_opts -select_bg_stdev_max"
+
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/euclid/$field/pv0.st1"
+
+# set common_opts = "$common_opts  -set_reduction THREEPI_STACK_1DG"
+# set common_opts = "$common_opts  -set_reduction MD_REF_STACK_1DG" -- this requires PSF FWHM < 7.0
+set common_opts = "$common_opts  -set_reduction MD_IQ_STACK_1DG"
+
+stacktool $pretend $common_opts -select_filter g.00000 -select_fwhm_major_max 9.0 -select_zpt_obs_min 24.1
+stacktool $pretend $common_opts -select_filter r.00000 -select_fwhm_major_max 9.0 -select_zpt_obs_min 24.3
+stacktool $pretend $common_opts -select_filter i.00000 -select_fwhm_major_max 9.0 -select_zpt_obs_min 24.4
+stacktool $pretend $common_opts -select_filter z.00000 -select_fwhm_major_max 9.0 -select_zpt_obs_min 24.2
+# stacktool $pretend $common_opts -select_filter y.00000 -select_fwhm_major_max 9.0
+
+# skycell_id skycell.187.268 is roughly in the center
+#echo stacktool $pretend $common_opts -select_filter i.00000 -select_zpt_obs_min 24.4 -select_fwhm_major_max 9.0 -select_skycell_id skycell.187.268
+#     stacktool $pretend $common_opts -select_filter i.00000 -select_zpt_obs_min 24.4 -select_fwhm_major_max 9.0 -select_skycell_id skycell.187.268
Index: trunk/tools/eam/reprocess/euclid.md.20180925/run.staticskytool
===================================================================
--- trunk/tools/eam/reprocess/euclid.md.20180925/run.staticskytool	(revision 40818)
+++ trunk/tools/eam/reprocess/euclid.md.20180925/run.staticskytool	(revision 40818)
@@ -0,0 +1,67 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: run.staticskytool (field) [commit]"
+  exit 2
+endif
+
+set field = $1
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+set inlabel = "EUCLID.$field.PV0.ST1"
+set outlabel = "EUCLID.$field.PV0.SS1.V1"
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -definebyquery"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/euclid/$field/$outlabel"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+set common_opts = "$common_opts -set_reduction STACKPHOT_EUCLID"
+
+set common_opts = "$common_opts -select_label $inlabel"
+# set common_opts = "$common_opts -ra_min 320"
+# set common_opts = "$common_opts -ra_max 340"
+set common_opts = "$common_opts -simple"
+
+# set common_opts = "$common_opts -trace db 10"
+
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000
+staticskytool $pretend $common_opts  -select_filter r.00000
+staticskytool $pretend $common_opts  -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter y.00000
+
+# echo staticskytool $pretend $common_opts  -select_filter i.00000
+#      staticskytool $pretend $common_opts  -select_filter i.00000
Index: trunk/tools/eam/reprocess/euclid.md.20180925/run.warptool
===================================================================
--- trunk/tools/eam/reprocess/euclid.md.20180925/run.warptool	(revision 40818)
+++ trunk/tools/eam/reprocess/euclid.md.20180925/run.warptool	(revision 40818)
@@ -0,0 +1,64 @@
+#!/bin/csh
+
+## this script was used to re-queue exposures for warp using GAUSS
+## interpolation instead of the LANCZOS3 interpolation already run.
+
+if ($#argv != 1) then
+  echo "USAGE: run.warptool [commit]"
+  exit 2
+endif
+
+if ("$1" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+# nominal exposures times required to reach Euclid goals
+# g : 30,000s = 266 x 113s (we have 604 @ 113s, 80 @ 120s, 70 @ 240s)
+# r : 15,000s = 133 x 113s (we have 579 @ 113s, 81 @ 120s, 64 @ 240s)
+# i : 12,500s =  52 x 240s (we have 988 @ 240s)
+# z : 12,500s =  52 x 240s (we have 1262 @ 240s, 32 @ 60s)
+
+# I need to process MD03, MD05, MD06, MD07, MD08:
+
+set field = MD03
+# set field = MD05 -- done
+# set field = MD06 -- done
+# set field = MD07 -- done
+# set field = MD08 -- done
+
+set options = ""
+set options = "$options -dbname gpc1"
+set options = "$options -definebyquery"
+set options = "$options -set_mode warp"
+set options = "$options -simple"
+
+set options = "$options $pretend"
+
+# set options = "$options -dateobs_begin 2010/01/01"
+# set options = "$options -obs_mode MD"
+# set options = "$options -comment %$field%"
+
+# we are re-running exposures which were previousl processed with LANCZOS3
+# using the following label
+set options = "$options -label EUCLID.$field.PV0.T1"
+
+# T2 : warp test using GAUSS interpolation
+set options = "$options -set_label EUCLID.$field.PV0.T2"
+set options = "$options -set_workdir neb:///gpc1/euclid/$field/pv0.t2"
+
+set options = "$options -set_reduction MD_WARP_TEST"
+set options = "$options -set_tess_id CFIS.V0"
+
+# g-band: 
+# warptool $options -filter g.00000
+
+# r-band: 
+# warptool $options -filter r.00000
+
+# i-band:
+warptool $options -filter i.00000
+
+# z-band:
+# warptool $options -filter z.00000
Index: trunk/tools/eam/reprocess/pole.reprocess.20180427/00_chips.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20180427/00_chips.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20180427/00_chips.cmd	(revision 40818)
@@ -0,0 +1,46 @@
+#!/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 3PI"
+set common_opts = "$common_opts -obs_mode OSS"
+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/POLE/$label"
+set common_opts = "$common_opts -simple -set_dist_group SAS"
+
+set common_opts = "$common_opts -ra_min   0.0"
+set common_opts = "$common_opts -ra_max 362.0"
+# set common_opts = "$common_opts -ra_min   359.99995" -- used for edge exposures missed initially
+set common_opts = "$common_opts -decl_min 75.0"
+set common_opts = "$common_opts -decl_max 90.0"
+
+set common_opts = "$common_opts -dateobs_begin 2010-01-01T00:00:00"
+set common_opts = "$common_opts -dateobs_end 2015-02-28T00:00:00"
+
+# I initially used 2015.01.01, but the original PV3.LAP used a later date
+# set common_opts = "$common_opts -dateobs_end 2015-01-01T00:00:00"
+
+set common_opts = "$common_opts -set_reduction LAP_SCIENCE"
+
+chiptool $pretend $common_opts -filter g.00000
+chiptool $pretend $common_opts -filter r.00000
+chiptool $pretend $common_opts -filter i.00000
+chiptool $pretend $common_opts -filter z.00000
+
+#chiptool $pretend $common_opts -filter y.00000
Index: trunk/tools/eam/reprocess/pole.reprocess.20180427/00_chips_extra.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20180427/00_chips_extra.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20180427/00_chips_extra.cmd	(revision 40818)
@@ -0,0 +1,61 @@
+#!/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 -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/POLE/$label"
+set common_opts = "$common_opts -simple -set_dist_group SAS"
+
+# I initially used 2015.01.01, but the original PV3.LAP used a later date
+# set common_opts = "$common_opts -dateobs_end 2015-01-01T00:00:00"
+
+set common_opts = "$common_opts -set_reduction LAP_SCIENCE"
+
+# I put these in the label PV3.Pole.Reprocess.20180510.extra
+# chiptool $pretend $common_opts -exp_name o5078g0145o 
+# chiptool $pretend $common_opts -exp_name o5078g0156o 
+# chiptool $pretend $common_opts -exp_name o4992g0280o 
+# chiptool $pretend $common_opts -exp_name o4995g0257o 
+# chiptool $pretend $common_opts -exp_name o4995g0275o 
+# chiptool $pretend $common_opts -exp_name o4997g0277o 
+# chiptool $pretend $common_opts -exp_name o4985g0060o 
+# chiptool $pretend $common_opts -exp_name o4985g0066o 
+# chiptool $pretend $common_opts -exp_name o4985g0046o 
+# chiptool $pretend $common_opts -exp_name o5077g0226o 
+# chiptool $pretend $common_opts -exp_name o5077g0243o 
+# chiptool $pretend $common_opts -exp_name o5078g0232o 
+# chiptool $pretend $common_opts -exp_name o5078g0249o 
+# chiptool $pretend $common_opts -exp_name o5078g0224o 
+# chiptool $pretend $common_opts -exp_name o5078g0241o 
+# chiptool $pretend $common_opts -exp_name o5194g0570o 
+# chiptool $pretend $common_opts -exp_name o5194g0583o 
+# chiptool $pretend $common_opts -exp_name o4988g0361o 
+# chiptool $pretend $common_opts -exp_name o4988g0378o 
+# chiptool $pretend $common_opts -exp_name o5078g0160o 
+# chiptool $pretend $common_opts -exp_name o5078g0149o 
+# chiptool $pretend $common_opts -exp_name o4999g0273o 
+# chiptool $pretend $common_opts -exp_name o4999g0286o 
+# chiptool $pretend $common_opts -exp_name o5076g0278o 
+# chiptool $pretend $common_opts -exp_name o5076g0295o 
+
+# I put these in the label PV3.Pole.Reprocess.20180510
+chiptool $pretend $common_opts -exp_name o7049g0085o 
+chiptool $pretend $common_opts -exp_name o7049g0086o 
+chiptool $pretend $common_opts -exp_name o7050g0081o 
+chiptool $pretend $common_opts -exp_name o7050g0082o 
Index: trunk/tools/eam/reprocess/pole.reprocess.20180427/01_stacks.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20180427/01_stacks.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20180427/01_stacks.cmd	(revision 40818)
@@ -0,0 +1,33 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 01_stacks.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 -select_label $label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group $label"
+set common_opts = "$common_opts -min_num 4"
+set common_opts = "$common_opts -simple"
+
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/POLE/$label"
+
+set common_opts = "$common_opts  -set_reduction THREEPI_STACK_1DG"
+
+stacktool $pretend $common_opts -select_filter g.00000
+stacktool $pretend $common_opts -select_filter r.00000
+stacktool $pretend $common_opts -select_filter i.00000
+stacktool $pretend $common_opts -select_filter z.00000
+stacktool $pretend $common_opts -select_filter y.00000
Index: trunk/tools/eam/reprocess/pole.reprocess.20180427/02_ssky.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20180427/02_ssky.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20180427/02_ssky.cmd	(revision 40818)
@@ -0,0 +1,58 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 02_ssky.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 -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_label $label"
+set common_opts = "$common_opts -ra_min 320"
+set common_opts = "$common_opts -ra_max 340"
+set common_opts = "$common_opts -simple"
+
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000
+staticskytool $pretend $common_opts  -select_filter r.00000
+staticskytool $pretend $common_opts  -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter y.00000
Index: trunk/tools/eam/reprocess/pole.reprocess.20180427/03_skycal.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20180427/03_skycal.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20180427/03_skycal.cmd	(revision 40818)
@@ -0,0 +1,26 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 03_skycal.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 -defineskycalrun"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_label $label"
+set common_opts = "$common_opts -simple"
+
+staticskytool $pretend $common_opts
Index: trunk/tools/eam/reprocess/pole.reprocess.20180427/04_dist.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20180427/04_dist.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20180427/04_dist.cmd	(revision 40818)
@@ -0,0 +1,17 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 04_dist.cmd (label) [commit]"
+  exit 2
+endif
+
+set label = $1
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "--pretend"
+endif
+
+set today = `date +%Y%m%d`
+
+dist_defineruns.pl --verbose --no_magic --dbname gpc1 $pretend --label $label --workdir neb://@HOST@.0/gpc1/dist/$label/$today
Index: trunk/tools/eam/reprocess/pole.reprocess.20180427/05_fforce.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20180427/05_fforce.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20180427/05_fforce.cmd	(revision 40818)
@@ -0,0 +1,29 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 03_skycal.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 -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -select_warp_label $label"
+set common_opts = "$common_opts -select_skycal_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_good_frac_min 0.05"
+
+set common_opts = "$common_opts -simple"
+
+fftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/pole.reprocess.20180427/06_diff.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20180427/06_diff.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20180427/06_diff.cmd	(revision 40818)
@@ -0,0 +1,31 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 06_diff.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 -definewarpstack"
+set common_opts = "$common_opts -available"
+set common_opts = "$common_opts -set_reduction WARPSTACK_PV3"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -warp_label $label" 
+set common_opts = "$common_opts -stack_label LAP.PV3.20140730.final"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+set common_opts = "$common_opts -good_frac 0.2"
+set common_opts = "$common_opts -simple"
+
+echo $common_opts
+
+difftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/pole.reprocess.20180427/06a_diff_internal.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20180427/06a_diff_internal.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20180427/06a_diff_internal.cmd	(revision 40818)
@@ -0,0 +1,31 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 06_diff.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 -definewarpstack"
+set common_opts = "$common_opts -available"
+set common_opts = "$common_opts -set_reduction WARPSTACK_PV3"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/SAS.20151208.internal"
+set common_opts = "$common_opts -set_label SAS.20151208.internal"
+set common_opts = "$common_opts -warp_label $label" 
+set common_opts = "$common_opts -stack_label $label"
+set common_opts = "$common_opts -set_data_group SAS.20151208.20160119"
+set common_opts = "$common_opts -set_dist_group SAS"
+set common_opts = "$common_opts -good_frac 0.2"
+set common_opts = "$common_opts -simple"
+
+echo $common_opts
+
+difftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/pole.reprocess.20190619/00_chips.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20190619/00_chips.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20190619/00_chips.cmd	(revision 40818)
@@ -0,0 +1,48 @@
+#!/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 3PI"
+set common_opts = "$common_opts -obs_mode OSS"
+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/POLE/$label"
+set common_opts = "$common_opts -simple -set_dist_group SAS"
+
+## set common_opts = "$common_opts -ra_min   0.0"
+## set common_opts = "$common_opts -ra_max 362.0" ; # need to go beyond 360 to get all exposures.
+## set common_opts = "$common_opts -decl_min 75.0"
+## set common_opts = "$common_opts -decl_max 90.0"
+
+## test set:
+set common_opts = "$common_opts -ra_min 130.0"
+set common_opts = "$common_opts -ra_max 190.0" ; # need to go beyond 360 to get all exposures.
+set common_opts = "$common_opts -decl_min 86.0"
+set common_opts = "$common_opts -decl_max 90.0"
+
+set common_opts = "$common_opts -dateobs_begin 2010-01-01T00:00:00"
+set common_opts = "$common_opts -dateobs_end 2015-02-28T00:00:00"
+
+set common_opts = "$common_opts -set_reduction LAP_POLE"
+
+## for test set, just run i-band:
+#chiptool $pretend $common_opts -filter g.00000
+#chiptool $pretend $common_opts -filter r.00000
+ chiptool $pretend $common_opts -filter i.00000
+#chiptool $pretend $common_opts -filter z.00000
+#chiptool $pretend $common_opts -filter y.00000
Index: trunk/tools/eam/reprocess/pole.reprocess.20190619/00_chips_extra.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20190619/00_chips_extra.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20190619/00_chips_extra.cmd	(revision 40818)
@@ -0,0 +1,61 @@
+#!/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 -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/POLE/$label"
+set common_opts = "$common_opts -simple -set_dist_group SAS"
+
+# I initially used 2015.01.01, but the original PV3.LAP used a later date
+# set common_opts = "$common_opts -dateobs_end 2015-01-01T00:00:00"
+
+set common_opts = "$common_opts -set_reduction LAP_POLE"
+
+# I put these in the label PV3.Pole.Reprocess.20180510.extra
+# chiptool $pretend $common_opts -exp_name o5078g0145o 
+# chiptool $pretend $common_opts -exp_name o5078g0156o 
+# chiptool $pretend $common_opts -exp_name o4992g0280o 
+# chiptool $pretend $common_opts -exp_name o4995g0257o 
+# chiptool $pretend $common_opts -exp_name o4995g0275o 
+# chiptool $pretend $common_opts -exp_name o4997g0277o 
+# chiptool $pretend $common_opts -exp_name o4985g0060o 
+# chiptool $pretend $common_opts -exp_name o4985g0066o 
+# chiptool $pretend $common_opts -exp_name o4985g0046o 
+# chiptool $pretend $common_opts -exp_name o5077g0226o 
+# chiptool $pretend $common_opts -exp_name o5077g0243o 
+# chiptool $pretend $common_opts -exp_name o5078g0232o 
+# chiptool $pretend $common_opts -exp_name o5078g0249o 
+# chiptool $pretend $common_opts -exp_name o5078g0224o 
+# chiptool $pretend $common_opts -exp_name o5078g0241o 
+# chiptool $pretend $common_opts -exp_name o5194g0570o 
+# chiptool $pretend $common_opts -exp_name o5194g0583o 
+# chiptool $pretend $common_opts -exp_name o4988g0361o 
+# chiptool $pretend $common_opts -exp_name o4988g0378o 
+# chiptool $pretend $common_opts -exp_name o5078g0160o 
+# chiptool $pretend $common_opts -exp_name o5078g0149o 
+# chiptool $pretend $common_opts -exp_name o4999g0273o 
+# chiptool $pretend $common_opts -exp_name o4999g0286o 
+# chiptool $pretend $common_opts -exp_name o5076g0278o 
+# chiptool $pretend $common_opts -exp_name o5076g0295o 
+
+# I put these in the label PV3.Pole.Reprocess.20180510
+chiptool $pretend $common_opts -exp_name o7049g0085o 
+chiptool $pretend $common_opts -exp_name o7049g0086o 
+chiptool $pretend $common_opts -exp_name o7050g0081o 
+chiptool $pretend $common_opts -exp_name o7050g0082o 
Index: trunk/tools/eam/reprocess/pole.reprocess.20190619/01_stacks.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20190619/01_stacks.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20190619/01_stacks.cmd	(revision 40818)
@@ -0,0 +1,33 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 01_stacks.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 -select_label $label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group $label"
+set common_opts = "$common_opts -min_num 4"
+set common_opts = "$common_opts -simple"
+
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/POLE/$label"
+
+set common_opts = "$common_opts  -set_reduction THREEPI_STACK_1DG"
+
+stacktool $pretend $common_opts -select_filter g.00000
+stacktool $pretend $common_opts -select_filter r.00000
+stacktool $pretend $common_opts -select_filter i.00000
+stacktool $pretend $common_opts -select_filter z.00000
+stacktool $pretend $common_opts -select_filter y.00000
Index: trunk/tools/eam/reprocess/pole.reprocess.20190619/02_ssky.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20190619/02_ssky.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20190619/02_ssky.cmd	(revision 40818)
@@ -0,0 +1,58 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 02_ssky.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 -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_label $label"
+set common_opts = "$common_opts -ra_min 320"
+set common_opts = "$common_opts -ra_max 340"
+set common_opts = "$common_opts -simple"
+
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter z.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter g.00000
+staticskytool $pretend $common_opts  -select_filter r.00000
+staticskytool $pretend $common_opts  -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter z.00000
+staticskytool $pretend $common_opts  -select_filter y.00000
Index: trunk/tools/eam/reprocess/pole.reprocess.20190619/03_skycal.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20190619/03_skycal.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20190619/03_skycal.cmd	(revision 40818)
@@ -0,0 +1,26 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 03_skycal.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 -defineskycalrun"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_label $label"
+set common_opts = "$common_opts -simple"
+
+staticskytool $pretend $common_opts
Index: trunk/tools/eam/reprocess/pole.reprocess.20190619/04_dist.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20190619/04_dist.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20190619/04_dist.cmd	(revision 40818)
@@ -0,0 +1,17 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 04_dist.cmd (label) [commit]"
+  exit 2
+endif
+
+set label = $1
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "--pretend"
+endif
+
+set today = `date +%Y%m%d`
+
+dist_defineruns.pl --verbose --no_magic --dbname gpc1 $pretend --label $label --workdir neb://@HOST@.0/gpc1/dist/$label/$today
Index: trunk/tools/eam/reprocess/pole.reprocess.20190619/05_fforce.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20190619/05_fforce.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20190619/05_fforce.cmd	(revision 40818)
@@ -0,0 +1,29 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 03_skycal.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 -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -select_warp_label $label"
+set common_opts = "$common_opts -select_skycal_label $label"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+
+set common_opts = "$common_opts -select_good_frac_min 0.05"
+
+set common_opts = "$common_opts -simple"
+
+fftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/pole.reprocess.20190619/06_diff.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20190619/06_diff.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20190619/06_diff.cmd	(revision 40818)
@@ -0,0 +1,31 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 06_diff.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 -definewarpstack"
+set common_opts = "$common_opts -available"
+set common_opts = "$common_opts -set_reduction WARPSTACK_PV3"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/$label"
+set common_opts = "$common_opts -set_label $label"
+set common_opts = "$common_opts -warp_label $label" 
+set common_opts = "$common_opts -stack_label LAP.PV3.20140730.final"
+set common_opts = "$common_opts -set_data_group $label"
+set common_opts = "$common_opts -set_dist_group SAS"
+set common_opts = "$common_opts -good_frac 0.2"
+set common_opts = "$common_opts -simple"
+
+echo $common_opts
+
+difftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/pole.reprocess.20190619/06a_diff_internal.cmd
===================================================================
--- trunk/tools/eam/reprocess/pole.reprocess.20190619/06a_diff_internal.cmd	(revision 40818)
+++ trunk/tools/eam/reprocess/pole.reprocess.20190619/06a_diff_internal.cmd	(revision 40818)
@@ -0,0 +1,31 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: 06_diff.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 -definewarpstack"
+set common_opts = "$common_opts -available"
+set common_opts = "$common_opts -set_reduction WARPSTACK_PV3"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/SAS2/SAS.20151208.internal"
+set common_opts = "$common_opts -set_label SAS.20151208.internal"
+set common_opts = "$common_opts -warp_label $label" 
+set common_opts = "$common_opts -stack_label $label"
+set common_opts = "$common_opts -set_data_group SAS.20151208.20160119"
+set common_opts = "$common_opts -set_dist_group SAS"
+set common_opts = "$common_opts -good_frac 0.2"
+set common_opts = "$common_opts -simple"
+
+echo $common_opts
+
+difftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/unions.dr2.20190430/run.addtool.ffwarp
===================================================================
--- trunk/tools/eam/reprocess/unions.dr2.20190430/run.addtool.ffwarp	(revision 40818)
+++ trunk/tools/eam/reprocess/unions.dr2.20190430/run.addtool.ffwarp	(revision 40818)
@@ -0,0 +1,73 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: run.addtool.ffwarp (mode) [commit/test]"
+  echo "  mode = minidvo or queue"
+  exit 2
+endif
+
+set mode = $1
+
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+set in_label = "UNIONS.DR2.20190430"
+set outlabel = "UNIONS.DR2.20190430.FFW.V0"
+set outdvo   = "UNIONS.DR2.20190430.FFW.V0"
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -definebyquery"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/UNIONS.DR2.20190430.FFORCE"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+
+set common_opts = "$common_opts -stage fullforce"
+set common_opts = "$common_opts -uncensored"
+
+set common_opts = "$common_opts -limit 50000"
+# set common_opts = "$common_opts -limit 5"
+
+set common_opts = "$common_opts -set_dvodb $outdvo"
+
+set common_opts = "$common_opts -set_minidvodb_name  $outlabel"
+set common_opts = "$common_opts -set_minidvodb_group $outlabel"
+
+set common_opts = "$common_opts -label $in_label"
+
+set common_opts = "$common_opts -simple"
+
+# set common_opts = "$common_opts -trace db 10"
+
+# generate the addminidvodbrun first
+if ("$mode" == "minidvo") then
+  addtool -dbname gpc1 -addminidvodbrun -set_minidvodb_group $outlabel -set_minidvodb_name $outlabel -set_minidvodb_path /data/ipp139.0/ipptest/$outdvo
+  exit 0
+endif
+
+if ("$mode" == "queue") then
+  addtool $pretend $common_opts
+  exit 0
+endif
+
+echo "unknown mode $mode"
+exit 2
+
+# example addtool command from HAF:
+# addtool
+#  -pretend
+#  -definebyquery
+#  -label LAP.ThreePi.20120706
+#  -set_dvodb LAP.20120706
+#  -set_minidvodb_group LAP.slice06.cam
+#  -set_minidvodb
+##  -set_label LAP.slice06.cam
+#  -stage cam
+#  -uncensored
+#  -ra_min 90 -ra_max 120 -decl_min 20 -decl_max 75
+#  -dbname gpc1
+#  -simple
Index: trunk/tools/eam/reprocess/unions.dr2.20190430/run.addtool.fgal
===================================================================
--- trunk/tools/eam/reprocess/unions.dr2.20190430/run.addtool.fgal	(revision 40818)
+++ trunk/tools/eam/reprocess/unions.dr2.20190430/run.addtool.fgal	(revision 40818)
@@ -0,0 +1,65 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: run.addtool.fgal (field) [commit]"
+  exit 2
+endif
+
+set field = $1
+
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+set in_label = "EUCLID.$field.PV0.FF1.V1"
+set outlabel = "EUCLID.$field.PV0.FFG.V3"
+set outdvo   = "EUCLID.$field.PV0.FFG.V3"
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -definebyquery"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/euclid/$field/$outlabel"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+
+set common_opts = "$common_opts -stage fullforce_summary"
+set common_opts = "$common_opts -uncensored"
+
+set common_opts = "$common_opts -set_dvodb $outdvo"
+
+set common_opts = "$common_opts -set_minidvodb_name  $outlabel"
+set common_opts = "$common_opts -set_minidvodb_group $outlabel"
+
+set common_opts = "$common_opts -label $in_label"
+
+set common_opts = "$common_opts -simple"
+
+# set common_opts = "$common_opts -trace db 10"
+
+if (0) then
+  # first: 
+  # addtool -addminidvodbrun
+  addtool -dbname gpc1 -addminidvodbrun -set_minidvodb_group $outlabel -set_minidvodb_name $outlabel -set_minidvodb_path /data/ipp121.0/ipptest/euclid.20181118.$field.ffg
+endif
+
+if (1) then
+  addtool $pretend $common_opts
+endif
+
+# example addtool command from HAF:
+# addtool
+#  -pretend
+#  -definebyquery
+#  -label LAP.ThreePi.20120706
+#  -set_dvodb LAP.20120706
+#  -set_minidvodb_group LAP.slice06.cam
+#  -set_minidvodb
+##  -set_label LAP.slice06.cam
+#  -stage cam
+#  -uncensored
+#  -ra_min 90 -ra_max 120 -decl_min 20 -decl_max 75
+#  -dbname gpc1
+#  -simple
Index: trunk/tools/eam/reprocess/unions.dr2.20190430/run.addtool.skycal
===================================================================
--- trunk/tools/eam/reprocess/unions.dr2.20190430/run.addtool.skycal	(revision 40818)
+++ trunk/tools/eam/reprocess/unions.dr2.20190430/run.addtool.skycal	(revision 40818)
@@ -0,0 +1,70 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: run.addtool.skycal (mode) [commit/test]"
+  echo "  mode = minidvo or queue"
+  exit 2
+endif
+
+set mode = $1
+
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+set in_label = "UNIONS.DR2.20190430"
+set outlabel = "UNIONS.DR2.20190430.SKY.V0"
+set outdvo   = "UNIONS.DR2.20190430.SKY.V0"
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -definebyquery"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/UNIONS.DR2.20190430.SKYCAL"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+
+set common_opts = "$common_opts -stage skycal"
+set common_opts = "$common_opts -uncensored"
+
+set common_opts = "$common_opts -set_dvodb $outdvo"
+
+set common_opts = "$common_opts -set_minidvodb_name  $outlabel"
+set common_opts = "$common_opts -set_minidvodb_group $outlabel"
+
+set common_opts = "$common_opts -label $in_label"
+
+set common_opts = "$common_opts -simple"
+
+# set common_opts = "$common_opts -trace db 10"
+
+# generate the addminidvodbrun first
+if ("$mode" == "minidvo") then
+  addtool -dbname gpc1 -addminidvodbrun -set_minidvodb_group $outlabel -set_minidvodb_name $outlabel -set_minidvodb_path /data/ipp139.0/ipptest/$outdvo
+  exit 0
+endif
+
+if ("$mode" == "queue") then
+  addtool $pretend $common_opts
+  exit 0
+endif
+
+echo "unknown mode $mode"
+exit 2
+
+# example addtool command from HAF:
+# addtool
+#  -pretend
+#  -definebyquery
+#  -label LAP.ThreePi.20120706
+#  -set_dvodb LAP.20120706
+#  -set_minidvodb_group LAP.slice06.cam
+#  -set_minidvodb
+##  -set_label LAP.slice06.cam
+#  -stage cam
+#  -uncensored
+#  -ra_min 90 -ra_max 120 -decl_min 20 -decl_max 75
+#  -dbname gpc1
+#  -simple
Index: trunk/tools/eam/reprocess/unions.dr2.20190430/run.chiptool
===================================================================
--- trunk/tools/eam/reprocess/unions.dr2.20190430/run.chiptool	(revision 40818)
+++ trunk/tools/eam/reprocess/unions.dr2.20190430/run.chiptool	(revision 40818)
@@ -0,0 +1,74 @@
+#!/bin/csh
+
+if ($#argv != 1) then
+  echo "USAGE: run.chiptool [commit]"
+  exit 2
+endif
+
+if ("$1" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+# areas to process:
+# north cap 1: 10h - 12h, 30d - 40d
+
+set options = ""
+set options = "$options -dbname gpc1"
+set options = "$options -definebyquery"
+set options = "$options -simple"
+
+# set options = "$options -random"
+
+set options = "$options $pretend"
+
+set options = "$options -dateobs_begin 2010/01/01"
+
+set options = "$options -set_label UNIONS.DR2.20190430"
+set options = "$options -set_workdir neb:///gpc1/UNIONS.DR2.20190430"
+
+set options = "$options -set_reduction DEFAULT"
+set options = "$options -set_tess_id CFIS.V0"
+
+# north cap r2:
+set region = "-ra_min 120 -ra_max 150 -decl_min 30 -decl_max 40"
+echo chiptool $options -filter i.00000 $region -obs_mode 3pi     ; chiptool $options -filter i.00000 $region -obs_mode 3pi     | wc -l     
+echo chiptool $options -filter i.00000 $region -obs_mode OSS     ; chiptool $options -filter i.00000 $region -obs_mode OSS     | wc -l     
+echo chiptool $options -filter i.00000 $region -obs_mode QUB     ; chiptool $options -filter i.00000 $region -obs_mode QUB     | wc -l     
+echo chiptool $options -filter i.00000 $region -obs_mode SNIa    ; chiptool $options -filter i.00000 $region -obs_mode SNIa    | wc -l 
+echo chiptool $options -filter z.00000 $region -obs_mode 3pi     ; chiptool $options -filter z.00000 $region -obs_mode 3pi     | wc -l     
+echo chiptool $options -filter z.00000 $region -obs_mode Bright  ; chiptool $options -filter z.00000 $region -obs_mode Bright  | wc -l 
+echo chiptool $options -filter z.00000 $region -obs_mode SNIa    ; chiptool $options -filter z.00000 $region -obs_mode SNIa    | wc -l 
+exit
+
+# north cap r1:
+set region = "-ra_min 150 -ra_max 180 -decl_min 30 -decl_max 40"
+echo chiptool $options -filter i.00000 $region -obs_mode 3pi     ; chiptool $options -filter i.00000 $region -obs_mode 3pi     | wc -l     
+echo chiptool $options -filter i.00000 $region -obs_mode OSS     ; chiptool $options -filter i.00000 $region -obs_mode OSS     | wc -l     
+echo chiptool $options -filter i.00000 $region -obs_mode QUB     ; chiptool $options -filter i.00000 $region -obs_mode QUB     | wc -l     
+echo chiptool $options -filter i.00000 $region -obs_mode SNIa    ; chiptool $options -filter i.00000 $region -obs_mode SNIa    | wc -l 
+echo chiptool $options -filter z.00000 $region -obs_mode 3pi     ; chiptool $options -filter z.00000 $region -obs_mode 3pi     | wc -l     
+echo chiptool $options -filter z.00000 $region -obs_mode Bright  ; chiptool $options -filter z.00000 $region -obs_mode Bright  | wc -l 
+echo chiptool $options -filter z.00000 $region -obs_mode SNIa    ; chiptool $options -filter z.00000 $region -obs_mode SNIa    | wc -l 
+
+# south cap, r1:
+set region = "-ra_min 0 -ra_max 45 -decl_min 30 -decl_max 40"
+echo chiptool $options -filter i.00000 $region -obs_mode 3pi     ; chiptool $options -filter i.00000 $region -obs_mode 3pi     | wc -l     
+echo chiptool $options -filter i.00000 $region -obs_mode OSS     ; chiptool $options -filter i.00000 $region -obs_mode OSS     | wc -l     
+echo chiptool $options -filter i.00000 $region -obs_mode QUB     ; chiptool $options -filter i.00000 $region -obs_mode QUB     | wc -l     
+echo chiptool $options -filter i.00000 $region -obs_mode SNIa    ; chiptool $options -filter i.00000 $region -obs_mode SNIa    | wc -l 
+echo chiptool $options -filter z.00000 $region -obs_mode 3pi     ; chiptool $options -filter z.00000 $region -obs_mode 3pi     | wc -l     
+echo chiptool $options -filter z.00000 $region -obs_mode Bright  ; chiptool $options -filter z.00000 $region -obs_mode Bright  | wc -l 
+echo chiptool $options -filter z.00000 $region -obs_mode QUB     ; chiptool $options -filter z.00000 $region -obs_mode QUB     | wc -l     
+echo chiptool $options -filter z.00000 $region -obs_mode SNIa    ; chiptool $options -filter z.00000 $region -obs_mode SNIa    | wc -l 
+
+# south cap, r2:
+set region = "-ra_min 345 -ra_max 360 -decl_min 30 -decl_max 40"
+echo chiptool $options -filter i.00000 $region -obs_mode 3pi     ; chiptool $options -filter i.00000 $region -obs_mode 3pi     | wc -l     
+echo chiptool $options -filter i.00000 $region -obs_mode OSS     ; chiptool $options -filter i.00000 $region -obs_mode OSS     | wc -l     
+echo chiptool $options -filter i.00000 $region -obs_mode SNIa    ; chiptool $options -filter i.00000 $region -obs_mode SNIa    | wc -l 
+echo chiptool $options -filter z.00000 $region -obs_mode 3pi     ; chiptool $options -filter z.00000 $region -obs_mode 3pi     | wc -l     
+echo chiptool $options -filter z.00000 $region -obs_mode Bright  ; chiptool $options -filter z.00000 $region -obs_mode Bright  | wc -l 
+echo chiptool $options -filter z.00000 $region -obs_mode SNIa    ; chiptool $options -filter z.00000 $region -obs_mode SNIa    | wc -l 
+
Index: trunk/tools/eam/reprocess/unions.dr2.20190430/run.fforce
===================================================================
--- trunk/tools/eam/reprocess/unions.dr2.20190430/run.fforce	(revision 40818)
+++ trunk/tools/eam/reprocess/unions.dr2.20190430/run.fforce	(revision 40818)
@@ -0,0 +1,37 @@
+#!/bin/csh -f
+
+if ($#argv != 1) then
+  echo "USAGE: run.fforce [commit]"
+  exit 2
+endif
+
+if ("$1" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+set warp_label = "UNIONS.DR2.20190430"
+set skycal_label = "UNIONS.DR2.20190430"
+
+set outlabel = "UNIONS.DR2.20190430"
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -definebyquery"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/UNIONS.DR2.20190430.FFORCE"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+set common_opts = "$common_opts -set_reduction STACKPHOT_EUCLID"
+
+set common_opts = "$common_opts -select_good_frac_min 0.05"
+
+set common_opts = "$common_opts -select_warp_label $warp_label"
+set common_opts = "$common_opts -select_skycal_label $skycal_label"
+
+set common_opts = "$common_opts -simple"
+
+# set common_opts = "$common_opts -trace db 10"
+
+fftool $pretend $common_opts
Index: trunk/tools/eam/reprocess/unions.dr2.20190430/run.skycal
===================================================================
--- trunk/tools/eam/reprocess/unions.dr2.20190430/run.skycal	(revision 40818)
+++ trunk/tools/eam/reprocess/unions.dr2.20190430/run.skycal	(revision 40818)
@@ -0,0 +1,28 @@
+#!/bin/csh -f
+
+if ($#argv != 1) then
+  echo "USAGE: run.skycal [commit]"
+  exit 2
+endif
+
+if ("$1" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+set inlabel = "UNIONS.DR2.20190430"
+set outlabel = "UNIONS.DR2.20190430"
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -defineskycalrun"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/UNIONS.DR2.20190430.SKYCAL"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+
+set common_opts = "$common_opts -select_label $inlabel"
+set common_opts = "$common_opts -simple"
+
+staticskytool $pretend $common_opts
Index: trunk/tools/eam/reprocess/unions.dr2.20190430/run.stack
===================================================================
--- trunk/tools/eam/reprocess/unions.dr2.20190430/run.stack	(revision 40818)
+++ trunk/tools/eam/reprocess/unions.dr2.20190430/run.stack	(revision 40818)
@@ -0,0 +1,7 @@
+#!/bin/csh
+
+# neb://any/gpc1/UNIONS.DR2.20190430.STACK/CFIS.V0/skycell.000.245/CFIS.V0.skycell.000.245.stk.5408473
+
+stack_skycell.pl --threads 4 --stack_id 5408473 --outroot stacktest.t1 --run-state new --reduction THREEPI_STACK_1DG --dbname gpc1 --verbose --no-update --save-temps
+
+#  -input /tmp/CFIS.V0.skycell.000.245.stk.5408473.list.7Lt7 stacktest.t1 -stats stacktest.t1.stats -recipe PPSTACK STACK_THREEPI -recipe PPSUB STACK_1DG -recipe PSPHOT STACK -recipe PPSTATS STACKSTATS -stack-type DEEP_STACK -F PSPHOT.PSF.SAVE PSPHOT.PSF.SKY.SAVE -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF -F PSPHOT.BACKMDL PSPHOT.BACKMDL.MEF -F SOURCE.PLOT.MOMENTS SOURCE.PLOT.SKY.MOMENTS -F SOURCE.PLOT.PSFMODEL SOURCE.PLOT.SKY.PSFMODEL -F SOURCE.PLOT.APRESID SOURCE.PLOT.SKY.APRESID -R PPSTACK.OUTPUT FITS.TYPE COMP_STACK  -R PPSTACK.OUTPUT.VARIANCE FITS.TYPE COMP_STACK -R PPSTACK.UNCONV FITS.TYPE COMP_STACK -R PPSTACK.UNCONV.VARIANCE FITS.TYPE COMP_STACK -threads 4 -dbname gpc1 -image_id 5408473 -source_id 35 -stack_id 5408473 -skycell_id skycell.000.245 -tess_id CFIS.V0
Index: trunk/tools/eam/reprocess/unions.dr2.20190430/run.stacktool
===================================================================
--- trunk/tools/eam/reprocess/unions.dr2.20190430/run.stacktool	(revision 40818)
+++ trunk/tools/eam/reprocess/unions.dr2.20190430/run.stacktool	(revision 40818)
@@ -0,0 +1,56 @@
+#!/bin/csh -f
+
+if ($#argv != 2) then
+  echo "USAGE: run.stacktool (filter) [commit]"
+  exit 2
+endif
+
+if ("$2" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+set inlabel = "UNIONS.DR2.20190430"
+set outlabel = "UNIONS.DR2.20190430"
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -definebyquery"
+set common_opts = "$common_opts -select_label $inlabel"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+set common_opts = "$common_opts -min_num 4"
+set common_opts = "$common_opts -simple"
+
+# other filter options:
+# set common_opts = "$common_opts -select_astrom"
+# set common_opts = "$common_opts -select_zpt_obs_max"
+# set common_opts = "$common_opts -select_bg_max"
+# set common_opts = "$common_opts -select_bg_stdev_max"
+
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/UNIONS.DR2.20190430.STACK"
+
+set common_opts = "$common_opts  -set_reduction THREEPI_STACK_1DG"
+# set common_opts = "$common_opts  -set_reduction MD_REF_STACK_1DG" -- this requires PSF FWHM < 7.0
+# set common_opts = "$common_opts  -set_reduction MD_IQ_STACK_1DG"
+
+if ("$1" == "i") then
+  # this cuts ~ 9.5%
+  stacktool $pretend $common_opts -select_filter i.00000 -select_fwhm_major_max 9.0 -select_zpt_obs_min 24.4 
+  exit 0
+endif
+
+if ("$1" == "z") then
+  # this cuts ~ 20%
+  stacktool $pretend $common_opts -select_filter z.00000 -select_fwhm_major_max 9.0 -select_zpt_obs_min 24.2
+  exit 0
+endif  
+
+echo "unknown filter $1"
+exit 2
+
+# skycell_id skycell.187.268 is roughly in the center
+#echo stacktool $pretend $common_opts -select_filter i.00000 -select_zpt_obs_min 24.4 -select_fwhm_major_max 9.0 -select_skycell_id skycell.187.268
+#     stacktool $pretend $common_opts -select_filter i.00000 -select_zpt_obs_min 24.4 -select_fwhm_major_max 9.0 -select_skycell_id skycell.187.268
Index: trunk/tools/eam/reprocess/unions.dr2.20190430/run.staticskytool
===================================================================
--- trunk/tools/eam/reprocess/unions.dr2.20190430/run.staticskytool	(revision 40818)
+++ trunk/tools/eam/reprocess/unions.dr2.20190430/run.staticskytool	(revision 40818)
@@ -0,0 +1,62 @@
+#!/bin/csh -f
+
+if ($#argv != 1) then
+  echo "USAGE: run.staticskytool [commit]"
+  exit 2
+endif
+
+if ("$1" == "commit") then
+  set pretend = ""
+else
+  set pretend = "-pretend"
+endif
+
+set inlabel = "UNIONS.DR2.20190430"
+set outlabel = "UNIONS.DR2.20190430"
+
+set common_opts = ""
+set common_opts = "$common_opts -dbname gpc1"
+set common_opts = "$common_opts -definebyquery"
+set common_opts = "$common_opts -set_workdir neb://@HOST@.0/gpc1/UNIONS.DR2.20190430.STATICSKY"
+set common_opts = "$common_opts -set_label $outlabel"
+set common_opts = "$common_opts -set_data_group $outlabel"
+set common_opts = "$common_opts -set_dist_group $outlabel"
+set common_opts = "$common_opts -set_reduction STACKPHOT_EUCLID"
+
+set common_opts = "$common_opts -select_label $inlabel"
+# set common_opts = "$common_opts -ra_min 320"
+# set common_opts = "$common_opts -ra_max 340"
+set common_opts = "$common_opts -simple"
+
+# for UNIONS DR2, we only have i and z filters:
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter i.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter z.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter z.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter z.00000
+# staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter r.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter i.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter z.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter i.00000
+# staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter z.00000
+# staticskytool $pretend $common_opts  -select_filter r.00000 -select_filter y.00000
+staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter z.00000
+# staticskytool $pretend $common_opts  -select_filter i.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter z.00000 -select_filter y.00000
+# staticskytool $pretend $common_opts  -select_filter g.00000
+# staticskytool $pretend $common_opts  -select_filter r.00000
+staticskytool $pretend $common_opts  -select_filter i.00000
+staticskytool $pretend $common_opts  -select_filter z.00000
+# staticskytool $pretend $common_opts  -select_filter y.00000
