Index: /trunk/ippScripts/scripts/warp_overlap.pl
===================================================================
--- /trunk/ippScripts/scripts/warp_overlap.pl	(revision 14690)
+++ /trunk/ippScripts/scripts/warp_overlap.pl	(revision 14691)
@@ -89,4 +89,5 @@
 my $astromSource;		# The astrometry source
 my $astromAccept;		# Accept the astrometry unconditionally?
+my $astromDepth;		# File level of the astrometry source (SPLIT or MEF)?
 {
     my $command = "$ppConfigDump -camera $camera -dump-recipe PSWARP -";
@@ -101,4 +102,5 @@
     $astromSource = metadataLookupStr($metadata, 'ASTROM.SOURCE');
     $astromAccept = metadataLookupBool($metadata, 'ASTROM.ACCEPT');
+    $astromDepth  = metadataLookupStr($metadata, 'ASTROM.DEPTH');
 }
 
@@ -172,4 +174,8 @@
 }
 
+# XXX this file needs some additional error checking: if no overlaps are found, we
+# keep running this step over and over (a successful warptool -addoverlap prevents 
+# successive warptime -imfile from running.
+
 # Generate a MDC file with the overlaps
 my ($overlapFile, $overlapName) = tempfile( 'overlaps.wrp' . $warp_id . '.mdc.XXXX', UNLINK => 1 );
@@ -255,17 +261,20 @@
     my $fileLevel = $imfile->{filelevel};
     my $entry;	# How to identify this imfile in the dvoImageOverlaps output
-    if (lc($fileLevel) eq "chip") {
+    if ((lc($fileLevel) eq "chip") && (lc($astromDepth) eq "MEF")) {
 	my $class_id = $imfile->{class_id};
 	my $chipRoot = $ipprc->file_resolve( $imfile->{chip_path_base} );
 	my $extname = $ipprc->extname_rule("CMF.HEAD", $class_id); # MEF psastro output
 	
-	print STDERR "class: $class_id, chiproot: $chipRoot, extname: $extname\n";
 	
 	$entry = $filename . '\[' . $extname . '\]';
+	print STDERR "class: $class_id, entry: $entry, extname: $extname, chiproot: $chipRoot\n";
     } else {
 	$entry = $filename;
+	print STDERR "class: $class_id, entry: $entry\n";
     }
 
     my @skycells = &select_skycells($entry, @$matches);	# Matching skycells
+    my $Nskycells = @skycells;
+    printf STDERR "Nskycells: $Nskycells\n";
     foreach my $skycell (@skycells) {
 	my %overlap = ();	# Overlap information for warptool
