IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38346


Ignore:
Timestamp:
Jun 1, 2015, 8:10:18 PM (11 years ago)
Author:
eugene
Message:

add compression option to catalog; explicit enum types for catmode, catformat, catcompress; gfits_db_init inits all of the structure (but now must be called before signalling values are set)

Location:
branches/eam_branches/ohana.20150429/src
Files:
58 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ohana.20150429/src/addstar/include/addstar.h

    r37807 r38346  
    8484char   GSCFILE[256];
    8585char  *CATDIR;
    86 char   CATMODE[16];    /* raw, mef, split, mysql */
    87 char   CATFORMAT[16];  /* internal, elixir, loneos, panstarrs */
     86char   CATMODE[16];     /* raw, mef, split, mysql */
     87char   CATFORMAT[16];   /* internal, elixir, loneos, panstarrs */
     88char   CATCOMPRESS[16]; /* GZIP_1, NONE */
    8889char   TWO_MASS_DIR_AS[256];
    8990char   TWO_MASS_DIR_DR2[256];
  • branches/eam_branches/ohana.20150429/src/addstar/src/ConfigInit.c

    r33963 r38346  
    134134  ScanConfig (config, "CATMODE",                "%s",  0, CATMODE);
    135135  ScanConfig (config, "CATFORMAT",              "%s",  0, CATFORMAT);
     136  if (!ScanConfig (config, "CATCOMPRESS",       "%s",  0, CATCOMPRESS)) {
     137    strcpy (CATCOMPRESS, "NONE");
     138  }
    136139  if (!ScanConfig (config, "SKY_DEPTH",         "%d",  0, &SKY_DEPTH)) {
    137140    SKY_DEPTH = SKY_DEPTH_HST;
  • branches/eam_branches/ohana.20150429/src/addstar/src/UpdateDatabase_Image.c

    r37807 r38346  
    9292    /*** update the image table ***/
    9393    /* setup image table format and lock */
     94    gfits_db_init (&db);
    9495    db.mode   = dvo_catalog_catmode (CATMODE);
    9596    db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/addstar/src/UpdateImageIDs.c

    r37357 r38346  
    99  /*** update the image table ***/
    1010  /* setup image table format and lock */
     11  gfits_db_init (&db);
    1112  db.mode   = dvo_catalog_catmode (CATMODE);
    1213  db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/addstar/src/addstar.c

    r37807 r38346  
    104104
    105105    // set the parameters which guide catalog open/load/create
    106     catalog.filename  = skylist[0].filename[i];
    107     catalog.catformat = dvo_catalog_catformat (CATFORMAT);  // set the default catformat from config data
    108     catalog.catmode   = dvo_catalog_catmode (CATMODE);      // set the default catmode from config data
    109     catalog.catflags  = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF | LOAD_LENSING;
    110     catalog.Nsecfilt  = GetPhotcodeNsecfilt ();
     106    catalog.filename    = skylist[0].filename[i];
     107    catalog.catmode     = dvo_catalog_catmode (CATMODE);         // set the default catmode from config data
     108    catalog.catformat   = dvo_catalog_catformat (CATFORMAT);     // set the default catformat from config data
     109    catalog.catcompress = dvo_catalog_catcompress (CATCOMPRESS); // set the default catcompress from config data
     110    catalog.catflags    = LOAD_AVES | LOAD_MEAS | LOAD_MISS | LOAD_SECF | LOAD_LENSING;
     111    catalog.Nsecfilt    = GetPhotcodeNsecfilt ();
    111112
    112113    // XXX need to do something to enforce consistency.  we can change options.update
     
    193194  /*** update the image table ***/
    194195  /* setup image table format and lock */
     196  gfits_db_init (&db);
    195197  db.mode   = dvo_catalog_catmode (CATMODE);
    196198  db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/addstar/src/addstar_create_ID.c

    r35760 r38346  
    1010  /*** update the image table ***/
    1111  /* setup image table format and lock */
    12   // gfits_db_init (&db);
     12  gfits_db_init (&db);
    1313  db.mode   = dvo_catalog_catmode (CATMODE);
    1414  db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/addstar/src/dumpskycells.c

    r33719 r38346  
    4646  /*** open the image table ***/
    4747  /* setup image table format and lock */
     48  gfits_db_init (&db);
    4849  db.mode   = dvo_catalog_catmode (CATMODE);
    4950  db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/addstar/src/findskycell.c

    r38344 r38346  
    173173  snprintf (imagefile, DVO_MAX_PATH, "%s/Images.dat", catdir);
    174174
     175  gfits_db_init (&db);
    175176  status = dvo_image_lock (&db, imagefile, 2.0, LCK_XCLD);
    176177  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
     
    557558  snprintf (imagefile, DVO_MAX_PATH, "%s/Images.dat", catdir);
    558559
     560  gfits_db_init (&db);
    559561  status = dvo_image_lock (&db, imagefile, 2.0, LCK_XCLD);
    560562  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
  • branches/eam_branches/ohana.20150429/src/addstar/src/loadsupercos.c

    r33653 r38346  
    4747
    4848  // attempt to open the existing images table.  if it does not exist, we will save the loaded images
     49  gfits_db_init (&db);
    4950  db.mode   = dvo_catalog_catmode (CATMODE);
    5051  db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/addstar/src/skycells.c

    r21048 r38346  
    1212  /*** update the image table ***/
    1313  /* setup image table format and lock */
     14  gfits_db_init (&db);
    1415  db.mode   = dvo_catalog_catmode (CATMODE);
    1516  db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/checkastro/src/checkastro_images.c

    r36833 r38346  
    1111  /* register database handle with shutdown procedure */
    1212  set_db (&db);
     13  gfits_db_init (&db);
    1314
    1415  /* lock and load the image db table */
  • branches/eam_branches/ohana.20150429/src/delstar/src/delstar.c

    r38344 r38346  
    1212  if (!SKIP_IMAGES) {
    1313    set_db (&db);
     14    gfits_db_init (&db);
    1415    status = dvo_image_lock (&db, ImageCat, 60.0, LCK_XCLD); /* XCLD */
    1516    if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
  • branches/eam_branches/ohana.20150429/src/dvomerge/src/dvoconvert.c

    r38344 r38346  
    122122  /*** load output/Images.dat ***/
    123123  sprintf (ImageCat, "%s/Images.dat", output);
     124  gfits_db_init (&outDB);
    124125  outDB.mode   = dvo_catalog_catmode (CATMODE);
    125126  outDB.format = dvo_catalog_catformat (CATFORMAT);
     
    135136  /*** load input/Images.dat ***/
    136137  sprintf (ImageCat, "%s/Images.dat", input);
     138  gfits_db_init (&inDB);
    137139  // inDB.mode   = dvo_catalog_catmode (CATMODE);
    138140  // inDB.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/dvomerge/src/dvomergeCreate.c

    r37116 r38346  
    204204    /*** load output/Images.dat ***/
    205205    sprintf (ImageCat, "%s/Images.dat", output);
     206    gfits_db_init (&outDB);
    206207    outDB.mode   = dvo_catalog_catmode (CATMODE);
    207208    outDB.format = dvo_catalog_catformat (CATFORMAT);
     
    218219    /*** load input1/Images.dat ***/
    219220    sprintf (ImageCat, "%s/Images.dat", input1);
     221    gfits_db_init (&in1DB);
    220222    in1DB.mode   = dvo_catalog_catmode (CATMODE);
    221223    in1DB.format = dvo_catalog_catformat (CATFORMAT);
     
    237239    /*** load input2/Images.dat ***/
    238240    sprintf (ImageCat, "%s/Images.dat", input2);
     241    gfits_db_init (&in2DB);
    239242    in2DB.mode   = dvo_catalog_catmode (CATMODE);
    240243    in2DB.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/dvomerge/src/dvomergeImageIDs.c

    r36833 r38346  
    1010  /*** load input1/Images.dat ***/
    1111  sprintf (ImageCat, "%s/Images.dat", input);
     12  gfits_db_init (&inDB);
    1213  inDB.mode   = dvo_catalog_catmode (CATMODE);
    1314  inDB.format = dvo_catalog_catformat (CATFORMAT);
    14   status       = dvo_image_lock (&inDB, ImageCat, 3600.0, LCK_SOFT);  // shorter timeout?
     15  status      = dvo_image_lock (&inDB, ImageCat, 3600.0, LCK_SOFT);  // shorter timeout?
    1516  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", inDB.filename);
    1617
     
    3738  /*** load output/Images.dat ***/
    3839  sprintf (ImageCat, "%s/Images.dat", output);
     40  gfits_db_init (&outDB);
    3941  outDB.mode   = dvo_catalog_catmode (CATMODE);
    4042  outDB.format = dvo_catalog_catformat (CATFORMAT);
     
    9395  /*** load input1/Images.dat ***/
    9496  sprintf (ImageCat, "%s/Images.dat", input);
     97  gfits_db_init (&inDB);
    9598  inDB.mode   = dvo_catalog_catmode (CATMODE);
    9699  inDB.format = dvo_catalog_catformat (CATFORMAT);
    97   status       = dvo_image_lock (&inDB, ImageCat, 5400.0, LCK_XCLD);  // shorter timeout?
     100  status      = dvo_image_lock (&inDB, ImageCat, 5400.0, LCK_XCLD);  // shorter timeout?
    98101  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", inDB.filename);
    99102
     
    115118  /*** load output/Images.dat ***/
    116119  sprintf (ImageCat, "%s/Images.dat", output);
     120  gfits_db_init (&outDB);
    117121  outDB.mode   = dvo_catalog_catmode (CATMODE);
    118122  outDB.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/dvomerge/src/dvorepairDeleteImagesByExternID.c

    r38345 r38346  
    493493
    494494  /* setup image table format and lock */
     495  gfits_db_init (&db);
    495496  db.mode    = dvo_catalog_catmode ("SPLIT");
    496497  db.format  = dvo_catalog_catformat ("PS1_V5");
  • branches/eam_branches/ohana.20150429/src/dvomerge/src/dvorepairFixImages.c

    r38344 r38346  
    255255
    256256  /* setup image table format and lock */
     257  gfits_db_init (oldDB);
    257258  db.mode   = oldDB->mode;
    258259  db.format = oldDB->format;
  • branches/eam_branches/ohana.20150429/src/dvomerge/src/dvoverify_utils.c

    r38344 r38346  
    467467
    468468  // load the iage database table
     469  gfits_db_init (&inDB);
    469470  status = dvo_image_lock (&inDB, ImageCat, 3600.0, LCK_SOFT);  // shorter timeout?
    470471  if (!status) {
  • branches/eam_branches/ohana.20150429/src/fakeastro/src/fakeastro_images.c

    r37807 r38346  
    6767
    6868  /* setup image table format and lock */
     69  gfits_db_init (db);
    6970  db->mode    = dvo_catalog_catmode (CATMODE);
    7071  db->format  = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/fakeastro/src/load_template_images.c

    r38344 r38346  
    55  FITS_DB db;
    66
     7  gfits_db_init (&db);
    78  db.mode    = dvo_catalog_catmode (CATMODE);
    89  db.format  = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/getstar/src/dvoImageExtract.c

    r38344 r38346  
    1414  /*** update the image table ***/
    1515  /* setup image table format and lock */
     16  gfits_db_init (&db);
    1617  db.mode   = dvo_catalog_catmode (CATMODE);
    1718  db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/getstar/src/dvoImageOverlaps.c

    r38344 r38346  
    1717  /*** update the image table ***/
    1818  /* setup image table format and lock */
     19  gfits_db_init (&db);
    1920  db.mode   = dvo_catalog_catmode (CATMODE);
    2021  db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/getstar/src/dvoImagesAtCoords.c

    r38344 r38346  
    4343    /*** update the image table ***/
    4444    /* setup image table format and lock */
     45    gfits_db_init (&db);
    4546    db.mode   = dvo_catalog_catmode (CATMODE);
    4647    db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/imregister/imreg/imregclient.c

    r38345 r38346  
    6666  if (NoReg) dump_data (image, Nentry);
    6767
     68  gfits_db_init (&db);
    6869  db.lockstate = LCK_HARD;
    6970  db.timeout   = 300.0;
    70   gfits_db_init (&db);
    7171
    7272  if (!gfits_db_lock (&db, TempDB)) {
  • branches/eam_branches/ohana.20150429/src/imregister/src/detregister.c

    r38345 r38346  
    1717  SaveEntry (argv[1], &newdata, descriptor.imageID);
    1818
     19  gfits_db_init (&db);
    1920  db.lockstate = LCK_HARD;
    2021  db.timeout   = 300.0;
    21   gfits_db_init (&db);
    2222
    2323  dBFile = set_dBFile ();
  • branches/eam_branches/ohana.20150429/src/imregister/src/detsearch.c

    r38344 r38346  
    1717  if (output.Criteria) PrintCriteria ();
    1818       
     19  gfits_db_init (&db);
    1920  db.lockstate = (output.Modify || output.Delete) ? LCK_HARD : LCK_SOFT;
    2021  db.timeout   = 300.0;
    21   gfits_db_init (&db);
    2222
    2323  dBFile = set_dBFile ();
  • branches/eam_branches/ohana.20150429/src/imregister/src/imphotsearch.c

    r38344 r38346  
    1414  args (argc, argv);
    1515 
     16  gfits_db_init (&db);
    1617  db.lockstate = (options.modify) ? LCK_HARD : LCK_SOFT;
    1718  db.timeout   = 300.0;
    18   gfits_db_init (&db);
    1919
    2020  /* don't create a new image table if not available */
  • branches/eam_branches/ohana.20150429/src/imregister/src/imregister.c

    r38345 r38346  
    1717  if (NoReg) goto skip_reg;
    1818
     19  gfits_db_init (&db);
    1920  db.lockstate = LCK_HARD;
    2021  db.timeout   = 300.0;
    21   gfits_db_init (&db);
    2222
    2323  if (!gfits_db_lock (&db, ImageDB)) {
  • branches/eam_branches/ohana.20150429/src/imregister/src/imregtable.c

    r38345 r38346  
    4040
    4141  /* load database table */
     42  gfits_db_init (&db);
    4243  db.lockstate = LCK_HARD;
    4344  db.timeout   = 300.0;
    44   gfits_db_init (&db);
    4545
    4646  if (!gfits_db_lock (&db, ImageDB)) {
  • branches/eam_branches/ohana.20150429/src/imregister/src/imsearch.c

    r38344 r38346  
    1212  args (argc, argv);
    1313
     14  gfits_db_init (&db);
    1415  db.lockstate = (output.modify || output.delete) ? LCK_HARD : LCK_SOFT;
    1516  db.timeout   = 300.0;
    16   gfits_db_init (&db);
    1717
    1818  if (!gfits_db_lock (&db, ImageDB)) {
  • branches/eam_branches/ohana.20150429/src/imregister/src/imstatreg.c

    r38344 r38346  
    4040  }
    4141
     42  gfits_db_init (&image_db);
    4243  image_db.lockstate = LCK_HARD;
    4344  image_db.timeout   = 300.0;
    44   gfits_db_init (&image_db);
    4545
    4646  temp_db.lockstate = LCK_HARD;
  • branches/eam_branches/ohana.20150429/src/imregister/src/photreg.c

    r38345 r38346  
    1212  regargs (argc, argv, &newdata);
    1313
     14  gfits_db_init (&db);
    1415  db.lockstate = LCK_HARD;
    1516  db.timeout   = 300.0;
    16   gfits_db_init (&db);
    1717
    1818  filename = PhotDB;
  • branches/eam_branches/ohana.20150429/src/imregister/src/photsearch.c

    r38344 r38346  
    1515  args (argc, argv);
    1616
     17  gfits_db_init (&db);
    1718  db.lockstate = (output.modify || output.delete) ? LCK_HARD : LCK_SOFT;
    1819  db.timeout   = 300.0;
    19   gfits_db_init (&db);
    2020
    2121  if (!strcmp (output.db, "phot")) {
  • branches/eam_branches/ohana.20150429/src/imregister/src/spregister.c

    r38345 r38346  
    1717  if (NoReg) exit (0);
    1818
     19  gfits_db_init (&db);
    1920  db.lockstate = LCK_HARD;
    2021  db.timeout   = 300.0;
    21   gfits_db_init (&db);
    2222
    2323  if (!gfits_db_lock (&db, SpectrumDB)) {
  • branches/eam_branches/ohana.20150429/src/imregister/src/spsearch.c

    r38344 r38346  
    1212  args (argc, argv);
    1313
     14  gfits_db_init (&db);
    1415  db.lockstate = (output.modify || output.delete) ? LCK_HARD : LCK_SOFT;
    1516  db.timeout   = 300.0;
    16   gfits_db_init (&db);
    1717
    1818  if (!gfits_db_lock (&db, SpectrumDB)) {
  • branches/eam_branches/ohana.20150429/src/libdvo/include/dvo.h

    r38345 r38346  
    1010
    1111/* DVO table modes */
    12 typedef enum {DVO_MODE_UNDEF, DVO_MODE_RAW, DVO_MODE_MEF, DVO_MODE_SPLIT, DVO_MODE_MYSQL} DVOTableMode;
     12typedef enum {DVO_MODE_UNDEF = 0, DVO_MODE_RAW, DVO_MODE_MEF, DVO_MODE_SPLIT, DVO_MODE_MYSQL} DVOCatMode;
     13
     14/* DVO table modes */
     15typedef enum {DVO_COMPRESS_NONE = 0, DVO_COMPRESS_GZIP_1} DVOCatCompress; //
    1316
    1417/* DVO table formats */
    1518typedef enum {
    16   DVO_FORMAT_UNDEF,
     19  DVO_FORMAT_UNDEF = 0,
    1720  DVO_FORMAT_INTERNAL,
    1821  DVO_FORMAT_ELIXIR,
     
    3033  DVO_FORMAT_PS1_V4,
    3134  DVO_FORMAT_PS1_V5,
    32 } DVOTableFormat;
    33 
    34 /* image data modes in RegImage */
    35 typedef enum {T_UNDEF = -1, T_NONE, T_OBJECT, T_DARK, T_BIAS, T_FLAT, T_MASK, T_FRINGE, T_SCATTER, T_MODES, T_FRINGEPTS, T_ANY, N_TYPE} ElixirDetrendTypes;
    36 typedef enum {M_UNDEF = -1, M_NONE, M_MEF, M_SPLIT, M_SINGLE, M_CUBE, M_SLICE, M_MODES, N_MODE} ElixirDetrendModes;
     35} DVOCatFormat;
    3736
    3837typedef enum {DVO_CAT_OPEN_FAIL, DVO_CAT_OPEN_OK, DVO_CAT_OPEN_EMPTY} DVOCatalogOpenModes;
    39 
    40 // these are used as NAN for types of int values
    41 typedef enum {
    42   NAN_S_CHAR  = 0x7f,
    43   NAN_U_CHAR  = 0xff,   // was NO_ERR
    44   NAN_S_SHORT = 0x7fff, // was NO_MAG
    45   NAN_U_SHORT = 0xffff,
    46   NAN_S_INT   = 0x7fffffff,
    47   NAN_U_INT   = (signed int) 0xffffffff,
    48 } DVO_INT_NAN;
    49 
    50 // max path length
    51 # define DVO_MAX_PATH 1024
    52 
    53 /* RegImage.flag values */
    54 # define IMREG_DIST  0x01 /* image distributed, only imregister-3.0 */
    5538
    5639/* catalog values to be loaded */
     
    7457  SKIP_GALSHAPE = 0x8000,
    7558} DVOCatFlags;
     59
     60/* image data modes in RegImage */
     61typedef enum {T_UNDEF = -1, T_NONE, T_OBJECT, T_DARK, T_BIAS, T_FLAT, T_MASK, T_FRINGE, T_SCATTER, T_MODES, T_FRINGEPTS, T_ANY, N_TYPE} ElixirDetrendTypes;
     62typedef enum {M_UNDEF = -1, M_NONE, M_MEF, M_SPLIT, M_SINGLE, M_CUBE, M_SLICE, M_MODES, N_MODE} ElixirDetrendModes;
     63
     64// these are used as NAN for types of int values
     65typedef enum {
     66  NAN_S_CHAR  = 0x7f,
     67  NAN_U_CHAR  = 0xff,   // was NO_ERR
     68  NAN_S_SHORT = 0x7fff, // was NO_MAG
     69  NAN_U_SHORT = 0xffff,
     70  NAN_S_INT   = 0x7fffffff,
     71  NAN_U_INT   = (signed int) 0xffffffff,
     72} DVO_INT_NAN;
     73
     74// max path length
     75# define DVO_MAX_PATH 1024
     76
     77/* RegImage.flag values */
     78# define IMREG_DIST  0x01 /* image distributed, only imregister-3.0 */
    7679
    7780/* photometry code types */
     
    228231  char   lockstate;
    229232  char   mode;          /* what data storage mode is used for disk file? */
    230   char   format;        /* what data format is used for disk file? */
     233  DVOCatFormat format;  /* what data format is used for disk file? */
    231234  char   virtual;       /* is table in ftable or vtable? */
    232235  char   nativeOrder;   /* is table in internal byte-order? */
     
    786789  /* extra catalog information */
    787790  char lockmode;
    788   char catmode;                         /* storage mode (raw, mef, split, mysql) */
    789   char catformat;                       /* storage format (elixir, panstarrs, etc) */
     791  DVOCatMode     catmode;     /* storage mode (raw, mef, split, mysql) */
     792  DVOCatFormat   catformat;                     /* storage format (elixir, panstarrs, etc) */
     793  DVOCatCompress catcompress;                   // output compress mode
     794  DVOCatFlags    catflags;                      /* choices to be loaded */
     795 
    790796  int sorted;                           /* is measure table average-sorted? (NOTE this is an int only because gfits_scan %t requires it) */
    791   char compressOutput;
    792  
    793   DVOCatFlags catflags; /* choices to be loaded */
     797
    794798
    795799  /* pointers for data manipulation */
     
    938942int dvo_catalog_save_complete (Catalog *catalog, char VERBOSE);
    939943int dvo_catalog_update (Catalog *catalog, char VERBOSE);
    940 int dvo_catalog_catformat (char *catformat);
    941 int dvo_catalog_catmode (char *catmode);
     944DVOCatFormat dvo_catalog_catformat (char *catformat);
     945DVOCatMode dvo_catalog_catmode (char *catmode);
     946DVOCatCompress dvo_catalog_catcompress (char *catcompress);
     947char *dvo_catalog_compress_string (DVOCatCompress catcompress);
    942948void dvo_catalog_test (Catalog *catalog, int halt);
    943949
     
    966972int WriteRawSecFilt (FILE *f, SecFilt *secfilt, off_t Nsecfilt, char format);
    967973
    968 DVOTableFormat FtableGetFormat (FTable *ftable);
    969 
    970 Average *FtableToAverage (FTable *ftable, off_t *Naverage, char *format, SecFilt **primary, char nativeBytes);
    971 Measure *FtableToMeasure (FTable *ftable, Average *average, off_t *Nmeasure, char *format);
    972 SecFilt *FtableToSecFilt (FTable *ftable, off_t *Nsecfilt, char *format);
    973 Lensing *FtableToLensing (FTable *ftable, off_t *Nlensing, char *format);
    974 Lensobj *FtableToLensobj (FTable *ftable, off_t *Nlensobj, char *format);
    975 StarPar *FtableToStarPar (FTable *ftable, off_t *Nstarpar, char *format);
    976 GalShape *FtableToGalShape (FTable *ftable, off_t *Ngalshape, char *format);
    977 
    978 int      FtableToImage   (FTable *ftable, Header *theader, char *format);
    979 
    980 int AverageToFtable (FTable *ftable, Average *average, off_t Naverage, char format, SecFilt *primary, int swapFromNative);
    981 int MeasureToFtable (FTable *ftable, Average *average, Measure *measure, off_t Nmeasure, char format);
    982 int SecFiltToFtable (FTable *ftable, SecFilt *secfilt, off_t Nsecfilt, char format);
    983 int LensingToFtable (FTable *ftable, Lensing *lensing, off_t Nlensing, char format);
    984 int LensobjToFtable (FTable *ftable, Lensobj *lensobj, off_t Nlensobj, char format);
    985 int StarParToFtable (FTable *ftable, StarPar *starpar, off_t Nstarpar, char format);
    986 int GalShapeToFtable (FTable *ftable, GalShape *galshape, off_t Ngalshape, char format);
    987 
    988 int ImageToFtable (FTable *ftable, Header *theader, char format);
    989 int ImageToVtable (VTable *vtable, Header *theader, char format);
     974DVOCatFormat FtableGetFormat (FTable *ftable);
     975
     976Measure *FtableToMeasure   (FTable *ftable, Average *average, off_t *Nmeasure, DVOCatFormat *format);
     977Average *FtableToAverage   (FTable *ftable, off_t *Naverage,  DVOCatFormat *format, SecFilt **primary, char nativeBytes);
     978SecFilt *FtableToSecFilt   (FTable *ftable, off_t *Nsecfilt,  DVOCatFormat *format);
     979Lensing *FtableToLensing   (FTable *ftable, off_t *Nlensing,  DVOCatFormat *format);
     980Lensobj *FtableToLensobj   (FTable *ftable, off_t *Nlensobj,  DVOCatFormat *format);
     981StarPar *FtableToStarPar   (FTable *ftable, off_t *Nstarpar,  DVOCatFormat *format);
     982GalShape *FtableToGalShape (FTable *ftable, off_t *Ngalshape, DVOCatFormat *format);
     983
     984int      FtableToImage   (FTable *ftable, Header *theader, DVOCatFormat *format);
     985
     986int MeasureToFtable  (FTable *ftable, Average  *average,  Measure *measure, off_t Nmeasure, DVOCatFormat format);
     987int AverageToFtable  (FTable *ftable, Average  *average,  off_t Naverage,  DVOCatFormat format, SecFilt *primary, int swapFromNative);
     988int SecFiltToFtable  (FTable *ftable, SecFilt  *secfilt,  off_t Nsecfilt,  DVOCatFormat format);
     989int LensingToFtable  (FTable *ftable, Lensing  *lensing,  off_t Nlensing,  DVOCatFormat format);
     990int LensobjToFtable  (FTable *ftable, Lensobj  *lensobj,  off_t Nlensobj,  DVOCatFormat format);
     991int StarParToFtable  (FTable *ftable, StarPar  *starpar,  off_t Nstarpar,  DVOCatFormat format);
     992int GalShapeToFtable (FTable *ftable, GalShape *galshape, off_t Ngalshape, DVOCatFormat format);
     993
     994int ImageToFtable (FTable *ftable, Header *theader, DVOCatFormat format);
     995int ImageToVtable (VTable *vtable, Header *theader, DVOCatFormat format);
    990996
    991997# include "loneos_defs.h"
  • branches/eam_branches/ohana.20150429/src/libdvo/src/LoadPhotcodesFITS.c

    r38344 r38346  
    1515
    1616  /* XXX choose more sensible lock timeouts! */
     17  gfits_db_init (&db);
    1718  db.timeout   = 60.0;
    1819  db.lockstate = LCK_SOFT;
    19   gfits_db_init (&db);
    2020
    2121  /* does this mean the db is empty, non-existent, or has access errors? */
  • branches/eam_branches/ohana.20150429/src/libdvo/src/SavePhotcodesFITS.c

    r38345 r38346  
    1717
    1818  /* XXX choose more sensible lock timeouts! */
     19  gfits_db_init (&db);
    1920  db.lockstate = LCK_XCLD;
    2021  db.timeout   = 10.0;
    21   gfits_db_init (&db);
    2222
    2323  /* does this mean the db is empty, non-existent, or has access errors? */
  • branches/eam_branches/ohana.20150429/src/libdvo/src/dvo_catalog.c

    r38331 r38346  
    4242}
    4343
    44 int dvo_catalog_catformat (char *catformat) {
     44DVOCatFormat dvo_catalog_catformat (char *catformat) {
    4545 
    4646  /* set the specified CATFORMAT */
     
    6262}
    6363
    64 int dvo_catalog_catmode (char *catmode) {
     64DVOCatMode dvo_catalog_catmode (char *catmode) {
    6565
    6666  /* set the specified CATMODE */
     
    6969  if (!strcasecmp (catmode, "SPLIT")) return (DVO_MODE_SPLIT);
    7070  return (DVO_MODE_UNDEF);
     71}
     72
     73DVOCatCompress dvo_catalog_catcompress (char *catcompress) {
     74
     75  /* set the specified CATMODE */
     76  if (!strcasecmp (catcompress, "NONE"))   return (DVO_COMPRESS_NONE);
     77  if (!strcasecmp (catcompress, "GZIP_1")) return (DVO_COMPRESS_GZIP_1);
     78  return (DVO_COMPRESS_NONE);
     79}
     80
     81// we can return a static string here unless we run multiple outputs threads at once
     82static char compress_string[16];
     83char *dvo_catalog_compress_string (DVOCatCompress catcompress) {
     84
     85  switch (catcompress) {
     86    case DVO_COMPRESS_NONE:
     87      strcpy (compress_string, "NONE");
     88      break;
     89      case DVO_COMPRESS_GZIP_1:
     90      strcpy (compress_string, "GZIP_1");
     91      break;
     92    default:
     93      myAbort ("error in compress option");
     94  }
     95  return compress_string;
    7196}
    7297
     
    498523    catalog[0].filename = NULL;
    499524
    500     catalog[0].lockmode = 0;
    501     catalog[0].catmode  = 0;
    502     catalog[0].catformat = 0;
    503     catalog[0].catflags = 0;
    504     catalog[0].Nsecfilt = 0;
     525    catalog[0].lockmode    = 0;
     526    catalog[0].catmode     = DVO_MODE_UNDEF;
     527    catalog[0].catformat   = DVO_FORMAT_UNDEF;
     528    catalog[0].catcompress = DVO_COMPRESS_NONE;
     529    catalog[0].catflags    = LOAD_NONE;
     530    catalog[0].Nsecfilt    = 0;
    505531  }
    506532
  • branches/eam_branches/ohana.20150429/src/libdvo/src/dvo_catalog_split.c

    r38345 r38346  
    154154  FTable cmptable;
    155155  Header cmpheader;
    156   cmptable.header = &cmpheader;
    157156  gfits_init_header (&cmpheader);
    158157  gfits_init_table (&cmptable);
     158  cmptable.header = &cmpheader;
    159159 
    160160  int fullWrite = (start == 0) && (Nrows == Ntotal);
    161161
    162   if (fullWrite && catalog->compressOutput) {
    163     if (!gfits_compress_table (ftable, &cmptable, 10, "GZIP_1")) {
     162  if (fullWrite && catalog->catcompress) {
     163    char *compressMode = dvo_catalog_compress_string (catalog->catcompress);
     164    if (!gfits_compress_table (ftable, &cmptable, 10, compressMode)) {
    164165      fprintf (stderr, "compression failure\n");
    165166      return (FALSE);
     
    355356      outtable = &rawtable;
    356357      nativeOrder = TRUE;
     358      catalog->catcompress = DVO_COMPRESS_GZIP_1; // if any table is compressed, set all to a compress state?
    357359    }
    358360    // NOTE: fread_ftable returns an unswapped table; uncompress swaps the bytes into native order
     
    10041006    int swapFromNative = TRUE;
    10051007    int fullWrite = (start == 0) && (Nrows == Naves_disk_new);
    1006     if (fullWrite && catalog->compressOutput) {
     1008    if (fullWrite && catalog->catcompress) {
    10071009      swapFromNative = FALSE;
    10081010    }
  • branches/eam_branches/ohana.20150429/src/libdvo/src/dvo_convert.c

    r38345 r38346  
    1111    constructions below **/
    1212
    13 DVOTableFormat FtableGetFormat (FTable *ftable) {
    14 
    15   DVOTableFormat format;
     13DVOCatFormat FtableGetFormat (FTable *ftable) {
     14
     15  DVOCatFormat format;
    1616  char extname[80];
    1717
     
    5252/*** Average / FTable conversion functions ***/
    5353
    54 Average *FtableToAverage (FTable *ftable, off_t *Naverage, char *format, SecFilt **primary, char nativeBytes) {
     54Average *FtableToAverage (FTable *ftable, off_t *Naverage, DVOCatFormat *format, SecFilt **primary, char nativeBytes) {
    5555
    5656  Average *average;
     
    139139}
    140140
    141 int AverageToFtable (FTable *ftable, Average *average, off_t Naverage, char format, SecFilt *primary, int swapFromNative) {
     141int AverageToFtable (FTable *ftable, Average *average, off_t Naverage, DVOCatFormat format, SecFilt *primary, int swapFromNative) {
    142142 
    143143# define FORMAT_CASE(FORMAT, TYPE)              \
     
    180180
    181181// FtableToMeasure needs the Average since old formats stored measure.dR,dD only
    182 Measure *FtableToMeasure (FTable *ftable, Average *average, off_t *Nmeasure, char *format) {
     182Measure *FtableToMeasure (FTable *ftable, Average *average, off_t *Nmeasure, DVOCatFormat *format) {
    183183
    184184  Measure *measure;
     
    269269
    270270// MeasureToFtable needs the Average since old formats stored measure.dR,dD only
    271 int MeasureToFtable (FTable *ftable, Average *average, Measure *measure, off_t Nmeasure, char format) {
     271int MeasureToFtable (FTable *ftable, Average *average, Measure *measure, off_t Nmeasure, DVOCatFormat format) {
    272272
    273273# define FORMAT_CASE(FORMAT, TYPE, ABS_COORDS)          \
     
    310310/*** SecFilt / FTable conversion functions ***/
    311311
    312 SecFilt *FtableToSecFilt (FTable *ftable, off_t *Nsecfilt, char *format) {
     312SecFilt *FtableToSecFilt (FTable *ftable, off_t *Nsecfilt, DVOCatFormat *format) {
    313313
    314314  SecFilt *secfilt;
     
    380380}
    381381
    382 int SecFiltToFtable (FTable *ftable, SecFilt *secfilt, off_t Nsecfilt, char format) {
     382int SecFiltToFtable (FTable *ftable, SecFilt *secfilt, off_t Nsecfilt, DVOCatFormat format) {
    383383
    384384# define FORMAT_CASE(FORMAT, TYPE) \
     
    420420/*** Lensing / FTable conversion functions ***/
    421421
    422 Lensing *FtableToLensing (FTable *ftable, off_t *Nlensing, char *format) {
     422Lensing *FtableToLensing (FTable *ftable, off_t *Nlensing, DVOCatFormat *format) {
    423423
    424424  Lensing *lensing;
     
    520520
    521521// LensingToFtable needs the Average since old formats stored lensing.dR,dD only
    522 int LensingToFtable (FTable *ftable, Lensing *lensing, off_t Nlensing, char format) {
     522int LensingToFtable (FTable *ftable, Lensing *lensing, off_t Nlensing, DVOCatFormat format) {
    523523
    524524# define FORMAT_CASE(FORMAT, TYPE)              \
     
    559559/*** Lensobj / FTable conversion functions ***/
    560560
    561 Lensobj *FtableToLensobj (FTable *ftable, off_t *Nlensobj, char *format) {
     561Lensobj *FtableToLensobj (FTable *ftable, off_t *Nlensobj, DVOCatFormat *format) {
    562562
    563563  Lensobj *lensobj;
     
    635635
    636636// LensobjToFtable needs the Average since old formats stored lensobj.dR,dD only
    637 int LensobjToFtable (FTable *ftable, Lensobj *lensobj, off_t Nlensobj, char format) {
     637int LensobjToFtable (FTable *ftable, Lensobj *lensobj, off_t Nlensobj, DVOCatFormat format) {
    638638
    639639# define FORMAT_CASE(FORMAT, TYPE)              \
     
    674674/*** StarPar / FTable conversion functions ***/
    675675
    676 StarPar *FtableToStarPar (FTable *ftable, off_t *Nstarpar, char *format) {
     676StarPar *FtableToStarPar (FTable *ftable, off_t *Nstarpar, DVOCatFormat *format) {
    677677
    678678  StarPar *starpar;
     
    738738
    739739// StarParToFtable needs the Average since old formats stored starpar.dR,dD only
    740 int StarParToFtable (FTable *ftable, StarPar *starpar, off_t Nstarpar, char format) {
     740int StarParToFtable (FTable *ftable, StarPar *starpar, off_t Nstarpar, DVOCatFormat format) {
    741741
    742742# define FORMAT_CASE(FORMAT, TYPE)              \
     
    778778/*** GalShape / FTable conversion functions ***/
    779779
    780 GalShape *FtableToGalShape (FTable *ftable, off_t *Ngalshape, char *format) {
     780GalShape *FtableToGalShape (FTable *ftable, off_t *Ngalshape, DVOCatFormat *format) {
    781781
    782782  GalShape *galshape;
     
    842842
    843843// GalShapeToFtable needs the Average since old formats stored galshape.dR,dD only
    844 int GalShapeToFtable (FTable *ftable, GalShape *galshape, off_t Ngalshape, char format) {
     844int GalShapeToFtable (FTable *ftable, GalShape *galshape, off_t Ngalshape, DVOCatFormat format) {
    845845
    846846# define FORMAT_CASE(FORMAT, TYPE)              \
     
    883883// I have loaded the disk db table and now I want to convert to the internal format
    884884// (Image structure), but I onyl
    885 int FtableToImage (FTable *ftable, Header *theader, char *format) {
     885int FtableToImage (FTable *ftable, Header *theader, DVOCatFormat *format) {
    886886
    887887  off_t Nimage;
     
    952952}
    953953
    954 int ImageToFtable (FTable *ftable, Header *theader, char format) {
     954int ImageToFtable (FTable *ftable, Header *theader, DVOCatFormat format) {
    955955
    956956  off_t Nimage;
     
    992992}
    993993
    994 int ImageToVtable (VTable *vtable, Header *theader, char format) {
     994int ImageToVtable (VTable *vtable, Header *theader, DVOCatFormat format) {
    995995
    996996  off_t i, Nrow, Nimage;
  • branches/eam_branches/ohana.20150429/src/libdvo/src/dvo_image.c

    r38344 r38346  
    1919  db[0].lockstate = lockstate;
    2020  db[0].timeout   = timeout;
    21   gfits_db_init (db);
    2221
    2322  if (!gfits_db_lock (db, filename)) {
  • branches/eam_branches/ohana.20150429/src/markstar/src/markstar.c

    r15743 r38346  
    3737
    3838  set_db (&db);
     39  gfits_db_init (&db);
    3940  dvo_image_lock (&db, ImageCat, 3600.0, LCK_XCLD);
    4041
  • branches/eam_branches/ohana.20150429/src/photdbc/src/Shutdown_dvodist.c

    r33655 r38346  
    1111
    1212  // lock the image db table
     13  gfits_db_init (&db);
    1314  int status = dvo_image_lock (&db, ImageCat, 60.0, LCK_XCLD);
    1415  if (!status) {
  • branches/eam_branches/ohana.20150429/src/photdbc/src/copy_images.c

    r38344 r38346  
    1919  if (status == -1) Shutdown ("ERROR: CATDIR %s does not exist, no data in database", path);
    2020
     21  gfits_db_init (&in);
    2122  status = dvo_image_lock (&in, ImageCat, 60.0, LCK_SOFT);
    2223  if (!status) {
     
    3839
    3940  // lock the output catalog
     41  gfits_db_init (&out);
    4042  status = dvo_image_lock (&out, ImageOut, 60.0, LCK_XCLD);
    4143  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", ImageOut);
  • branches/eam_branches/ohana.20150429/src/relastro/src/ImageTable.c

    r38344 r38346  
    77  FITS_DB db;
    88
     9  gfits_db_init (&db);
    910  db.mode   = dvo_catalog_catmode (CATMODE);
    1011  db.format = dvo_catalog_catformat (CATFORMAT);
     
    4243
    4344  // setup image table format and lock
     45  gfits_db_init (&db);
    4446  db.mode   = dvo_catalog_catmode (CATMODE);
    4547  db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/relastro/src/relastro_client.c

    r37807 r38346  
    6969     
    7070      set_db (&db);
     71      gfits_db_init (&db);
    7172
    7273      /* lock and load the image db table */
  • branches/eam_branches/ohana.20150429/src/relastro/src/relastro_images.c

    r37807 r38346  
    1111  /* register database handle with shutdown procedure */
    1212  set_db (&db);
     13  gfits_db_init (&db);
    1314
    1415  /* lock and load the image db table */
  • branches/eam_branches/ohana.20150429/src/relastro/src/relastro_parallel_regions.c

    r37807 r38346  
    1717  // register database handle with shutdown procedure
    1818  set_db (&db);
     19  gfits_db_init (&db);
    1920  db.mode   = dvo_catalog_catmode (CATMODE);
    2021  db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/relphot/src/ImageTable.c

    r38344 r38346  
    77  FITS_DB db;
    88
     9  gfits_db_init (&db);
    910  db.mode   = dvo_catalog_catmode (CATMODE);
    1011  db.format = dvo_catalog_catformat (CATFORMAT);
     
    4546
    4647  // setup image table format and lock
     48  gfits_db_init (&db);
    4749  db.mode   = dvo_catalog_catmode (CATMODE);
    4850  db.format = dvo_catalog_catformat (CATFORMAT);
     51
    4952  status    = dvo_image_lock (&db, filename, 60.0, LCK_XCLD);  // shorter timeout?
    5053  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
  • branches/eam_branches/ohana.20150429/src/relphot/src/relphot_images.c

    r38344 r38346  
    1818  /* register database handle with shutdown procedure */
    1919  set_db (&db);
     20  gfits_db_init (&db);
    2021  db.mode   = dvo_catalog_catmode (CATMODE);
    2122  db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/relphot/src/relphot_parallel_regions.c

    r37807 r38346  
    2323  // register database handle with shutdown procedure
    2424  set_db (&db);
     25  gfits_db_init (&db);
    2526  db.mode   = dvo_catalog_catmode (CATMODE);
    2627  db.format = dvo_catalog_catformat (CATFORMAT);
  • branches/eam_branches/ohana.20150429/src/uniphot/src/fiximids.c

    r35764 r38346  
    1111
    1212  set_db (&db);
     13  gfits_db_init (&db);
    1314  status = dvo_image_lock (&db, ImageCat, 60.0, (UPDATE ? LCK_XCLD : LCK_SOFT));
    1415  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
  • branches/eam_branches/ohana.20150429/src/uniphot/src/fixstkids.c

    r35764 r38346  
    1111
    1212  set_db (&db);
     13  gfits_db_init (&db);
    1314  status = dvo_image_lock (&db, ImageCat, 60.0, (UPDATE ? LCK_XCLD : LCK_SOFT));
    1415  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
  • branches/eam_branches/ohana.20150429/src/uniphot/src/setfwhm.c

    r33654 r38346  
    1313
    1414  set_db (&db);
     15  gfits_db_init (&db);
    1516  status = dvo_image_lock (&db, ImageCat, 60.0, (UPDATE ? LCK_XCLD : LCK_SOFT));
    1617  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
  • branches/eam_branches/ohana.20150429/src/uniphot/src/setphot.c

    r33963 r38346  
    1414
    1515  set_db (&db);
     16  gfits_db_init (&db);
    1617  status = dvo_image_lock (&db, ImageCat, 60.0, (UPDATE ? LCK_XCLD : LCK_SOFT));
    1718  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
  • branches/eam_branches/ohana.20150429/src/uniphot/src/setposangle.c

    r34749 r38346  
    1111
    1212  set_db (&db);
     13  gfits_db_init (&db);
    1314  status = dvo_image_lock (&db, ImageCat, 60.0, (UPDATE ? LCK_XCLD : LCK_SOFT));
    1415  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
  • branches/eam_branches/ohana.20150429/src/uniphot/src/uniphot.c

    r33654 r38346  
    1919
    2020  set_db (&db);
     21  gfits_db_init (&db);
    2122  status = dvo_image_lock (&db, ImageCat, 60.0, (UPDATE ? LCK_XCLD : LCK_SOFT));
    2223  if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
Note: See TracChangeset for help on using the changeset viewer.