Index: trunk/ippScripts/scripts/diff_skycell.pl
===================================================================
--- trunk/ippScripts/scripts/diff_skycell.pl	(revision 20928)
+++ trunk/ippScripts/scripts/diff_skycell.pl	(revision 20973)
@@ -27,23 +27,25 @@
 use Pod::Usage qw( pod2usage );
 
-my ($diff_id, $diff_skyfile_id, $dbname, $threads, $outroot, $reduction, $verbose, $no_update, $no_op, $redirect);
+my ($diff_id, $dbname, $threads, $outroot, $reduction, $verbose, $no_update, $no_op, $redirect);
+my $skycell_id;                 # Skycell identifier
 GetOptions(
-    'diff_id|d=s'         => \$diff_id, # Diff identifier
-    'diff_skyfile_id|d=s' => \$diff_skyfile_id, # Unique skyfile identifier
-    'dbname|d=s'          => \$dbname, # Database name
-    'threads=s'           => \$threads,   # Number of threads to use
-    'outroot=s'           => \$outroot, # Output root name
-    'reduction=s'         => \$reduction, # Reduction class
-    'verbose'             => \$verbose,   # Print to stdout
-    'no-update'           => \$no_update, # Don't update the database?
-    'no-op'               => \$no_op, # Don't do any operations?
-    'redirect-output'     => \$redirect,
+    'diff_id=s'         => \$diff_id, # Diff identifier
+    'skycell_id=s'      => \$skycell_id, # Diff identifier
+    'dbname|d=s'        => \$dbname, # Database name
+    'threads=s'         => \$threads,   # Number of threads to use
+    'outroot=s'         => \$outroot, # Output root name
+    'reduction=s'       => \$reduction, # Reduction class
+    'verbose'           => \$verbose,   # Print to stdout
+    'no-update'         => \$no_update, # Don't update the database?
+    'no-op'             => \$no_op, # Don't do any operations?
+    'redirect-output'   => \$redirect,
 ) or pod2usage( 2 );
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 pod2usage(
-    -msg => "Required options: --diff_id --outroot",
+    -msg => "Required options: --diff_id --skycell_id --outroot",
     -exitval => 3,
           ) unless defined $diff_id
+    and defined $skycell_id
     and defined $outroot;
 
@@ -53,7 +55,4 @@
 my $logDest = "$outroot.log";
 $ipprc->redirect_output($logDest) if $redirect;
-
-my $image_id = $diff_skyfile_id;
-my $source_id = $ipprc->source_id($dbname, $PS_TABLE_ID_DIFF);
 
 # Look for programs we need
@@ -71,5 +70,5 @@
 my $files;
 {
-    my $command = "$difftool -inputskyfile -diff_id $diff_id";
+    my $command = "$difftool -inputskyfile -diff_id $diff_id -skycell_id $skycell_id";
     $command .= " -dbname $dbname" if defined $dbname;
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -93,5 +92,4 @@
 my ($template, $templateMask, $templateWeight, $templatePath, $templateSources); # Template files and path
 my $tess_id;                    # Tesselation identifier
-my $skycell_id;                 # Skycell identifier
 my $camera;                     # Camera
 foreach my $file (@$files) {
@@ -214,6 +212,4 @@
     $command .= " -dumpconfig $configuration";
     $command .= " -dbname $dbname" if defined $dbname;
-    # $command .= " -image_id $image_id" if defined $image_id;
-    # $command .= " -source_id $source_id" if defined $source_id;
 
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
@@ -226,5 +222,5 @@
     &my_die("Couldn't find expected output file: $outputMask", $diff_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
     &my_die("Couldn't find expected output file: $outputWeight", $diff_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
-    &my_die("Couldn't find expected output file: $outputSources", $diff_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
+#    &my_die("Couldn't find expected output file: $outputSources", $diff_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources);
 #    &my_die("Couldn't find expected output file: $bin1Name",    $diff_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin1Name);
 #    &my_die("Couldn't find expected output file: $bin2Name",    $diff_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin2Name);
@@ -251,5 +247,5 @@
     # Add the subtraction result
     {
-        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -path_base $outroot";
+        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -skycell_id $skycell_id -uri $outputName -path_base $outroot";
         $command .= " $cmdflags";
         $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
@@ -275,5 +271,5 @@
     warn($msg);
     if (defined $diff_id and not $no_update) {
-        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -code $exit_code";
+        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -skycell_id $skycell_id -code $exit_code";
         $command .= (" -dtime_script " . ((DateTime->now->mjd - $mjd_start) * 86400));
         $command .= " -hostname $host" if defined $host;
