Index: trunk/ippScripts/scripts/warp_skycell.pl
===================================================================
--- trunk/ippScripts/scripts/warp_skycell.pl	(revision 14391)
+++ trunk/ippScripts/scripts/warp_skycell.pl	(revision 14567)
@@ -94,4 +94,19 @@
 }
 
+# Where do we get the astrometry source from?
+my $astromSource;		# The astrometry source
+{
+    my $command = "$ppConfigDump -camera $camera -dump-recipe PSWARP -";
+    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 ppConfigDump: $error_code", $warp_id, $error_code);
+    }
+    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
+	&my_die("Unable to parse metadata config doc", $warp_id, $PS_EXIT_PROG_ERROR);
+    $astromSource = metadataLookupStr('ASTROM.SOURCE');
+}
+
 $workdir = caturi( $workdir, "tess_" . $tess_id, "sky_" . $skycell_id ) if defined $workdir;
 my $outputRoot = $ipprc->file_prepare( "$tess_id.$skycell_id.wrp$warp_id", $workdir, $$imfiles[0]->{uri} );
@@ -113,14 +128,19 @@
     my $mask = $ipprc->filename("PPIMAGE.CHIP.MASK", $imfile->{chip_path_base}, $imfile->{class_id}); # Mask name
     my $weight = $ipprc->filename("PPIMAGE.CHIP.WEIGHT", $imfile->{chip_path_base}, $imfile->{class_id}); # Mask name
-   my $astrom = $ipprc->filename("PSASTRO.OUTPUT.MEF", $imfile->{cam_path_base}); # Astrometry file name
 
     &my_die("Couldn't find input file: $image", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($image);
     &my_die("Couldn't find input file: $mask", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($mask);
-    &my_die("Couldn't find input file: $astrom", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($astrom);
+
+    my $astrom;			# Astrometry file
+    if ($astromSource and $astromSource ne 'NULL') {
+	$astrom = $ipprc->filename($astromSource, $imfile->{cam_path_base});
+	&my_die("Couldn't find input file: $astrom", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($astrom);
+    }
 
     print $imageFile ( $image . "\n");
     print $maskFile ( $mask  . "\n");
     print $weightFile ( $weight  . "\n");
-    if (defined $inputAstrom) {
+
+    if (defined $inputAstrom and defined $astrom) {
 	&my_die("Astrometry files don't match: $inputAstrom vs $astrom", $warp_id, $skycell_id, $tess_id, $PS_EXIT_SYS_ERROR) unless $inputAstrom eq $astrom;
     } else {
@@ -137,5 +157,5 @@
     $command .= " -masklist $maskName";
     $command .= " -weightlist $weightName";
-    $command .= " -astrom $inputAstrom";
+    $command .= " -astrom $inputAstrom" if defined $inputAstrom;
     $command .= " $outputRoot $skyFile";
     $command .= " -stats $outputStats";
