Index: trunk/Ohana/src/opihi/include/convert.h
===================================================================
--- trunk/Ohana/src/opihi/include/convert.h	(revision 4800)
+++ trunk/Ohana/src/opihi/include/convert.h	(revision 4805)
@@ -4,21 +4,8 @@
 # define CONVERT_H
 
-/*** values for time formats */
-enum {TIME_NONE, TIME_JD, TIME_MJD, TIME_DATE, TIME_DAYS, TIME_HOURS, TIME_MINUTES, TIME_SECONDS};
-
-/*** conversion functions ***/
+/*** time/coord conversion functions not supplied by libohana ***/
 time_t        TimeRef               PROTO((double time, time_t TimeReference, int TimeFormat));
 double        TimeValue             PROTO((time_t time, time_t TimeReference, int TimeFormat));
-int           chk_time              PROTO((char *line));
-time_t        date_to_sec           PROTO((char *date));
-int           dms_to_ddd            PROTO((double *Value, char *string));
-time_t        jd_to_sec             PROTO((double jd));
-time_t        mjd_to_sec            PROTO((double mjd));
-char         *sec_to_date           PROTO((time_t second));
-double        sec_to_jd             PROTO((time_t second));
-double        sec_to_mjd            PROTO((time_t second));
-int           str_to_dtime          PROTO((char *line, double *second));
-int           str_to_radec          PROTO((double *ra, double *dec, char *str1, char *str2));
-int           str_to_time           PROTO((char *line, time_t *second));
+
 int           hh_hms                PROTO((double hh, int *hr, int *mn, double *sc));
 int           dd_dms                PROTO((double dd, int *dg, int *mn, double *sc));
@@ -33,4 +20,5 @@
 char         *meade_dec_to_str      PROTO((double deg));
 int           hstgsc_hms_to_deg     PROTO((double *h0, double *h1, double *d0, double *d1, char *string));
+char         *strptime              PROTO((const char *s, const char *format, struct tm *tm));
 
 # endif
Index: trunk/Ohana/src/opihi/include/dvo1.h
===================================================================
--- trunk/Ohana/src/opihi/include/dvo1.h	(revision 4800)
+++ trunk/Ohana/src/opihi/include/dvo1.h	(revision 4805)
@@ -23,59 +23,54 @@
 } RegionFile;
 
-/* aregion, region_list, match_image, LoadImages */
-RegionFile   *find_regions	    PROTO((double Ra, double Dec, double radius, int *Nregions));
-GSCRegion    *get_regions	    PROTO((Image *image, int *Nregions));
-void	      aregion		    PROTO((GSCRegion *region, FILE *f, double ra, double dec, char *path));
-RegionFile   *region_list	    PROTO((char *filename, int *Nregions));
-int	      match_image	    PROTO((Image *image, int Nimage, unsigned int T, short int S));
-Image  	     *LoadImages	    PROTO((int *Nimage));
-void	      image_subset	    PROTO((Image *image, int Nimage, int **Subset, int *Nsubset, Graphdata *graph, int RegionSelect, unsigned long int tzero, double trange, int TimeSelect));
-void	      sort_images	    PROTO((Image *image, int N));
-void	      sortave		    PROTO((Average *ave, int N));
-void	      cprecess		    PROTO((Average *average, int Naverage, double in_epoch, double out_epoch));
-void	      compare		    PROTO((Catalog *catlog1, Catalog *catlog2, Vector *rvec,  Vector *dvec,  Vector *mvec, Vector *drvec, Vector *ddvec, Vector *dmvec, double radius));
-
-/*** photometry functions ***/
-double       *ExtractByDMag	    PROTO((PhotCode **code, int *mode, Average *average, SecFilt *secfilt, Measure *measure, int *nlist, int param));
-double       *ExtractDMag	    PROTO((PhotCode **code, int *mode, Average *average, SecFilt *secfilt, Measure *measure, int *nlist));
-double       *ExtractMagnitudes	    PROTO((PhotCode *code, int mode, Average *average, SecFilt *secfilt, Measure *measure, int *n));
-double       *ExtractMeasures	    PROTO((PhotCode *code, int mode, Average *average, SecFilt *secfilt, Measure *measure, int *nlist, int param));
+/*** dvo prototypes ***/
+int           DetermineTypeCode     PROTO((Average *average, Measure *measure, int code));
+double        DetermineTypefrac     PROTO((Average *average, Measure *measure, PhotCode *code));
+double        ExtractAverages       PROTO((PhotCode *code, int mode, Average *average, SecFilt *secfilt, Measure *measure, int param));
+double       *ExtractByDMag         PROTO((PhotCode **code, int *mode, Average *average, SecFilt *secfilt, Measure *measure, int *nlist, int param));
+double       *ExtractDMag           PROTO((PhotCode **code, int *mode, Average *average, SecFilt *secfilt, Measure *measure, int *nlist));
+double       *ExtractMagnitudes     PROTO((PhotCode *code, int mode, Average *average, SecFilt *secfilt, Measure *measure, int *n));
+double       *ExtractMeasures       PROTO((PhotCode *code, int mode, Average *average, SecFilt *secfilt, Measure *measure, int *nlist, int param));
 double       *ExtractMeasuresByDMag PROTO((PhotCode **code, int *mode, int use_first, Average *average, SecFilt *secfilt, Measure *measure, int *nlist, int param));
 double       *ExtractMeasuresDMag   PROTO((PhotCode **code, int *mode, Average *average, SecFilt *secfilt, Measure *measure, int *nlist));
+void          FreeImageSelection    PROTO(());
+void          FreeImageSelection    PROTO(());
+int           GetAverageParam       PROTO((char *parname));
+void          GetAverageParamHelp   PROTO(());
+int           GetMagMode            PROTO((char *string));
+double        GetMeasure            PROTO((int param, Average *average, Measure *measure, double mag));
+int           GetMeasureParam       PROTO((char *parname));
+int           GetMeasureTypeCode    PROTO((Measure *measure));
+int           GetPhotcodeInfo       PROTO((char *string, PhotCode **Code, int *Mode));
+int           GetRegionSelection    PROTO(());
+int           GetSelectionParam     PROTO(());
+int           GetTimeSelection      PROTO((time_t *tz, time_t *te));
+void          InitDVO               PROTO(());
+int           InitPhotcodes         PROTO(());
+Image        *LoadImages            PROTO((int *Nimage));
+Image        *MatchImage            PROTO((unsigned int time, short int source));
 Image        *MatchImage            PROTO((unsigned int time, short int source));
 Coords       *MatchMosaic           PROTO((unsigned int time, short int source));
-int	      DetermineTypeCode	    PROTO((Average *average, Measure *measure, int code));
-double	      DetermineTypefrac	    PROTO((Average *average, Measure *measure, PhotCode *code));
-double	      ExtractAverages	    PROTO((PhotCode *code, int mode, Average *average, SecFilt *secfilt, Measure *measure, int param));
-void	      FreeImageSelection    PROTO(());
-int	      GetAverageParam	    PROTO((char *parname));
-void	      GetAverageParamHelp   PROTO(());
-int	      GetMagMode	    PROTO((char *string));
-double 	      GetMeasure	    PROTO((int param, Average *average, Measure *measure, double mag));
-int	      GetMeasureParam	    PROTO((char *parname));
-int	      GetMeasureTypeCode    PROTO((Measure *measure));
-int	      GetPhotcodeInfo	    PROTO((char *string, PhotCode **Code, int *Mode));
-int	      GetSelectionParam	    PROTO(());
-int	      InitPhotcodes	    PROTO(());
-int	      Quality		    PROTO((Measure *measure, int IsDophot));
+int           Quality               PROTO((Measure *measure, int IsDophot));
 int           SelectMags            PROTO((int Nphot, int Tphot, int Ns, Average *average, Measure *measure, SecFilt *secfilt, int UL));
-int	      SetImageSelection	    PROTO((int mode));
-int	      SetPhotSelections	    PROTO((int *argc, char **argv, int Nparams));
-int	      SetSelectionParam	    PROTO((int param));
-int	      TestAverage	    PROTO((PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure));
-int	      TestPhotSelections    PROTO((PhotCode **code, int *mode, int param));
+RegionFile   *SelectRegions         PROTO((char *RegionName, char *RegionList, int *nregions));
+int           SetImageSelection     PROTO((int mode));
+int           SetPhotSelections     PROTO((int *argc, char **argv, int Nparams));
+int           SetRegionSelection    PROTO((int *argc, char **argv, char **RegionName, char **RegionList));
+int           SetSelectionParam     PROTO((int param));
+int           TestAverage           PROTO((PhotCode *code, Average *average, SecFilt *secfilt, Measure *measure));
+int           TestPhotSelections    PROTO((PhotCode **code, int *mode, int param));
+void          aregion               PROTO((GSCRegion *region, FILE *f, double ra, double dec, char *path));
+void          compare               PROTO((Catalog *catlog1, Catalog *catlog2, Vector *rvec,  Vector *dvec,  Vector *mvec, Vector *drvec, Vector *ddvec, Vector *dmvec, double radius));
+void          cprecess              PROTO((Average *average, int Naverage, double in_epoch, double out_epoch));
+RegionFile   *find_regions          PROTO((double Ra, double Dec, double radius, int *Nregions));
+GSCRegion    *get_regions           PROTO((Image *image, int *Nregions));
+void          image_subset          PROTO((Image *image, int Nimage, int **Subset, int *Nsubset, Graphdata *graph, int RegionSelect, unsigned long int tzero, double trange, int TimeSelect));
+int           match_image           PROTO((Image *image, int Nimage, unsigned int T, short int S));
+int           match_image_subset    PROTO((Image *image, int *subset, int Nsubset, unsigned int T, short int S));
 void          print_value           PROTO((FILE *f, double value, short int ival));
-
-RegionFile   *SelectRegions         PROTO((char *RegionName, char *RegionList, int *nregions));
-
-void InitDVO ();
-
-void FreeImageSelection ();
-Image *MatchImage (unsigned int time, short int source);
-int GetRegionSelection ();
-int SetRegionSelection (int *argc, char **argv, char **RegionName, char **RegionList);
-void sort_image_subset (Image *image, int *subset, int N);
-int match_image_subset (Image *image, int *subset, int Nsubset, unsigned int T, short int S);
-int GetTimeSelection (time_t *tz, time_t *te);
+RegionFile   *region_list           PROTO((char *filename, int *Nregions));
+void          sort_image_subset     PROTO((Image *image, int *subset, int N));
+void          sort_images           PROTO((Image *image, int N));
+void          sortave               PROTO((Average *ave, int N));
 
 # endif
Index: trunk/Ohana/src/opihi/lib.data/Makefile
===================================================================
--- trunk/Ohana/src/opihi/lib.data/Makefile	(revision 4800)
+++ trunk/Ohana/src/opihi/lib.data/Makefile	(revision 4805)
@@ -21,5 +21,4 @@
 # general numerical functions (libdata) #####################
 srcs = \
-$(SDIR)/convert.$(ARCH).o               \
 $(SDIR)/sort.$(ARCH).o                  \
 $(SDIR)/fft.$(ARCH).o			\
Index: trunk/Ohana/src/opihi/lib.data/convert.c
===================================================================
--- trunk/Ohana/src/opihi/lib.data/convert.c	(revision 4800)
+++ trunk/Ohana/src/opihi/lib.data/convert.c	(revision 4805)
@@ -3,7 +3,6 @@
 # include <time.h>
 
-char *strptime(const char *s, const char *format, struct tm *tm);
-
-  
+/** additional time / coordinate conversions not supplied by libohana **/
+
 int hh_hms (double hh, int *hr, int *mn, double *sc) {
 
@@ -111,60 +110,4 @@
 }
 
-/***** convert [-]00:00:00 to 0.0000 ****/
-int dms_to_ddd (double *Value, char *string) {
-  
-  int valid, neg, status;
-  double tmp, value;
-  char *p1, *p2, *px;
-
-  valid = FALSE; 
-  neg = FALSE;
-  stripwhite (string);
-  p1 = string;
-  px = string + strlen(string);
-
-  if (string[0] == '-') { 
-    valid = TRUE; 
-    neg = TRUE;
-    p1 = &string[1];
-  }
-  if (string[0] == '+') { 
-    valid = TRUE; 
-    neg = FALSE;
-    p1 = &string[1];
-  }
-  if (isdigit(string[0])) { 
-    valid = TRUE;
-    p1 = &string[0];
-  }
-  if (!valid) { return (FALSE); }
-
-  status = 1;
-  tmp = strtod (p1, &p2);
-  if (p2 == p1) return (FALSE); /* entry not a number: +fred */
-  value = tmp;
-  if (p2 == px) goto escape;    /* entry only number: +1.0 */ 
-  p1 = p2 + 1;
-
-  tmp = strtod (p1, &p2);
-  if (p2 == p1) goto escape;    /* entry not a number: +1:fred */
-  status = 2;
-  value += tmp / 60.0;
-  if (p2 == px) goto escape;    /* entry only number: +1:1 */
-  p1 = p2 + 1;
-
-  tmp = strtod (p1, &p2);
-  if (p2 == p1) goto escape;    /* entry not a number: +1:1:fred */
-  value += tmp / 3600.0;
-
- escape:
-  if (neg) {
-    value *= -1;
-  }
-  *Value = value;
-
-  return (status);
-}
-
 /***** convert 00:00:00 or 00:00 to 0 - 86400 ****/
 int hms_to_sec (char *string, time_t *second) {
@@ -211,33 +154,4 @@
   if (*p) return (FALSE);
   *second = time.tm_wday*86400 + time.tm_hour*3600 + time.tm_min*60 + time.tm_sec;
-  return (TRUE);
-}
-
-/**********/
-int str_to_radec (double *ra, double *dec, char *str1, char *str2) {
-
-  double Ra, Dec;
-
-  *ra = *dec = 0;
-  switch (dms_to_ddd (&Ra, str1)) {
-  case 0:
-    fprintf (stderr, "syntax error in RA\n");
-    return (FALSE);
-  case 1:
-    break;
-  case 2:
-    Ra = Ra * 15;
-    break;
-  }
-  switch (dms_to_ddd (&Dec, str2)) {
-  case 0:
-    fprintf (stderr, "syntax error in DEC\n");
-    return (FALSE);
-  case 1:
-  case 2:
-    break;
-  }
-  *ra = Ra;
-  *dec = Dec;
   return (TRUE);
 }
@@ -302,236 +216,4 @@
 }
 
-/**********/
-int chk_time (char *line) {
-
-  char *p1, *p2;
-  double tmp;
-  int mode;
-
-  p1 = line;
-  tmp = strtod (p1, &p2);
-  mode = TIME_DATE;
-  if (p2 == p1 + strlen (p1) - 1) {
-    if (*p2 == 'j') {
-      mode = TIME_JD;
-    }
-    if (*p2 == 'J') {
-      mode = TIME_MJD;
-    }
-    if (*p2 == 'd') {
-      mode = TIME_DAYS;
-    }
-    if (*p2 == 'h') {
-      mode = TIME_HOURS;
-    }
-    if (*p2 == 'm') {
-      mode = TIME_MINUTES;
-    }
-    if (*p2 == 's') {
-      mode = TIME_SECONDS;
-    }
-  }
-  return (mode);
-}
-
-/**********/
-int str_to_time (char *line, time_t *second) {
-  
-  char *tmpline;
-  struct tm *gmt;
-  struct timeval now;
-  double jd;
-  time_t tsec;
-
-  if (!strcasecmp (line, "NOW")) {
-    gettimeofday (&now, (struct timezone *) NULL);
-    *second = now.tv_sec;
-    return (TRUE);
-  }
-    
-  if (!strncasecmp (line, "TODAY", 5)) {
-    gettimeofday (&now, (struct timezone *) NULL);
-    if (line[5]) { /* line has extra data (ie, hh:mm:ss) */
-      tsec = now.tv_sec;
-      ALLOCATE (tmpline, char, 64);
-      gmt   = gmtime (&tsec);
-      sprintf (tmpline, "%04d/%02d/%02d,%s", 
-	       1900 + gmt[0].tm_year, gmt[0].tm_mon+1, gmt[0].tm_mday, &line[6]);
-      *second = date_to_sec (tmpline);
-      free (tmpline);
-      return (TRUE);
-    } else {
-      *second = 86400 * ((int)(now.tv_sec / 86400));
-      return (TRUE); 
-    }
-  }
-    
-  switch (chk_time (line)) {
-  case 0:
-    return (FALSE);
-  case TIME_JD:
-    jd = strtod (line, 0);
-    *second = jd_to_sec (jd);
-    return (TRUE);
-  case TIME_MJD:
-    jd = strtod (line, 0);
-    *second = mjd_to_sec (jd);
-    return (TRUE);
-  case TIME_DATE:
-    *second = date_to_sec (line);
-    return (TRUE);
-  case TIME_DAYS:
-    *second = strtod (line, 0) * 86400.0;
-    return (TRUE);
-  case TIME_HOURS:
-    *second = strtod (line, 0) * 3600.0;
-    return (TRUE);
-  case TIME_MINUTES:
-    *second = strtod (line, 0) * 60.0;
-    return (TRUE);
-  case TIME_SECONDS:
-    *second = strtod (line, 0);
-    return (TRUE);
-  }
-  return (FALSE);
-}
-
-
-/**********/
-int str_to_dtime (char *line, double *second) {
-  
-  switch (chk_time (line)) {
-  case 0:
-  case TIME_JD:
-  case TIME_MJD:
-  case TIME_DATE:
-    return (FALSE);
-  case TIME_DAYS:
-    *second = strtod (line, 0) * 86400.0;
-    return (TRUE);
-  case TIME_HOURS:
-    *second = strtod (line, 0) * 3600.0;
-    return (TRUE);
-  case TIME_MINUTES:
-    *second = strtod (line, 0) * 60.0;
-    return (TRUE);
-  case TIME_SECONDS:
-    *second = strtod (line, 0);
-    return (TRUE);
-  }
-  return (FALSE);
-}
-
-/**********/
-double sec_to_jd (time_t second) {
-
-  double jd;
-  
-  jd = second/86400.0 + 2440587.5;
-  return (jd);
-}
-
-/**********/
-time_t jd_to_sec (double jd) {
-
-  time_t second;
-
-  second = (jd - 2440587.5)*86400;
-  return (second);
-}
-
-/**********/
-double sec_to_mjd (time_t second) {
-
-  double mjd;
-  
-  mjd = second/86400.0 + 40587.0;
-  return (mjd);
-}
-
-/**********/
-time_t mjd_to_sec (double mjd) {
-
-  time_t second;
-
-  second = (mjd - 40587.0)*86400;
-  return (second);
-}
-
-/**********/
-char *sec_to_date (time_t second) {
-  
-  struct tm *gmt;
-  char *line;
-  
-  ALLOCATE (line, char, 64);
-  gmt   = gmtime (&second);
-  sprintf (line, "%04d/%02d/%02d,%02d:%02d:%02d", 
-	   1900 + gmt[0].tm_year, gmt[0].tm_mon+1, gmt[0].tm_mday, 
-	   gmt[0].tm_hour, gmt[0].tm_min, gmt[0].tm_sec); 
-  return (line);
-
-}
-
-/***** date in format yyyy/mm/dd,hh:mm:ss *****/
-time_t date_to_sec (char *date) {
-  
-  time_t second;
-  double tmp, jd;
-  struct tm now;
-  char *p1, *p2, *px;
-  
-  p1 = date;
-  px = date + strlen(date);
-  bzero (&now, sizeof(now));
-
-  tmp = strtod (p1, &p2);
-  if (p2 == p1) goto escape;
-  now.tm_year = tmp;
-  if (now.tm_year > 1000) now.tm_year -= 1900;
-  if (now.tm_year <   50) now.tm_year += 100;
-  if (p2 == px) goto escape;  
-  p1 = p2 + 1;
-
-  tmp = strtod (p1, &p2);
-  if (p2 == p1) goto escape;
-  now.tm_mon = tmp - 1; /* mon runs from 0 - 11 */
-  if (p2 == px) goto escape;  
-  p1 = p2 + 1;
-
-  tmp = strtod (p1, &p2);
-  if (p2 == p1) goto escape;
-  now.tm_mday = tmp;
-  if (p2 == px) goto escape;  
-  p1 = p2 + 1;
-
-  tmp = strtod (p1, &p2);
-  if (p2 == p1) goto escape;
-  p1 = p2 + 1;
-  now.tm_hour = tmp;
-  if (p2 == px) goto escape;  
-
-  tmp = strtod (p1, &p2);
-  if (p2 == p1) goto escape;
-  now.tm_min = tmp;
-  if (p2 == px) goto escape;  
-  p1 = p2 + 1;
-
-  tmp = strtod (p1, &p2);
-  if (p2 == p1) goto escape;
-  now.tm_sec = tmp;
-  if (p2 == px) goto escape;  
-  p1 = p2 + 1;
-
- escape:
-  jd = now.tm_mday - 32075 + (int)(1461*(1900 + now.tm_year + 4800 + (int)(((now.tm_mon+1)-14)/12))/4)
-    + (int)(367*((now.tm_mon+1) - 2 - (int)(((now.tm_mon+1) - 14)/12)*12)/12)
-    - (int)(3*(int)((1900 + now.tm_year + 4900 + (int)(((now.tm_mon+1) - 14)/12))/100)/4) - 0.5;
-  
-  second = (jd - 2440587.5)*86400 + 3600.0*now.tm_hour + now.tm_min*60.0 + now.tm_sec;
-
-  return (second);
-}
-
 /* convert UNIX time to a value referenced to the TimeReference in the given unit */
 double TimeValue (time_t time, time_t TimeReference, int TimeFormat) {
@@ -599,9 +281,10 @@
 
 /* times may be in forms as:
-   20040200450s (N seconds since 1970.0)
-   2440900.232j (julian date)
-   99/02/23,03:22:18 (date string)
-   (separators may be anything except space, +, -)
-   99:02:15:12:23:30
-   99:02:15:12h23m30s
-   */
+ * 20040200450s (N seconds since 1970.0)
+ * 2440900.232j (julian date)
+ * 99/02/23,03:22:18 (date string)
+ * (separators may be anything except space, +, -)
+ * 99:02:15:12:23:30
+ * 99:02:15:12h23m30s
+ */
+
