IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34886


Ignore:
Timestamp:
Jan 5, 2013, 7:07:23 AM (14 years ago)
Author:
eugene
Message:

add formating to FITS output, help for opihi write

Location:
branches/eam_branches/ipp-20121219/Ohana/src/opihi
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20121219/Ohana/src/opihi/cmd.data/write_vectors.c

    r34584 r34886  
    1010  Vector **vec;
    1111
     12  if ((N = get_argument (argc, argv, "-h"))) goto usage;
     13  if ((N = get_argument (argc, argv, "--h"))) goto usage;
     14  if ((N = get_argument (argc, argv, "-help"))) goto usage;
     15  if ((N = get_argument (argc, argv, "--help"))) goto usage;
     16
    1217  /* look for format option */
    1318  format = (char *) NULL;
     
    1722    remove_argument (N, &argc, argv);
    1823  }
     24  if ((N = get_argument (argc, argv, "-format"))) {
     25    if (format) {
     26      gprint (GP_ERR, "ERROR: do not mix -f and -format\n");
     27      free (format);
     28      return (FALSE);
     29    }
     30    remove_argument (N, &argc, argv);
     31    format = strcreate (argv[N]);
     32    remove_argument (N, &argc, argv);
     33  }
    1934
    2035  /* option generate a FITS output table */
    2136  FITS = NULL;
    2237  if ((N = get_argument (argc, argv, "-fits"))) {
    23     if (format) {
    24       gprint (GP_ERR, "ERROR: do not mix -fits and -format\n");
    25       free (format);
    26       return (FALSE);
    27     }
    2838    remove_argument (N, &argc, argv);
    2939    FITS = strcreate (argv[N]);
     
    6171
    6272  if (argc < 3) {
    63     gprint (GP_ERR, "USAGE: write [-append] [-f \"format\"] file vector vector ...\n");
     73    gprint (GP_ERR, "USAGE: write [options] file vector vector ...\n");
     74    gprint (GP_ERR, "OPTIONS: [-header] [-append] [-f \"format\"] [-fits NAME] [-csv] [-h,--help]\n");
    6475    return (FALSE);
    6576  }
     
    222233  return (TRUE);
    223234
     235 usage:
     236    gprint (GP_ERR, "USAGE: write [options] file vector vector ...\n");
     237    gprint (GP_ERR, "OPTIONS: [-header] [-append] [-f \"format\"] [-fits NAME] [-csv] [-h,--help]\n\n");
     238
     239    gprint (GP_ERR, "OPTIONS: \n");
     240    gprint (GP_ERR, "  -header : add a descriptive header line to ascii or csv output\n");
     241    gprint (GP_ERR, "  -append : write to the end of the existing file\n");
     242    gprint (GP_ERR, "  -fits NAME : write a fits table (extention name is NAME, column names match vector names)\n");
     243    gprint (GP_ERR, "  -csv : write a comma-separated values file (eg, to read in excel)\n");
     244    gprint (GP_ERR, "  -f \"format\" : provide formatting codes for output:\n");
     245    gprint (GP_ERR, "    ascii / csv : format consists of c-style format codes in form %NN.Md\n");
     246    gprint (GP_ERR, ",     the following codes are allowed\n");
     247    gprint (GP_ERR, "        %e -- double, %f -- float\n");
     248    gprint (GP_ERR, "        %d -- int, %c -- char, %x -- hex int\n");
     249    gprint (GP_ERR, "    FITS : format consists of the following FITS binary table format codes:\n");
     250    gprint (GP_ERR, "      B : 1 byte int\n");   
     251    gprint (GP_ERR, "      I : 2 byte int\n");   
     252    gprint (GP_ERR, "      J : 4 byte int\n");   
     253    gprint (GP_ERR, "      K : 8 byte int\n");   
     254    gprint (GP_ERR, "      D : 4 byte float\n");   
     255    gprint (GP_ERR, "      F : 1 byte float\n");   
     256    gprint (GP_ERR, "   -h : this help listing\n");
     257    gprint (GP_ERR, "   --h : this help listing\n");
     258    gprint (GP_ERR, "   -help : this help listing\n");
     259    gprint (GP_ERR, "   --help : this help listing\n");
     260    return FALSE;
    224261}
    225262
  • branches/eam_branches/ipp-20121219/Ohana/src/opihi/lib.shell/VectorIO.c

    r34584 r34886  
    2323        goto escape;
    2424      }
    25       if ((*ptr != 'B') && (*ptr != 'I') && (*ptr != 'J') && (*ptr != 'D') && (*ptr != 'E')) {
     25      if ((*ptr != 'B') && (*ptr != 'I') && (*ptr != 'J') && (*ptr != 'K') && (*ptr != 'D') && (*ptr != 'E')) {
    2626        gprint (GP_ERR, "error in binary table format %s: invalid character %c\n", format, *ptr);
    2727        goto escape;
Note: See TracChangeset for help on using the changeset viewer.