IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 1, 2021, 1:58:44 PM (5 years ago)
Author:
eugene
Message:

fix FITS ASCII column reading

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libfits/table/F_table_format.c

    r41474 r41676  
    55// get the format of a table column
    66// Nval : number of joined columns
    7 // Nbytes : width of column
     7// Nbytes : width of column, determined by the type (e.g., float = 4 bytes)
    88int gfits_bintable_format (char *format, char *type, int *Nval, int *Nbytes) {
    99
     
    9090
    9191/***********************/
     92// get the format of a table column
     93// Nval : number of fields (1 for all types except string)
     94// Nbytes : width of FITS table column, ie number of bytes in ASCII table
    9295int gfits_table_format (char *format, char *type, int *Nval, int *Nbytes) {
    9396
     
    109112  int isLong = FALSE;
    110113  char Type = 'x';
    111   if (Fchar == 'D') { *Nbytes = 1;  strcpy (type, "double"); Type = 'e'; *Nval = Nv; isLong = TRUE; }
    112   if (Fchar == 'E') { *Nbytes = 1;  strcpy (type, "float");  Type = 'e'; *Nval = Nv; }
    113   if (Fchar == 'F') { *Nbytes = 1;  strcpy (type, "float");  Type = 'f'; *Nval = Nv; }
    114   if (Fchar == 'I') { *Nbytes = 1;  strcpy (type, "int");    Type = 'd'; *Nval = Nv; }
    115   if (Fchar == 'A') { *Nbytes = 1;  strcpy (type, "char");   Type = 's'; *Nval = Nv; }
     114  if (Fchar == 'D') { *Nbytes = Nv;  strcpy (type, "double"); Type = 'e'; *Nval =  1; isLong = TRUE; }
     115  if (Fchar == 'E') { *Nbytes = Nv;  strcpy (type, "float");  Type = 'e'; *Nval =  1; }
     116  if (Fchar == 'F') { *Nbytes = Nv;  strcpy (type, "float");  Type = 'f'; *Nval =  1; }
     117  if (Fchar == 'I') { *Nbytes = Nv;  strcpy (type, "int");    Type = 'd'; *Nval =  1; }
     118  if (Fchar == 'A') { *Nbytes =  1;  strcpy (type, "char");   Type = 's'; *Nval = Nv; }
    116119  if (!*Nbytes) { return (FALSE); }
    117120 
     
    133136/*
    134137  valid TABLE column formats:
    135   FN.N  - floating point
    136   INN   - integer
     138  FN.N  - floating point taking NN characters in the table
     139  INN   - integer taking NN characters in the table
    137140  ANN   - NN char string
    138141 
Note: See TracChangeset for help on using the changeset viewer.