Index: trunk/ippScripts/scripts/warp_overlap.pl
===================================================================
--- trunk/ippScripts/scripts/warp_overlap.pl	(revision 15691)
+++ trunk/ippScripts/scripts/warp_overlap.pl	(revision 16020)
@@ -50,8 +50,9 @@
 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
 pod2usage(
-    -msg => "Required options: --warp_id --camera",
+    -msg => "Required options: --warp_id --camera --workdir",
     -exitval => 3,
 ) unless defined $warp_id
-    and defined $camera;
+    and defined $camera
+    and define $workdir;
 
 $ipprc->define_camera($camera);
@@ -125,6 +126,7 @@
 	my %unique_skycells = (); # Identified skycells (all unique by virtue of hash property)
 	
-	if ($astromSource and $astromSource ne 'NULL') {
-	    # We have an astrometry file from psastro
+	# XXX this is a bit too hard wired: the concept is that astrometry comes from the MOSAIC vs CHIP output
+	if ($astromSource eq 'PSASTRO.OUTPUT.MEF') {
+	    # We have a MEF astrometry file from psastro
 	    my $imfile = $imfiles->[0];
 	    my $camRoot = $imfile->{cam_path_base};
@@ -132,5 +134,7 @@
 	    
 	    my @matchlist = get_overlaps($astromFile, $tess_dir, $astromAccept); # List of overlaps
-	    
+	    if (! @matchlist) {
+		&my_die("Unable to perform dvoImageOverlaps: missing astrometry", $warp_id, $PS_EXIT_DATA_ERROR);
+	    }	    
 	    # Match each of the imfiles to this list
 	    foreach my $imfile (@$imfiles) {
@@ -138,8 +142,19 @@
 	    }
 	} else {
-	    # We have the imfiles themselves for the WCS
+	    # We have per-imfile astrometry
 	    foreach my $imfile (@$imfiles) {
-		my $astromFile = $imfile->{chip_uri}; # Astrometry file
+		my $astromFile;
+		if ($astromSource eq 'PSASTRO.OUTPUT') {
+		    my $chipRoot = $imfile->{chip_path_base};
+		    my $classID = $imfile->{class_id};
+		    $astromFile = $ipprc->filename($astromSource, $chipRoot, $classID); # Astrometry file
+		} else {
+		    $astromFile = $imfile->{chip_uri}; # Astrometry file
+		}
 		my @matchlist = get_overlaps($astromFile, $tess_dir, $astromAccept); # List of overlaps
+		if (! @matchlist) {
+		    print "skipping $astromFile\n";
+		}	    
+
 		extract_overlaps(\@matchlist, $imfile, $astromFile, $tess_id, \@overlaps, \%unique_skycells);
 	    }
@@ -222,7 +237,7 @@
     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
 	run(command => $command, verbose => 1);
-    unless ($success) {
-	$error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	&my_die("Unable to perform dvoImageOverlaps: $error_code", $warp_id, $error_code);
+    if (!$success) {
+	print "missing astrometry for $filename\n";
+	return 0;
     }
     return split ('\n', (join "", @$stdout_buf));
