IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 29327


Ignore:
Timestamp:
Oct 5, 2010, 3:27:12 PM (16 years ago)
Author:
rhenders
Message:

Added function to get type and repeat info for a given FITS column

Location:
trunk/ippToPsps/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/src/ippToPspsConfig.c

    r28559 r29327  
    701701}
    702702
     703// gets metadata about a column
     704bool ippToPspsConfig_getFitsColumnMeta(
     705        char* name,
     706        int* colNum,
     707        int* type,
     708        long* repeat,
     709        fitsfile *fitsIn ) {
     710
     711    int status = 0;
     712    fits_get_colnum(fitsIn, CASESEN, name, colNum, &status);
     713    if (status) {
     714        psError(PS_ERR_IO, false, "Unable to read col '%s'", name);
     715        return false;
     716    }
     717
     718    status = 0;
     719    fits_get_eqcoltype(fitsIn, *colNum, type, repeat, NULL, &status);
     720    if (status) {
     721        psError(PS_ERR_IO, false, "Unable to read type info for '%s'", name);
     722        return false;
     723    }
     724
     725    return true;
     726}
     727
    703728// populate with data from another FITS table into this one
    704729static bool ippToPspsConfig_populateTableFromFits(
     
    730755    int readStatus = 0;
    731756    int writeStatus = 0;
    732    
     757
    733758    // first loop round all columns and get IPP col numbers for provided column names TODO only do once, first time in
    734759    if(!fromHeader) {
     
    737762
    738763            if (strlen(table->columns[i].ippName) < 1) continue;
    739             readStatus = 0;
    740             fits_get_colnum(fitsIn, CASESEN, table->columns[i].ippName, &table->columns[i].ippColNum, &readStatus);
    741             if (readStatus) psError(PS_ERR_IO, false, "%d Unable to read col num for '%s' '%s' %d", i, table->columns[i].pspsName, table->columns[i].ippName, table->columns[i].ippColNum);
     764
     765            if (!ippToPspsConfig_getFitsColumnMeta(
     766                    table->columns[i].ippName,
     767                    &table->columns[i].ippColNum,
     768                    &table->columns[i].ippType,
     769                    &table->columns[i].ippRepeat,
     770                    fitsIn)) {return false;}
    742771        }
    743772    }
  • trunk/ippToPsps/src/ippToPspsConfig.h

    r28249 r29327  
    2020    char ippName[100];
    2121    int ippType;
     22    long ippRepeat;
    2223    char pspsName[100]; // TODO change to 'name'
    2324    int pspsType;
Note: See TracChangeset for help on using the changeset viewer.