IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 15, 2007, 11:59:53 AM (19 years ago)
Author:
magnier
Message:

handling detrend constraints

File:
1 edited

Legend:

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

    r11092 r11106  
    2828#include "pmFPA_JPEG.h"
    2929#include "pmDetrendDB.h"
     30#include "pmConceptsPhotcode.h"
    3031
    3132// define an input-type pmFPAfile, bind to the optional fpa if supplied
     
    644645    }
    645646
    646     // detselect -camera (camera) -time (time) -type (type) [others]
    647     // camera and time are functions of (pmFPA *input)
    648     // XXX add other options here f(pmFPA *input, type)
     647    // we are constructing a detselect command of the form:
     648    //   detselect -search -inst (camera) -type (type) -time (time) [others]
     649    // camera, type, and time are derived from pmFPA *input, other options are
     650    // added if specified for the particular detrend type by the DETREND.CONSTRAINTS
     651    // note that the filter-dependent choices are set for ppImage in ppImageParseCamera
    649652
    650653    // Get the time from FPA.TIME
     
    678681        }
    679682        char *option  = item->name;     // item->name must correspond to a valid detselect option
    680         char *concept = item->data.V; // item->data.V is a concept to look up
     683
     684        psArray *conceptData = psStringSplitArray ((char *) item->data.V, ":", true);
     685        if (conceptData == NULL)
     686            psAbort ("psModules", "programming error");
     687        if (conceptData->n == 0)
     688            psAbort ("psModules", "missing data for %s", item->name);
     689        if (conceptData->n  > 2)
     690            psAbort ("psModules", "invalid format for %s", item->name);
     691
     692        char *concept = NULL;
     693        char *function = NULL;
     694        if (conceptData->n == 1) {
     695            concept = conceptData->data[0];
     696        }
     697        if (conceptData->n == 2) {
     698            function = conceptData->data[0];
     699            concept = conceptData->data[1];
     700        }
     701
    681702        if (!strcasecmp (option, "filter")) {
    682             options->filter = psMetadataLookupPtr (&status, input->concepts, concept);
    683             if (!status)
    684                 psAbort ("psModules", "filter not found");
     703            options->filter = NULL;
     704            if (function) {
     705                if (!strcasecmp (function, "FILTER.ID")) {
     706                    options->filter = pmConceptsFilterIDfromConcept (concept, input->concepts, config->camera);
     707                }
     708            } else {
     709                options->filter = psMetadataLookupPtr (&status, input->concepts, concept);
     710            }
     711            if (options->filter == NULL)
     712                psAbort ("psModules", "failed to find filter");
     713
    685714        }
    686715        if (!strcasecmp (option, "exptime")) {
     716            if (function)
     717                psAbort ("psModules", "no detrend constraint function for exptime");
    687718            options->exptime = psMetadataLookupF32 (&status, input->concepts, concept);
    688719            if (!status)
     
    690721        }
    691722        if (!strcasecmp (option, "airmass")) {
     723            if (function)
     724                psAbort ("psModules", "no detrend constraint function for airmass");
    692725            options->airmass = psMetadataLookupF32 (NULL, input->concepts, concept);
    693726            if (!status)
     
    700733                    psAbort ("psModules", "dettemp not found");
    701734            }
     735        if (!strcasecmp (option, "version")) {
     736            // version is applied as a literal string
     737            if (function)
     738                psAbort ("psModules", "no detrend constraint function for airmass");
     739            options->version = psStringCopy(concept);
     740        }
     741        if (!strcasecmp (option, "twilight")) {
     742            // XXX determine the twilight time based on concept defining the time-of-day
     743            options->twilight = psMetadataLookupF32 (NULL, input->concepts, concept);
     744            if (!status)
     745                psAbort ("psModules", "dettemp not found");
     746        }
    702747        // XXX need to include twilight time somehow (uses lookup based on a time value)
    703748        # endif
Note: See TracChangeset for help on using the changeset viewer.