Index: trunk/ippScripts/scripts/diff_skycell.pl
===================================================================
--- trunk/ippScripts/scripts/diff_skycell.pl	(revision 16563)
+++ trunk/ippScripts/scripts/diff_skycell.pl	(revision 16741)
@@ -33,9 +33,9 @@
 use Pod::Usage qw( pod2usage );
 
-my ($diff_id, $dbname, $workdir, $verbose, $no_update, $no_op);
+my ($diff_id, $dbname, $outroot, $verbose, $no_update, $no_op);
 GetOptions(
     'diff_id|d=s'       => \$diff_id, # Diff identifier
     'dbname|d=s'        => \$dbname, # Database name
-    'workdir|w=s'       => \$workdir,	# Working directory, for output files
+    'outroot=s'         => \$outroot, # Output root name
     'verbose'           => \$verbose,   # Print to stdout
     'no-update'         => \$no_update,	# Don't update the database?
@@ -47,5 +47,6 @@
     -msg => "Required options: --diff_id",
     -exitval => 3,
-	  ) unless defined $diff_id;
+	  ) unless defined $diff_id
+    and defined $outroot;
 
 my $STATS = 
@@ -164,20 +165,17 @@
 
 # Get the output filenames
-$workdir = caturi( $workdir, "tess_" . $tess_id, "sky_" . $skycell_id ) if defined $workdir;
-my $outputRoot = $ipprc->file_prepare( "$tess_id.$skycell_id.dif$diff_id", $workdir, $input );
-my $outputName = $ipprc->filename("PPSUB.OUTPUT", $outputRoot);
-my $outputMask = $ipprc->filename("PPSUB.OUTPUT.MASK", $outputRoot);
-my $outputWeight = $ipprc->filename("PPSUB.OUTPUT.WEIGHT", $outputRoot);
-my $outputSources = $ipprc->filename("PSPHOT.OUTPUT", $outputRoot);
-#my $bin1Name =  $ipprc->filename("PPSUB.BIN1", $outputRoot);
-#my $bin2Name =  $ipprc->filename("PPSUB.BIN2", $outputRoot);
-my $outputStats = $outputRoot . '.stats';
-
-my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".trace"; # Trace messages
-my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".log"; # Log messages
+my $outputName = $ipprc->filename("PPSUB.OUTPUT", $outroot);
+my $outputMask = $ipprc->filename("PPSUB.OUTPUT.MASK", $outroot);
+my $outputWeight = $ipprc->filename("PPSUB.OUTPUT.WEIGHT", $outroot);
+my $outputSources = $ipprc->filename("PSPHOT.OUTPUT", $outroot);
+#my $bin1Name =  $ipprc->filename("PPSUB.BIN1", $outroot);
+#my $bin2Name =  $ipprc->filename("PPSUB.BIN2", $outroot);
+my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot);
+my $traceDest = $ipprc->filename("TRACE.EXP", $outroot);
+my $logDest = $ipprc->filename("LOG.EXP", $outroot);
 
 # Perform subtraction
 unless ($no_op) {
-    my $command = "$ppSub $input $template $outputRoot";
+    my $command = "$ppSub $input $template $outroot";
     $command .= " -inmask $inputMask";
     $command .= " -refmask $templateMask";
@@ -218,5 +216,5 @@
     # Add the subtraction result
     {
-	my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -path_base $outputRoot";
+	my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -path_base $outroot";
 	$command .= $stats->cmdflags();
 	$command .= " -dbname $dbname" if defined $dbname;
