Index: branches/czw_branch/20100519/ippScripts/scripts/skycell_jpeg.pl
===================================================================
--- branches/czw_branch/20100519/ippScripts/scripts/skycell_jpeg.pl	(revision 28164)
+++ branches/czw_branch/20100519/ippScripts/scripts/skycell_jpeg.pl	(revision 28245)
@@ -32,11 +32,11 @@
     'save_temps'      => \$save_temps,
     'masks'           => \$masks,
-    'no-op'           => \$no_op,
-    'no-update'       => \$no_update,
+#    'no-op'           => \$no_op,
+#    'no-update'       => \$no_update,
     ) or pod2usage ( 2 );
 
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2) if @ARGV;
 pod2usage(
-    -msg => "Required options: --stage --stage_id --outroot",
+    -msg => "Required options: --stage --stage_id --outroot\nHelpful options: --camera --dbname",
     -exitval => 3,
     ) unless
@@ -80,42 +80,42 @@
 	my $quality    = $imfile->{quality};
 	my $state      = $imfile->{data_state};
-	my $tangent_base = $skycell_id;
+	my $projection_cell = $skycell_id;
 	if ($quality == 8007 or $state ne 'full') {
 	    next;
 	}
 
-	$tangent_base =~ s/^(.*)\..*$/$1/;
-	
-	unless (exists($tangents{$tangent_base})) {
+	$projection_cell =~ s/^(.*)\..*$/$1/;
+	
+	unless (exists($tangents{$projection_cell})) {
 	    # Make a temp file and fill, but be sure to save 
-	    ($tempFile, $tempName) = tempfile("/tmp/skycell.$tangent_base.XXXX",
+	    ($tempFile, $tempName) = tempfile("/tmp/skycell.$projection_cell.XXXX",
 						 UNLINK => !$save_temps);
-	    $tangents{$tangent_base}{FILE} = $tempFile;
-	    $tangents{$tangent_base}{NAME} = $tempName;
+	    $tangents{$projection_cell}{FILE} = $tempFile;
+	    $tangents{$projection_cell}{NAME} = $tempName;
 	    if ($masks) {
-		my ($maskFile, $maskName) = tempfile("/tmp/skycell.$tangent_base.masks.XXXX",
+		my ($maskFile, $maskName) = tempfile("/tmp/skycell.$projection_cell.masks.XXXX",
 						     UNLINK => !$save_temps);
-		$tangents{$tangent_base}{MFILE} = $maskFile;
-		$tangents{$tangent_base}{MNAME} = $maskName;
+		$tangents{$projection_cell}{MFILE} = $maskFile;
+		$tangents{$projection_cell}{MNAME} = $maskName;
 	    }		
 	}
-	print "$skycell_id $tangent_base\n";	
+	print "$skycell_id $projection_cell\n";	
 	my $file = $ipprc->filename("PSWARP.OUTPUT", $path_base, $skycell_id);
 	print "$file $state $quality\n";
-	my $f_fh = $tangents{$tangent_base}{FILE};
+	my $f_fh = $tangents{$projection_cell}{FILE};
 	print $f_fh "$file\n";
 	if ($masks) {
 	    my $mask = $ipprc->filename("PSWARP.OUTPUT.MASK", $path_base, $skycell_id);
 	    print "$mask\n";
-	    my $m_fh = $tangents{$tangent_base}{MFILE};
+	    my $m_fh = $tangents{$projection_cell}{MFILE};
 	    print $m_fh "$mask\n";
 	}
     }
-    foreach my $tangent_base (keys %tangents) {
-	$command = "$ppSkycell -images $tangents{$tangent_base}{NAME}";
-	if ($masks) {
-	    $command .= " -masks $tangents{$tangent_base}{MNAME} ";
-	}
-	$command .= " ${outroot}.${tangent_base} ";
+    foreach my $projection_cell (keys %tangents) {
+	$command = "$ppSkycell -images $tangents{$projection_cell}{NAME}";
+	if ($masks) {
+	    $command .= " -masks $tangents{$projection_cell}{MNAME} ";
+	}
+	$command .= " ${outroot}.${projection_cell} ";
 	print "$command\n";
 	( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
@@ -125,5 +125,5 @@
 	}
 	# Update database:
-	$command = "$warptool -addsummary -warp_id $stage_id -tangent_base $tangent_base -outroot $outroot";
+	$command = "$warptool -addsummary -warp_id $stage_id -projection_cell $projection_cell -outroot $outroot";
 	if (defined($dbname)) {
 	    $command .= " -dbname $dbname";
@@ -164,42 +164,42 @@
 	my $quality    = $imfile->{quality};
 	my $state      = $imfile->{data_state};
-	my $tangent_base = $skycell_id;
+	my $projection_cell = $skycell_id;
 	if ($quality == 8007 or $state ne 'full') {
 	    next;
 	}
 
-	$tangent_base =~ s/^(.*)\..*$/$1/;
-	
-	unless (exists($tangents{$tangent_base})) {
+	$projection_cell =~ s/^(.*)\..*$/$1/;
+	
+	unless (exists($tangents{$projection_cell})) {
 	    # Make a temp file and fill, but be sure to save 
-	    ($tempFile, $tempName) = tempfile("/tmp/skycell.$tangent_base.XXXX",
+	    ($tempFile, $tempName) = tempfile("/tmp/skycell.$projection_cell.XXXX",
 						 UNLINK => !$save_temps);
-	    $tangents{$tangent_base}{FILE} = $tempFile;
-	    $tangents{$tangent_base}{NAME} = $tempName;
+	    $tangents{$projection_cell}{FILE} = $tempFile;
+	    $tangents{$projection_cell}{NAME} = $tempName;
 	    if ($masks) {
-		my ($maskFile, $maskName) = tempfile("/tmp/skycell.$tangent_base.masks.XXXX",
+		my ($maskFile, $maskName) = tempfile("/tmp/skycell.$projection_cell.masks.XXXX",
 						     UNLINK => !$save_temps);
-		$tangents{$tangent_base}{MFILE} = $maskFile;
-		$tangents{$tangent_base}{MNAME} = $maskName;
+		$tangents{$projection_cell}{MFILE} = $maskFile;
+		$tangents{$projection_cell}{MNAME} = $maskName;
 	    }		
 	}
-	print "$skycell_id $tangent_base\n";	
+	print "$skycell_id $projection_cell\n";	
 	my $file = $ipprc->filename("PPSUB.OUTPUT", $path_base, $skycell_id);
 	print "$file $state $quality\n";
-	my $f_fh = $tangents{$tangent_base}{FILE};
+	my $f_fh = $tangents{$projection_cell}{FILE};
 	print $f_fh "$file\n";
 	if ($masks) {
 	    my $mask = $ipprc->filename("PPSUB.OUTPUT.MASK", $path_base, $skycell_id);
 	    print "$mask\n";
-	    my $m_fh = $tangents{$tangent_base}{MFILE};
+	    my $m_fh = $tangents{$projection_cell}{MFILE};
 	    print $m_fh "$mask\n";
 	}
     }
-    foreach my $tangent_base (keys %tangents) {
-	$command = "$ppSkycell -images $tangents{$tangent_base}{NAME}";
-	if ($masks) {
-	    $command .= " -masks $tangents{$tangent_base}{MNAME} ";
-	}
-	$command .= " ${outroot}.${tangent_base} ";
+    foreach my $projection_cell (keys %tangents) {
+	$command = "$ppSkycell -images $tangents{$projection_cell}{NAME}";
+	if ($masks) {
+	    $command .= " -masks $tangents{$projection_cell}{MNAME} ";
+	}
+	$command .= " ${outroot}.${projection_cell} ";
 	print "$command\n";
 	( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
@@ -209,5 +209,5 @@
 	}
 	# Update database:
-	$command = "$difftool -addsummary -diff_id $stage_id -tangent_base $tangent_base -outroot $outroot";
+	$command = "$difftool -addsummary -diff_id $stage_id -projection_cell $projection_cell -outroot $outroot";
 	if (defined($dbname)) {
 	    $command .= " -dbname $dbname";
@@ -248,42 +248,42 @@
 	my $quality    = $imfile->{quality};
 	my $state      = $imfile->{data_state};
-	my $tangent_base = $skycell_id;
+	my $projection_cell = $skycell_id;
 	if ($quality == 8007 or $state ne 'full') {
 	    next;
 	}
 
-	$tangent_base =~ s/^(.*)\..*$/$1/;
-	
-	unless (exists($tangents{$tangent_base})) {
+	$projection_cell =~ s/^(.*)\..*$/$1/;
+	
+	unless (exists($tangents{$projection_cell})) {
 	    # Make a temp file and fill, but be sure to save 
-	    ($tempFile, $tempName) = tempfile("/tmp/skycell.$tangent_base.XXXX",
+	    ($tempFile, $tempName) = tempfile("/tmp/skycell.$projection_cell.XXXX",
 						 UNLINK => !$save_temps);
-	    $tangents{$tangent_base}{FILE} = $tempFile;
-	    $tangents{$tangent_base}{NAME} = $tempName;
+	    $tangents{$projection_cell}{FILE} = $tempFile;
+	    $tangents{$projection_cell}{NAME} = $tempName;
 	    if ($masks) {
-		my ($maskFile, $maskName) = tempfile("/tmp/skycell.$tangent_base.masks.XXXX",
+		my ($maskFile, $maskName) = tempfile("/tmp/skycell.$projection_cell.masks.XXXX",
 						     UNLINK => !$save_temps);
-		$tangents{$tangent_base}{MFILE} = $maskFile;
-		$tangents{$tangent_base}{MNAME} = $maskName;
+		$tangents{$projection_cell}{MFILE} = $maskFile;
+		$tangents{$projection_cell}{MNAME} = $maskName;
 	    }		
 	}
-	print "$skycell_id $tangent_base\n";	
+	print "$skycell_id $projection_cell\n";	
 	my $file = $ipprc->filename("PPSTACK.OUTPUT", $path_base, $skycell_id);
 	print "$file $state $quality\n";
-	my $f_fh = $tangents{$tangent_base}{FILE};
+	my $f_fh = $tangents{$projection_cell}{FILE};
 	print $f_fh "$file\n";
 	if ($masks) {
 	    my $mask = $ipprc->filename("PPSTACK.OUTPUT.MASK", $path_base, $skycell_id);
 	    print "$mask\n";
-	    my $m_fh = $tangents{$tangent_base}{MFILE};
+	    my $m_fh = $tangents{$projection_cell}{MFILE};
 	    print $m_fh "$mask\n";
 	}
     }
-    foreach my $tangent_base (keys %tangents) {
-	$command = "$ppSkycell -images $tangents{$tangent_base}{NAME}";
-	if ($masks) {
-	    $command .= " -masks $tangents{$tangent_base}{MNAME} ";
-	}
-	$command .= " ${outroot}.${tangent_base} ";
+    foreach my $projection_cell (keys %tangents) {
+	$command = "$ppSkycell -images $tangents{$projection_cell}{NAME}";
+	if ($masks) {
+	    $command .= " -masks $tangents{$projection_cell}{MNAME} ";
+	}
+	$command .= " ${outroot}.${projection_cell} ";
 	print "$command\n";
 	( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose);
@@ -293,5 +293,5 @@
 	}
 	# Update database:
-	$command = "$stacktool -addsummary -stack_id $stage_id -tangent_base $tangent_base -outroot $outroot";
+	$command = "$stacktool -addsummary -stack_id $stage_id -projection_cell $projection_cell -outroot $outroot";
 	if (defined($dbname)) {
 	    $command .= " -dbname $dbname";
