IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 8, 2012, 2:30:52 PM (14 years ago)
Author:
eugene
Message:

add IO functions for splines

Location:
branches/eam_branches/ipp-20120905/Ohana/src/opihi/cmd.data
Files:
3 edited

Legend:

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

    r34526 r34529  
    44int spline_create (int argc, char **argv);
    55int spline_apply (int argc, char **argv);
     6int spline_load (int argc, char **argv);
     7int spline_save (int argc, char **argv);
    68int spline_delete (int argc, char **argv);
    79int spline_getspline (int argc, char **argv);
     
    1113  {1, "create",     spline_create,     "create a spline"},
    1214  {1, "apply",      spline_apply,      "apply a spline"},
     15  {1, "load",       spline_load,       "write a spline to a FITS file"},
     16  {1, "save",       spline_save,       "read a spline from a FITS file"},
    1317  {1, "delete",     spline_delete,     "delete a spline"},
    1418};
  • branches/eam_branches/ipp-20120905/Ohana/src/opihi/cmd.data/spline_commands.c

    r34526 r34529  
    6969}
    7070
     71int spline_save (int argc, char **argv) {
     72
     73  int N;
     74
     75  int APPEND = FALSE;
     76  if ((N = get_argument (argc, argv, "-append"))) {
     77    APPEND = TRUE;
     78    remove_argument (N, &argc, argv);
     79  }
     80
     81  if (argc != 3) {
     82    gprint (GP_ERR, "USAGE: spline save (name) (filename) [-append]\n");
     83    return FALSE;
     84  }
     85
     86  if (!SaveSpline(argv[2], argv[1], APPEND)) {
     87    gprint (GP_ERR, "failed to save spline %s\n", argv[1]);
     88    return (FALSE);
     89  }
     90  return TRUE;
     91}
     92
     93int spline_load (int argc, char **argv) {
     94
     95  if (argc != 3) {
     96    gprint (GP_ERR, "USAGE: spline load (name) (filename)\n");
     97    return FALSE;
     98  }
     99
     100  if (!LoadSpline(argv[2], argv[1])) {
     101    gprint (GP_ERR, "failed to load spline %s\n", argv[1]);
     102    return (FALSE);
     103  }
     104  return TRUE;
     105}
     106
    71107int spline_delete (int argc, char **argv) {
    72108
  • branches/eam_branches/ipp-20120905/Ohana/src/opihi/cmd.data/write_vectors.c

    r33963 r34529  
    9999  }
    100100
    101   /* open file for outuput */
     101  /* open file for output */
    102102  if (append) {
    103103    f = fopen (argv[1], "a");
Note: See TracChangeset for help on using the changeset viewer.