- Timestamp:
- Feb 4, 2023, 7:39:02 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20220316/ppSub/src/ppSubCamera.c
r42096 r42363 119 119 120 120 121 // Define an output file that will be used in a calculation 122 // This means it might already be available in the RUN metadata 121 // Define an output file that will be used in a calculation. This means it might already be 122 // available in the RUN metadata 123 124 // EAM 2022.10.14 : If the file is not found, treat it as if it did not exist in the input 125 // RUN metadata. Currently, this is only used in this file to select 126 // PPSUB.OUTPUT.KERNELS. 123 127 static pmFPAfile *defineCalcFile(pmConfig *config, // Configuration 124 128 pmFPAfile *bind, // File to which to bind, or NULL … … 133 137 pmFPAfile *file = pmFPAfileDefineFromRun(&status, NULL, config, filerule); // File to return 134 138 if (!status) { 135 psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule); 136 return NULL; 139 bool requireSubkernel = psMetadataLookupBool(NULL, config->arguments, "-require-subkernel"); 140 if (requireSubkernel) { 141 psError(psErrorCodeLast(), false, "Failed to load file definition for %s", filerule); 142 return NULL; 143 } else { 144 psWarning("Failed to load file definition for %s, regenerate", filerule); 145 } 137 146 } 138 147 file = pmFPAfileBindFromArgs(&status, bind, config, filerule, argname); … … 177 186 altconfig->user = psMemIncrRefCounter(config->user); // inherit from primary camera 178 187 altconfig->site = psMemIncrRefCounter(config->site); // inherit from primary camera 179 altconfig->system = psMemIncrRefCounter(config->system); // inherit from primary camera 188 189 psFree (altconfig->system); 190 altconfig->system = psMetadataCopy(NULL, config->system); // container for camera-specific recipe values (to be dropped) 180 191 181 192 psFree (altconfig->files); … … 188 199 altconfig->recipes = psMetadataCopy(NULL, config->recipes); // container for camera-specific recipe values (to be dropped) 189 200 190 # if (0) 191 // XXX ppStack seems to work without removing PSCAMERA 192 // remove PSCAMERA entries from *-SKYCELL cameras 193 // XXX make this optional to force matching cameras if desired? 201 // remove PSCAMERA entries from *-SKYCELL cameras. This allows skycell images from 202 // one camera to match those of another camera. XXX Make this optional to force 203 // matching cameras if desired? 194 204 bool mdok = false; 195 205 psMetadata *cameras = psMetadataLookupMetadata(&mdok, altconfig->system, "CAMERAS"); … … 229 239 psMetadataRemoveKey (rule, "PSCAMERA"); // allow any camera skycell to match 230 240 } 231 # endif 241 psFree (camerasIter); 232 242 233 243 return (altconfig); 244 } 245 246 bool ppSubCopyPSCamera (pmFPAfile *tgt, pmFPAfile *src) { 247 248 bool success; 249 psMetadata *ruleSrc = psMetadataLookupMetadata(&success, src->format, "RULE"); // one true format for skycells 250 psAssert (ruleSrc, "missing RULE in src->format"); 251 252 psString pscameraSrc = psMetadataLookupStr(&success, ruleSrc, "PSCAMERA"); // one true format for skycells 253 psAssert (pscameraSrc, "missing PSCAMERA in src file"); 254 255 psMetadata *ruleTgt = psMetadataLookupMetadata(&success, tgt->format, "RULE"); // one true format for skycells 256 psAssert (ruleTgt, "missing RULE in tgt->format"); 257 258 psMetadataAddStr (ruleTgt, PS_LIST_TAIL, "PSCAMERA", PS_META_REPLACE, "", pscameraSrc); 259 return true; 234 260 } 235 261 … … 271 297 // different camera than the input image. NOTE: there is no check that these two 272 298 // images match in terms of size, pixel scale, etc. That is up to the user. 299 // The temporary config structure has PSCAMERA entries removed from the SKYCELL rules 300 // to allow subtraction between cameras. 273 301 274 302 pmConfig *refconfig = pmConfigMakeTemp(config); 275 303 276 # if (0)277 // EAM TEST: can we bind the ref to the input to force the right skycell format?278 // Reference image279 pmFPAfile *ref = defineInputFile(&success, config, input, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);280 if (!success) {281 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF");282 return false;283 }284 # else285 304 // Reference image 286 305 pmFPAfile *ref = defineInputFile(&success, refconfig, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE); 287 306 if (!success) { 288 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF"); 289 return false; 290 } 291 # endif 292 307 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF"); 308 return false; 309 } 310 // Reference mask 293 311 defineInputFile(&success, refconfig, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK); 294 312 if (!success) { … … 296 314 return false; 297 315 } 298 316 // Reference variance 299 317 pmFPAfile *refVar = defineInputFile(&success, refconfig, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE); 300 318 if (!success) { … … 302 320 return false; 303 321 } 322 // copy ref->format(RULE) PSCAMERA from input->format(RULE) 323 ppSubCopyPSCamera (ref, input); 304 324 psFree (refconfig); 305 325 … … 308 328 pmConfig *srcconfig = pmConfigMakeTemp(config); 309 329 310 defineInputFile(&success, srcconfig, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF); 311 if (!success) { 312 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.SOURCES"); 313 return false; 314 } 330 // Sources input file (CMF) 331 pmFPAfile *src = defineInputFile(&success, srcconfig, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF); 332 if (!success) { 333 psError(psErrorCodeLast(), false, "Failed to build FPA from PPSUB.REF.SOURCES"); 334 return false; 335 } 336 // XXX do we need to copy the PSCAMERA across to src? 337 ppSubCopyPSCamera (src, input); 315 338 psFree (srcconfig); 316 339
Note:
See TracChangeset
for help on using the changeset viewer.
