IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 20, 2005, 5:40:29 AM (21 years ago)
Author:
eugene
Message:

removing pointless Fread/char

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/cmatch.c

    r4800 r4844  
    11# include "dvo1.h"
    2 # define BYTES_STAR 23
    3 # define BLOCK 1000
    4 # define DNSTARS 1000
    52
    63int cmatch (int argc, char **argv) {
     
    1512  Vector *rvec, *dvec, *mvec, *drvec, *ddvec, *dmvec;
    1613
     14  VarConfig ("GSCDIR", "%s", gscdir);
    1715  VarConfig ("CATDIR", "%s", catdir);
    18   VarConfig ("GSCDIR", "%s", gscdir);
     16  if (VarConfig ("CATMODE", "%s", catalog.catmode) == NULL)
     17    strcpy (catalog.catmode, "RAW");
    1918     
    2019  if (argc != 9) {
    2120    fprintf (stderr, "USAGE: cmatch file radius (RA) (DEC) (Mag) (dRA) (dDEC) (dMag)\n");
     21    fprintf (stderr, "       match a set of object coordinates with a DVO db table\n");
    2222    return (FALSE);
    2323  }
     24
     25  /*** this function is not well-defined.  re-assess it and re-code it ***/
     26  fprintf (stderr, "disabled for now\n");
     27  return (FALSE);
    2428
    2529  radius = atof (argv[2]);
     
    3438  /* load data from the photometry database file */
    3539  sprintf (filename, "%s/%s", catdir, argv[1]);
    36   if (!fits_read_header (filename, &catalog1.header)) {
    37     fprintf (stderr, "no stars in %s\n", filename);
     40  catalog1.filename = filename;
     41  switch (lock_catalog (&catalog, LCK_SOFT)) {
     42  case 2:
     43    unlock_catalog (&catalog);
     44  case 0:
    3845    return (FALSE);
    3946  }
    40   f = fopen (filename, "r");
    41   if (f == (FILE *) NULL) {
    42     fprintf (stderr, "no stars in %s\n", filename);
     47  if (!load_catalog (&catalog, LOAD_AVES | LOAD_MEAS | LOAD_SECF, TRUE)) {
     48    unlock_catalog (&catalog);
    4349    return (FALSE);
    4450  }
    45   fseek (f, catalog1.header.size, SEEK_SET);
    46  
    47   /** find number of stars, measurements **/
    48   catalog1.Naverage = 0;
    49   fits_scan (&catalog1.header, "NSTARS", "%d", 1, &catalog1.Naverage);
    50   if (catalog1.Naverage == 0) {
    51     fprintf (stderr, "no stars in catalog %s\n", filename);
    52     fclose (f);
    53     return (TRUE);
    54   }
    55   ALLOCATE (catalog1.average, Average, catalog1.Naverage);
    56   Nitems = catalog1.Naverage;
    57   nitems = Fread (catalog1.average, sizeof(Average), Nitems, f, "average");
    58   if (nitems != Nitems) {
    59     fprintf (stderr, "ERROR: failed to read data from catalog file %s (1)\n", filename);
    60     fclose (f);
    61     free (catalog1.average);
    62     return (FALSE);
    63   }
    64   fclose (f);
     51  unlock_catalog (&catalog);
    6552  fprintf (stderr, "read %d stars from phot catalog file %s\n", catalog1.Naverage, filename);
    6653
    67   /* load data from the GSC file */
    68   sprintf (filename, "%s/%s", gscdir, argv[1]);
    69   f = fopen (filename, "r");
    70   if (f == (FILE *) NULL) {
    71     fprintf (stderr, "no stars in %s\n", filename);
    72     free (catalog1.average);
    73     return (FALSE);
    74     /* return (FALSE); */
    75   }
    76  
    7754  nstar = 0;
    7855  NSTARS = DNSTARS;
Note: See TracChangeset for help on using the changeset viewer.