IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 28, 2022, 12:17:32 PM (4 years ago)
Author:
eugene
Message:

add imresample, imcollapse functions; more usage documentation; option to catch failures in command when loading from shell command into queue; better handling of errors reading FITS table

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.data/read_vectors.c

    r41673 r42082  
    629629  }
    630630  if (listFields) {
    631     read_table_fields (&header, IsCompressed, VERBOSE);
     631    int tstatus = read_table_fields (&header, IsCompressed, VERBOSE);
    632632    if (CCDKeyword != NULL) free (CCDKeyword);
    633633    gfits_free_header (&header);
    634     return TRUE;
     634    if (!tstatus) { gprint (GP_ERR, "error reading table fields\n"); }
     635    return tstatus;
    635636  }
    636637  if (IsCompressed) {
     
    855856  char field[32], varname[32], type[80], comment[80], format[80], unit[80], null[80], nval[80];
    856857
    857   gfits_scan (header, "TFIELDS", "%d", 1, &Nfields);
    858 
     858  if (!gfits_scan (header, "TFIELDS", "%d", 1, &Nfields)) {
     859    if (VERBOSE) gprint (GP_ERR, "cannot read TFIELDS from header\n");
     860    set_int_variable ("table:Nx", header->Naxis[0]);
     861    set_int_variable ("table:Ny", header->Naxis[1]);
     862    set_int_variable ("table:Nfields", 0);
     863    set_int_variable ("tfields:n", 0);
     864    return TRUE;
     865  }
     866   
    859867  set_int_variable ("table:Nx", header->Naxis[0]);
    860868  set_int_variable ("table:Ny", header->Naxis[1]);
     
    872880
    873881    snprintf (field, 32, "TTYPE%d", i);
    874     gfits_scan (header, field, "%s", 1, type);
     882    if (!gfits_scan (header, field, "%s", 1, type)) {
     883      if (VERBOSE) gprint (GP_ERR, "cannot read %s from header\n", field);
     884    }
    875885   
    876886    snprintf (varname, 32, "tfields:%d", i - 1);
    877887    set_str_variable (varname, type);
    878888
    879     gfits_scan_alt (header, field, "%C", 1, comment);
     889    gfits_scan_alt (header, field, "%C", 1, comment); 
    880890
    881891    if (!isCompressed) {
     
    884894      snprintf (field, 32, "ZFORM%d", i);
    885895    }
    886     gfits_scan (header, field, "%s", 1, format);
     896    if (!gfits_scan (header, field, "%s", 1, format)) {
     897      if (VERBOSE) gprint (GP_ERR, "cannot read %s from header\n", field);
     898    }
    887899
    888900    snprintf (field, 32, "TUNIT%d", i);
     
    895907    if (VERBOSE) gprint (GP_LOG, "%-18s %-15s %-18s %-6s %-8s %-8s %-32s\n", type, varname, unit, format, null, nval, comment);
    896908  }
    897 
    898 
    899909  return TRUE;
    900910}
Note: See TracChangeset for help on using the changeset viewer.