IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17489


Ignore:
Timestamp:
Apr 28, 2008, 11:13:46 AM (18 years ago)
Author:
eugene
Message:

load FITSTYPES from external recipe file; merge into camera config

Location:
trunk/psModules/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAfileDefine.c

    r16611 r17489  
    172172    }
    173173
    174     psMetadata *data = pmConfigFileRule(config, camera, name); // File rule
    175     if (!data) {
     174    psMetadata *filerule = pmConfigFileRule(config, camera, name); // File rule
     175    if (!filerule) {
    176176        psError(PS_ERR_IO, true, "Can't find file rule %s!", name);
    177177        return NULL;
     
    183183    file->name = psStringCopy(name);
    184184
    185     file->filerule = psMemIncrRefCounter(psMetadataLookupStr(&status, data, "FILENAME.RULE"));
    186 
    187     const char *type = psMetadataLookupStr(&status, data, "FILE.TYPE");
     185    // this is the filename rule
     186    file->filerule = psMemIncrRefCounter(psMetadataLookupStr(&status, filerule, "FILENAME.RULE"));
     187
     188    const char *type = psMetadataLookupStr(&status, filerule, "FILE.TYPE");
    188189    file->type = pmFPAfileTypeFromString(type);
    189190    if (file->type == PM_FPA_FILE_NONE) {
     
    214215    if (!formatName || strlen(formatName) == 0) {
    215216        // select the format list from the selected camera
    216         formatName = psMetadataLookupStr(&status, data, "FILE.FORMAT");
     217        formatName = psMetadataLookupStr(&status, filerule, "FILE.FORMAT");
    217218        if (!formatName || strcmp(formatName, "NONE") == 0) {
    218219            // Try to get by with the default
     
    238239
    239240    // Get FITS output scheme
    240     const char *fitsType = psMetadataLookupStr(&status, data, "FITS.TYPE"); // Name of FITS scheme to use
     241    const char *fitsType = psMetadataLookupStr(&status, filerule, "FITS.TYPE"); // Name of FITS scheme to use
    241242    if (fitsType && strcasecmp(fitsType, "NONE") != 0) {
    242         psMetadata *fitsTypes = psMetadataLookupMetadata(&status, camera, "FITS"); // The FITS schemes
    243         if (!fitsTypes) {
    244             psWarning("Unable to find FITS in camera configuration.");
    245             goto FITS_OPTIONS_DONE;
    246         }
    247         psMetadata *scheme = psMetadataLookupMetadata(NULL, fitsTypes, fitsType); // FITS scheme
     243
     244        // load the FITSTYPE scheme for this file
     245        psMetadata *scheme = pmConfigFitsType(config, camera, fitsType); // File rule
    248246        if (!scheme) {
     247            // XXX change to a config error?
    249248            psWarning("Unable to find %s in FITS in camera configuration --- will use defaults.", fitsType);
    250249            goto FITS_OPTIONS_DONE;
     
    337336    }
    338337
    339     file->dataLevel = pmFPALevelFromName(psMetadataLookupStr(&status, data, "DATA.LEVEL"));
     338    file->dataLevel = pmFPALevelFromName(psMetadataLookupStr(&status, filerule, "DATA.LEVEL"));
    340339    if (file->dataLevel == PM_FPA_LEVEL_NONE) {
    341340        psError(PS_ERR_IO, true, "DATA.LEVEL is not set for %s\n", name);
  • trunk/psModules/src/config/pmConfig.c

    r17264 r17489  
    15131513}
    15141514
     1515psMetadata *pmConfigFitsType (const pmConfig *config, const psMetadata *camera, const char *fitsType)
     1516{
     1517    bool mdok;
     1518
     1519    PS_ASSERT_PTR_NON_NULL(config, NULL);
     1520    PS_ASSERT_METADATA_NON_NULL(camera, NULL);
     1521    PS_ASSERT_STRING_NON_EMPTY(fitsType, NULL);
     1522
     1523    psMetadataItem *item = psMetadataLookup(camera, "FITSTYPES"); // Item with the file rule of interest
     1524    if (!item) {
     1525        psError(PS_ERR_UNEXPECTED_NULL, false, "Unable to find FITSTYPES in the camera configuration.");
     1526        return NULL;
     1527    }
     1528
     1529    if (!metadataItemReadFile(item, "FITS Types")) {
     1530        psError(PM_ERR_CONFIG, false, "Unable to read file rules for camera.");
     1531        return NULL;
     1532    }
     1533
     1534    assert(item->type == PS_DATA_METADATA);
     1535    psMetadata *fitstypes = item->data.md; // FITS Types from the camera configuration
     1536
     1537    // select the name from the FITSTYPES
     1538    psMetadata *scheme = psMetadataLookupMetadata(&mdok, fitstypes, fitsType);
     1539    if (!scheme) {
     1540        psWarning("Unable to find specified FITS Type %s in camera configuration.", fitsType);
     1541        return NULL;
     1542    }
     1543
     1544    return scheme;
     1545}
  • trunk/psModules/src/config/pmConfig.h

    r16611 r17489  
    55 *  @author Eugene Magnier, IfA
    66 *
    7  *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2008-02-22 20:20:38 $
     7 *  @version $Revision: 1.34 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2008-04-28 21:13:46 $
    99 *  Copyright 2005-2006 Institute for Astronomy, University of Hawaii
    1010 */
     
    176176    );
    177177
     178// look up the specified fitstype, interpolating the file if needed
     179psMetadata *pmConfigFitsType (const pmConfig *config, const psMetadata *camera, const char *fitsType);
     180
    178181/// @}
    179182#endif
Note: See TracChangeset for help on using the changeset viewer.