IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 11450


Ignore:
Timestamp:
Jan 30, 2007, 2:39:07 PM (19 years ago)
Author:
Paul Price
Message:

Adding pmConfigCommand.[ch] in order to supplement a command line with arguments for database and trace. This is required for running detselect in pmDetrendDB.c

Location:
trunk/psModules/src
Files:
2 added
5 edited

Legend:

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

    r11357 r11450  
    233233
    234234        psFree (file->filename);
    235         file->filename = pmDetrendFile (file->filextra, extra);
     235        file->filename = pmDetrendFile(file->filextra, extra, config);
    236236        if (file->filename == NULL) {
    237237            psError(PS_ERR_IO, false, "failed to find a valid detrend image for detID %s : classID %s\n", file->filextra, extra);
  • trunk/psModules/src/config/Makefile.am

    r11253 r11450  
    77    pmConfigRecipes.c \
    88    pmConfigCamera.c \
     9    pmConfigCommand.c \
    910    pmVersion.c \
    1011    pmErrorCodes.c
     
    1415    pmConfigRecipes.h \
    1516    pmConfigCamera.h \
     17    pmConfigCommand.h \
    1618    pmVersion.h \
    1719    pmErrorCodes.h
  • trunk/psModules/src/detrend/pmDetrendDB.c

    r11421 r11450  
    77#include <pslib.h>
    88#include "pmConfig.h"
     9#include "pmConfigCommand.h"
    910#include "pmFPA.h"
    1011#include "pmFPALevel.h"
     
    101102    PS_ASSERT_PTR_NON_NULL(config->site, NULL);
    102103
    103     bool mdok;                          // Status of MD lookup
    104     const char *dbserver = psMetadataLookupStr(&mdok, config->site, "DBSERVER"); // Database server
    105     if (!mdok || strlen(dbserver) == 0) {
    106         psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBSERVER in site configuration.\n");
    107         return NULL;
    108     }
    109     const char *dbname = psMetadataLookupStr(&mdok, config->site, "DBNAME"); // Database name
    110     if (!mdok || strlen(dbname) == 0) {
    111         psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBNAME in site configuration.\n");
    112         return NULL;
    113     }
    114     const char *dbuser = psMetadataLookupStr(&mdok, config->site, "DBUSER"); // Database user
    115     if (!mdok || strlen(dbuser) == 0) {
    116         psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBUSER in site configuration.\n");
    117         return NULL;
    118     }
    119     const char *dbpassword = psMetadataLookupStr(&mdok, config->site, "DBPASSWORD"); // Database password
    120     if (!mdok || strlen(dbpassword) == 0) {
    121         psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find DBPASSWORD in site configuration.\n");
    122         return NULL;
    123     }
    124 
    125104    int status, exit_status;
    126     char *line = NULL;
     105    psString line = NULL;
    127106    char *time = psTimeToISO (&options->time);
    128107    char *type = pmDetrendTypeToString (options->type);
     
    130109
    131110    pmDetrendSelectResults *results = pmDetrendSelectResultsAlloc();
    132     psStringAppend (&line, "detselect -search -inst %s -det_type %s -time %s "
    133                     "-dbserver %s -dbname %s -dbuser %s -dbpassword %s",
    134                     options->camera, type, time, dbserver, dbname, dbuser, dbpassword);
     111    psStringAppend(&line, "detselect -search -inst %s -det_type %s -time %s", options->camera, type, time);
    135112
    136113    if (options->filter) {
    137         psStringAppend (&line, " -filter %s", options->filter);
     114        psStringAppend(&line, " -filter %s", options->filter);
    138115    }
    139116    if (options->exptime > -1.0) {
    140         psStringAppend (&line, " -exptime %f", options->exptime);
     117        psStringAppend(&line, " -exptime %f", options->exptime);
    141118    }
    142119    if (options->airmass > -1.0) {
    143         psStringAppend (&line, " -airmass %f", options->airmass);
    144     }
    145 
     120        psStringAppend(&line, " -airmass %f", options->airmass);
     121    }
     122
     123    pmConfigDatabaseCommand(&line, config);
     124    pmConfigTraceCommand(&line);
    146125    psTrace("psModules.detrend", 5, "running %s", line);
    147126
     
    214193// detselect -select -detID (detID) -classID (classID)
    215194// returns: (detID) (classID) (filename) DONE
    216 char *pmDetrendFile (const char *detID, const char *classID)
     195char *pmDetrendFile (const char *detID, const char *classID, const pmConfig *config)
    217196{
    218197    unsigned int nFail;
     
    222201
    223202    bool status;
    224     char *line = NULL;
     203    psString line = NULL;
    225204    psArray *array = NULL;
    226205
    227206    // generate the detselect command
    228207    psStringAppend (&line, "detselect -select %s -class_id %s", detID, classID);
     208    pmConfigDatabaseCommand(&line, config);
     209    pmConfigTraceCommand(&line);
    229210    psTrace("psModules.detrend", 5, "running %s", line);
    230211
  • trunk/psModules/src/detrend/pmDetrendDB.h

    r11421 r11450  
    99 * @author EAM, IfA
    1010 *
    11  * @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
    12  * @date $Date: 2007-01-30 04:46:20 $
     11 * @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
     12 * @date $Date: 2007-01-31 00:35:24 $
    1313 * Copyright 2004-2005 Institute for Astronomy, University of Hawaii
    1414 */
     
    6565pmDetrendSelectResults *pmDetrendSelectResultsAlloc();
    6666pmDetrendSelectResults *pmDetrendSelect (const pmDetrendSelectOptions *options, const pmConfig *config);
    67 char *pmDetrendFile (const char *detID, const char *classID);
     67char *pmDetrendFile (const char *detID, const char *classID, const pmConfig *config);
    6868
    6969/// @}
  • trunk/psModules/src/psmodules.h

    r11126 r11450  
    1313#include <pmConfig.h>
    1414#include <pmConfigRecipes.h>
     15#include <pmConfigCamera.h>
     16#include <pmConfigCommand.h>
    1517#include <pmVersion.h>
    1618
Note: See TracChangeset for help on using the changeset viewer.