IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26803


Ignore:
Timestamp:
Feb 6, 2010, 1:56:48 PM (16 years ago)
Author:
eugene
Message:

catch errors in input files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/20091201/ppSub/src/ppSubCamera.c

    r26649 r26803  
    2323
    2424// Define an input file
    25 static pmFPAfile *defineInputFile(pmConfig *config,// Configuration
     25static pmFPAfile *defineInputFile(bool *success,
     26                                  pmConfig *config,// Configuration
    2627                                  pmFPAfile *bind,    // File to which to bind, or NULL
    2728                                  char *filerule,     // Name of file rule
     
    3233    bool status;
    3334
     35    *success = false;
     36
    3437    // look for the file on the RUN metadata
    3538    pmFPAfile *file = pmFPAfileDefineFromRun(&status, bind, config, filerule); // File to return
     
    4750        if (!status) {
    4851            psError(PS_ERR_UNKNOWN, false, "Failed to load file definition for %s", filerule);
    49             return false;
     52            return NULL;
    5053        }
    5154    }
    5255
    5356    if (!file) {
     57        // no file defined
     58        *success = true;
    5459        return NULL;
    5560    }
     
    6065    }
    6166
     67    *success = true;
    6268    return file;
    6369}
     
    136142bool ppSubCamera(ppSubData *data)
    137143{
     144    bool success = true;
     145
    138146    psAssert(data, "Require processing data");
    139147    pmConfig *config = data->config;
     
    141149
    142150    // Input image
    143     pmFPAfile *input = defineInputFile(config, NULL, "PPSUB.INPUT", "INPUT", PM_FPA_FILE_IMAGE);
    144     if (!input) {
     151    pmFPAfile *input = defineInputFile(&success, config, NULL, "PPSUB.INPUT", "INPUT", PM_FPA_FILE_IMAGE);
     152    if (!success) {
    145153        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT");
    146154        return false;
    147155    }
    148     defineInputFile(config, input, "PPSUB.INPUT.MASK", "INPUT.MASK", PM_FPA_FILE_MASK);
    149     pmFPAfile *inVar = defineInputFile(config, input, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE",
    150                                        PM_FPA_FILE_VARIANCE);
    151     defineInputFile(config, NULL, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF);
     156
     157    defineInputFile(&success, config, input, "PPSUB.INPUT.MASK", "INPUT.MASK", PM_FPA_FILE_MASK);
     158    if (!success) {
     159        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.MASK");
     160        return false;
     161    }
     162
     163    pmFPAfile *inVar = defineInputFile(&success, config, input, "PPSUB.INPUT.VARIANCE", "INPUT.VARIANCE", PM_FPA_FILE_VARIANCE);
     164    if (!success) {
     165        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.VARIANCE");
     166        return false;
     167    }
     168
     169    defineInputFile(&success, config, NULL, "PPSUB.INPUT.SOURCES", "INPUT.SOURCES", PM_FPA_FILE_CMF);
     170    if (!success) {
     171        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.INPUT.SOURCES");
     172        return false;
     173    }
    152174
    153175    // Reference image
    154     pmFPAfile *ref = defineInputFile(config, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);
    155     if (!ref) {
     176    pmFPAfile *ref = defineInputFile(&success, config, NULL, "PPSUB.REF", "REF", PM_FPA_FILE_IMAGE);
     177    if (!success) {
    156178        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF");
    157179        return false;
    158180    }
    159     defineInputFile(config, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK);
    160     pmFPAfile *refVar = defineInputFile(config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE",
    161                                         PM_FPA_FILE_VARIANCE);
    162     defineInputFile(config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
    163 
     181
     182    defineInputFile(&success, config, ref, "PPSUB.REF.MASK", "REF.MASK", PM_FPA_FILE_MASK);
     183    if (!success) {
     184        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.MASK");
     185        return false;
     186    }
     187
     188    pmFPAfile *refVar = defineInputFile(&success, config, ref, "PPSUB.REF.VARIANCE", "REF.VARIANCE", PM_FPA_FILE_VARIANCE);
     189    if (!success) {
     190        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.VARIANCE");
     191        return false;
     192    }
     193
     194    defineInputFile(&success, config, NULL, "PPSUB.REF.SOURCES", "REF.SOURCES", PM_FPA_FILE_CMF);
     195    if (!success) {
     196        psError(PS_ERR_IO, false, "Failed to build FPA from PPSUB.REF.SOURCES");
     197        return false;
     198    }
    164199
    165200    // Now that the camera has been determined, we can read the recipe
Note: See TracChangeset for help on using the changeset viewer.