Changeset 38669
- Timestamp:
- Aug 9, 2015, 6:45:41 AM (11 years ago)
- Location:
- branches/eam_branches/ipp-20150625/Ohana/src/photdbc
- Files:
-
- 3 edited
-
include/dvocompress.h (modified) (1 diff)
-
src/args_dvocompress.c (modified) (2 diffs)
-
src/dvocompress_catalogs.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20150625/Ohana/src/photdbc/include/dvocompress.h
r38657 r38669 16 16 char *UPDATE_CATFORMAT; /* internal, elixir, loneos, panstarrs */ 17 17 char *UPDATE_CATCOMPRESS; /* ?? */ 18 int SKIP_COMPRESSED; 18 19 19 20 SkyRegion REGION; -
branches/eam_branches/ipp-20150625/Ohana/src/photdbc/src/args_dvocompress.c
r38657 r38669 30 30 UPDATE_CATCOMPRESS = strcreate (argv[N]); 31 31 remove_argument (N, argc, argv); 32 } 33 34 SKIP_COMPRESSED = FALSE; 35 if ((N = get_argument (*argc, argv, "-skip-compressed"))) { 36 remove_argument (N, argc, argv); 37 SKIP_COMPRESSED = TRUE; 32 38 } 33 39 … … 149 155 UPDATE_CATCOMPRESS = strcreate (argv[N]); 150 156 remove_argument (N, argc, argv); 157 } 158 159 SKIP_COMPRESSED = FALSE; 160 if ((N = get_argument (*argc, argv, "-skip-compressed"))) { 161 remove_argument (N, argc, argv); 162 SKIP_COMPRESSED = TRUE; 151 163 } 152 164 -
branches/eam_branches/ipp-20150625/Ohana/src/photdbc/src/dvocompress_catalogs.c
r38657 r38669 35 35 DVO_LOAD_GALPHOT; 36 36 37 // XXX this is fairly ad-hoc : I'd like to be able to check that the operation below 38 // is a NOOP, but I don't want to put in all the full logic at the moment. instead, 39 // since I know I just want to compress previously uncompressed catalogs, I'm just 40 // going to get the cpt header and check for ZTABLE. Too bad my APIs force me to read 41 // the header in full here and then again in dvo_catalog_open. 42 43 if (SKIP_COMPRESSED) { 44 FILE *f = fopen (catalog.filename, "r"); 45 if (!f) { fprintf (stderr, "cannot open %s, skipping\n", catalog.filename); continue; } 46 47 Header header; 48 if (!gfits_fread_Xheader (f, &header, 0)) { 49 fprintf (stderr, "cannot read header for %s, skipping\n", catalog.filename); 50 fclose (f); 51 continue; 52 } 53 54 int isZtable; 55 int ztableStatus = gfits_scan_alt (&header, "ZTABLE", "%t", 1, &isZtable); 56 57 fclose (f); 58 gfits_free_header (&header); 59 60 if (ztableStatus && isZtable) { 61 fprintf (stderr, "%s is compressed, skipping\n", catalog.filename); 62 continue; 63 } 64 } 65 66 // XXX for a test, do nothing 67 fprintf (stderr, "%s is not compressed, compressing\n", catalog.filename); 68 69 // ohana_memcheck_func (TRUE); 70 37 71 // an error exit status here is a significant error 38 72 if (!dvo_catalog_open (&catalog, skylist[0].regions[i], (VERBOSE > 1), "w")) { … … 40 74 exit (2); 41 75 } 76 77 // ohana_memcheck_func (TRUE); 42 78 43 79 // skip empty input catalogs … … 57 93 } 58 94 95 // ohana_memcheck_func (TRUE); 96 59 97 if (!dvo_catalog_backup (&catalog, TRUE)) { 60 98 fprintf (stderr, "ERROR: failed to make backup for catalog %s\n", catalog.filename); … … 62 100 } 63 101 102 // ohana_memcheck_func (TRUE); 103 64 104 SetProtect (TRUE); 65 105 if (!dvo_catalog_save (&catalog, (VERBOSE > 1))) { fprintf (stderr, "ERROR: failed to save %s\n", catalog.filename); exit (1); } 66 106 if (!dvo_catalog_unlock (&catalog)) { fprintf (stderr, "ERROR: failed to unlock %s\n", catalog.filename); exit (1); } 67 107 SetProtect (FALSE); 108 109 // ohana_memcheck_func (TRUE); 68 110 69 111 if (!dvo_catalog_unlink_backup (&catalog, TRUE)) { … … 110 152 if (UPDATE_CATCOMPRESS) { strextend (&command, "-set-compress %s", UPDATE_CATCOMPRESS); } 111 153 if (UPDATE_CATFORMAT) { strextend (&command, "-set-format %s", UPDATE_CATFORMAT); } 154 if (SKIP_COMPRESSED) { strextend (&command, "-skip-compressed"); } 112 155 113 156 fprintf (stderr, "command: %s\n", command);
Note:
See TracChangeset
for help on using the changeset viewer.
