IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 1, 2012, 3:24:39 PM (14 years ago)
Author:
eugene
Message:

support for parallel dvo in mextract, avextract, avmerge, gstar, gcat; remove some if-def-ed out code already moved to libdvo; list -vectors and -buffers options (store names of vectors and buffers in lists); list -copy give error if missing source; catlist, hosts & remote functions to support parallel dvos; skyregion -save option; new skycoverage modes (-min-ubercal; -min-dmag-sys; -min-mcal; -max-mcal); gstar output formatting cleanups; add more average info to gstar output; functions for spectral similarity analysis; coords returns nans for projections off the sphere; fix cumulative function; add name:type option to opihi/read function (eg read a:float 2 b:time 3 c:int 4); line -frac option; vtype function to get vector types; threshold function; write -fits option; code for unfinished mtype function (matching vtype)

File:
1 edited

Legend:

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

    r30610 r33662  
    77  FILE *f;
    88  char **fmtlist, *fmttype;
    9   char *p0, *p1, *p2, *format;
     9  char *p0, *p1, *p2, *format, *FITS;
    1010  Vector **vec;
    1111
     
    1515    remove_argument (N, &argc, argv);
    1616    format = strcreate (argv[N]);
     17    remove_argument (N, &argc, argv);
     18  }
     19
     20  /* option generate a FITS output table */
     21  FITS = NULL;
     22  if ((N = get_argument (argc, argv, "-fits"))) {
     23    remove_argument (N, &argc, argv);
     24    FITS = strcreate (argv[N]);
    1725    remove_argument (N, &argc, argv);
    1826  }
     
    2937  }
    3038
    31   /* open file for outuput */
    32   if (append) {
    33       f = fopen (argv[1], "a");
    34   } else {
    35       f = fopen (argv[1], "w");
    36   }
    37   if (f == (FILE *) NULL) {
    38     gprint (GP_ERR, "can't open file for write\n");
    39     return (FALSE);
    40   }
    41 
    4239  /* find number of output vectors */
    4340  Nvec = (argc - 2);
    4441  if (Nvec < 1) {
    45       gprint (GP_ERR, "USAGE: write (file) vector vector ...\n");
    46       fclose (f);
    47   fflush (f);
    48       return (FALSE);
     42    gprint (GP_ERR, "USAGE: write (file) vector vector ...\n");
     43    return (FALSE);
    4944  }
    5045  ALLOCATE (vec, Vector *, Nvec);
     
    5651      gprint (GP_ERR, "USAGE: write (file) vector vector ...\n");
    5752      free (vec);
    58       fclose (f);
    59   fflush (f);
    6053      return (FALSE);   
    6154    }
     
    6861      gprint (GP_ERR, "error: vectors must all be the same size\n");
    6962      free (vec);
    70       fclose (f);
    71   fflush (f);
    7263      return (FALSE);   
    7364    }
     65  }
     66
     67  if (FITS) {
     68    int status = WriteVectorTableFITS (argv[1], FITS, vec, Nvec, append, format);
     69    free (vec);
     70    return status;
     71  }
     72
     73  /* open file for outuput */
     74  if (append) {
     75    f = fopen (argv[1], "a");
     76  } else {
     77    f = fopen (argv[1], "w");
     78  }
     79  if (f == (FILE *) NULL) {
     80    gprint (GP_ERR, "can't open file for write\n");
     81    return (FALSE);
    7482  }
    7583
     
    8896    fclose (f);
    8997    free (vec);
    90   fflush (f);
     98    fflush (f);
    9199    return (TRUE);
    92100  }
     
    111119      free (format);
    112120      fclose (f);
    113   fflush (f);
     121      fflush (f);
    114122      return (FALSE);
    115123    }
Note: See TracChangeset for help on using the changeset viewer.