Index: /tags/ipp-pv3-20140717/ippconfig/recipes/ppImage.config
===================================================================
--- /tags/ipp-pv3-20140717/ippconfig/recipes/ppImage.config	(revision 37767)
+++ /tags/ipp-pv3-20140717/ippconfig/recipes/ppImage.config	(revision 37768)
@@ -164,4 +164,76 @@
 
 DETREND.CONSTRAINTS  METADATA
+END
+
+# Detrend database options
+
+DETREND.LOCATIONS METADATA
+  XY01    STR   stsci00.0
+  XY02    STR   stsci00.1
+  XY03    STR   stsci00.2
+  XY04    STR   stsci01.0
+  XY05    STR   stsci01.1
+  XY06    STR   stsci01.2
+
+  XY10    STR   stsci02.0
+  XY11    STR   stsci02.1
+  XY12    STR   stsci02.2
+  XY13    STR   stsci03.0
+  XY14    STR   stsci03.1
+  XY15    STR   stsci03.2
+  XY16    STR   stsci04.0
+  XY17    STR   stsci04.1
+
+  XY20    STR   stsci04.2
+  XY21    STR   stsci05.0
+  XY22    STR   stsci05.1
+  XY23    STR   stsci05.2
+  XY24    STR   stsci06.0
+  XY25    STR   stsci06.1
+  XY26    STR   stsci06.2
+  XY27    STR   stsci07.0
+
+  XY30    STR   stsci07.1
+  XY31    STR   stsci07.2
+  XY32    STR   stsci08.0
+  XY33    STR   stsci08.1
+  XY34    STR   stsci08.2
+  XY35    STR   stsci09.0
+  XY36    STR   stsci09.1
+  XY37    STR   stsci09.2
+
+  XY40    STR   stsci10.0
+  XY41    STR   stsci10.1
+  XY42    STR   stsci10.2
+  XY43    STR   stsci11.0
+  XY44    STR   stsci11.1
+  XY45    STR   stsci11.2
+  XY46    STR   stsci12.0
+  XY47    STR   stsci12.1
+
+  XY50    STR   stsci12.2
+  XY51    STR   stsci13.0
+  XY52    STR   stsci13.1
+  XY53    STR   stsci13.2
+  XY54    STR   stsci14.0
+  XY55    STR   stsci14.1
+  XY56    STR   stsci14.2
+  XY57    STR   stsci15.0
+
+  XY60    STR   stsci15.1
+  XY61    STR   stsci15.2
+  XY62    STR   stsci16.0
+  XY63    STR   stsci16.1
+  XY64    STR   stsci16.2
+  XY65    STR   stsci17.0
+  XY66    STR   stsci17.1
+  XY67    STR   stsci17.2
+
+  XY71    STR   stsci18.2
+  XY72    STR   stsci18.0
+  XY73    STR   stsci18.1
+  XY74    STR   stsci19.2
+  XY75    STR   stsci19.0
+  XY76    STR   stsci19.1
 END
 
Index: /tags/ipp-pv3-20140717/psModules/src/detrend/pmDetrendDB.c
===================================================================
--- /tags/ipp-pv3-20140717/psModules/src/detrend/pmDetrendDB.c	(revision 37767)
+++ /tags/ipp-pv3-20140717/psModules/src/detrend/pmDetrendDB.c	(revision 37768)
@@ -356,4 +356,34 @@
     psTrace("psModules.detrend", 5, "detrend file: %s\n", result);
 
+    char *is_nebulous = strstr(result,"neb://");
+    if (is_nebulous) { // This file matches the nebulous string
+      psString truncated = psStringCopy(is_nebulous + 6);
+      //      printf("A: %s %s\n",result,truncated);
+      psMetadata *recipe = psMetadataLookupMetadata(NULL, config->recipes,"PPIMAGE");
+      psMetadata *detloc = psMetadataLookupMetadata(NULL, recipe, "DETREND.LOCATIONS");
+      if (detloc) { // This exists, so we have the information.
+	psString location = psMetadataLookupStr(NULL, detloc,classID);
+	//	printf("B: %s %s\n", classID,location);
+	if (location) { // Found a location
+	  psString ext_key = strstr(truncated,"/"); // Find the first '/'
+	  //	  printf("C: %s\n", ext_key);
+	  if (ext_key) {
+	    psString copyBecauseReasons = psStringCopy(ext_key);
+	    psStringPrepend(&copyBecauseReasons,"neb://%s",location);
+	    //	    printf("D: %s\n",copyBecauseReasons);
+	    psFree(result); // Yes, because we are going to reallocate a clean copy of cBR to this object.
+	    result = psStringCopy(copyBecauseReasons);
+	    //	    psFree(ext_key); // No, because this is just a pointer into some other memory space.
+	    psTrace("psModules.detrend", 5, "altered detrend file: %s\n", result);
+	    psFree(copyBecauseReasons); // Yes, because we copied this to the output object, and so we don't need this any more.
+	  }
+	  //	  psFree(location);  // Don't free this because the string lookup isn't a copy, so it deletes it from the config structure entirely.
+	}
+      }
+      //      psFree(is_nebulous);  // No, because this is just a pointer into some other memory space.
+      psFree(truncated);
+    }
+	  
+    
     psFree (answer);
     psFree (pipe);
