IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 28, 2008, 3:21:59 PM (18 years ago)
Author:
Paul Price
Message:

Put entry in highest HDU header.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ppImage/src/ppImageDetrendRecord.c

    r20419 r20454  
    3232    pmCell *input = pmFPAfileThisCell(config->files, view, "PPIMAGE.INPUT"); // File we're processing
    3333    psAssert(input, "Should be there");
    34     pmHDU *hdu = pmHDUFromCell(input);  // HDU for cell
    35     psMetadataAddStr(hdu->header, PS_LIST_TAIL, name, PS_META_DUPLICATE_OK, desc, basename(file->filename));
     34    pmHDU *hdu = pmHDUGetHighest(input->parent->parent, input->parent, input);  // HDU for cell
     35
     36    const char *base = basename(file->filename); // Base name of file
     37
     38    // We don't want multiple listings in the header saying the same thing, so make sure we haven't put the
     39    // same entry there.  Usually (if the detrend and the image have the same file level) there'll only end up
     40    // being one entry.
     41    psString regexp = NULL;             // Regular expression
     42    psStringAppend(&regexp, "^%s$", name);
     43    psMetadataIterator *iter = psMetadataIteratorAlloc(hdu->header, PS_LIST_HEAD, regexp); // Iterator for hdr
     44    psFree(regexp);
     45    psMetadataItem *item;               // Item from iteration
     46    bool found = false;
     47    while (!found && (item = psMetadataGetAndIncrement(iter))) {
     48        if (item->type == PS_DATA_STRING && strcmp(item->data.str, base) == 0) {
     49            found = true;
     50        }
     51    }
     52    psFree(iter);
     53    if (!found) {
     54        psMetadataAddStr(hdu->header, PS_LIST_TAIL, name, PS_META_DUPLICATE_OK, desc, base);
     55    }
    3656
    3757    return;
Note: See TracChangeset for help on using the changeset viewer.