Index: trunk/pstamp/scripts/pstamp_checkdependent.pl
===================================================================
--- trunk/pstamp/scripts/pstamp_checkdependent.pl	(revision 36688)
+++ trunk/pstamp/scripts/pstamp_checkdependent.pl	(revision 36700)
@@ -22,4 +22,6 @@
 
 my $disable_3PI_updates = 1;
+my $ra_max_3PI_hours = 21;                              # disable updates for skycells with ra greater than this (hours)
+my $ra_max_3PI = $ra_max_3PI_hours * 15 / 180 * 3.14149; # rawExp.ra is in radians
 
 # XXX: put this in a module somewhere
@@ -260,7 +262,12 @@
 
         if ($disable_3PI_updates && ($chip->{data_group} =~ /ThreePi/)) {
-            # we are getting close to the end of PV2. Do not update PV1 chips.
-            print "3PI updates are currently disabled\n";
-            return $PSTAMP_NOT_AVAILABLE;
+            # we are getting close to the end of PV2. Do not update PV1 chips if RA is above the limit.
+            my $ra = $chip->{ra};
+            if (!defined($ra) or ($ra > $ra_max_3PI)) {
+                print "3PI updates are currently disabled for RA $ra > $ra_max_3PI (radians)\n";
+                return $PSTAMP_NOT_AVAILABLE;
+            } else {
+                print "allowing 3PI updates RA $ra\n";
+            }
         } 
 
@@ -381,6 +388,11 @@
     # we are getting close to the end of PV2. optionally do not update 3Pi data.
     if ($disable_3PI_updates && ($metadata->{data_group} =~ /ThreePi/)) {
-        print "3PI updates are currently disabled\n";
-        return $PSTAMP_NOT_AVAILABLE;
+        my $ra = $metadata->{ra};
+        if (!defined $ra or ($ra > $ra_max_3PI)) {
+            print "3PI updates are currently disabled for RA $ra > $ra_max_3PI (radians)\n";
+            return $PSTAMP_NOT_AVAILABLE;
+        } else {
+            print "allowing 3PI updates RA $ra\n";
+        }
     } 
 
@@ -465,4 +477,7 @@
         }
         $chip_id = $chip->{chip_id};
+        # XXX: -scmap doesn't have ra and dec. Copy it from the warp
+        $chip->{ra} = $metadata->{ra};
+        $chip->{decl} = $metadata->{decl};
 
         # if chip has been magicked before require it to be magicked again
