- Timestamp:
- Jun 17, 2016, 5:00:44 PM (10 years ago)
- Location:
- trunk/Ohana/src/opihi/dvo
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/Makefile
r39569 r39602 48 48 $(SRC)/catdir.$(ARCH).o \ 49 49 $(SRC)/catname.$(ARCH).o \ 50 $(SRC)/catid.$(ARCH).o \ 50 51 $(SRC)/cmatch.$(ARCH).o \ 51 52 $(SRC)/cmpload.$(ARCH).o \ -
trunk/Ohana/src/opihi/dvo/catname.c
r39457 r39602 1 1 # include "dvoshell.h" 2 int gcat_listnames (SkyList *skylist, HostTable *table, int ShowFile, int ShowHost, int ShowBackup, int ShowFlags, int ShowCoords, int ShowID); 2 3 3 4 int catname (int argc, char **argv) { 4 5 5 int i, N; 6 struct stat filestat; 6 int N; 7 7 8 int ShowCoords = FALSE; 9 if ((N = get_argument (argc, argv, "-coords"))) { 10 remove_argument (N, &argc, argv); 11 ShowCoords = TRUE; 12 } 13 int ShowID = FALSE; 14 if ((N = get_argument (argc, argv, "-catid"))) { 15 remove_argument (N, &argc, argv); 16 ShowID = TRUE; 17 } 18 int ShowFile = FALSE; 19 if ((N = get_argument (argc, argv, "-file"))) { 20 remove_argument (N, &argc, argv); 21 ShowFile = TRUE; 22 } 8 23 int ShowHost = FALSE; 9 24 if ((N = get_argument (argc, argv, "-host"))) { … … 16 31 ShowBackup = TRUE; 17 32 } 18 int FullName = FALSE;19 if ((N = get_argument (argc, argv, "-full-name"))) {20 remove_argument (N, &argc, argv);21 FullName = TRUE;22 }23 33 int ShowFlags = FALSE; 24 34 if ((N = get_argument (argc, argv, "-flags"))) { … … 26 36 ShowFlags = TRUE; 27 37 } 28 int PARALLEL = FALSE;29 if ((N = get_argument (argc, argv, "-parallel"))) {30 remove_argument (N, &argc, argv);31 PARALLEL = TRUE;32 }33 38 34 39 if (argc != 2) { 35 gprint (GP_ERR, "USAGE: catname name [-host] [-backup] [-flags] \n");40 gprint (GP_ERR, "USAGE: catname name [-host] [-backup] [-flags] [-file] [-coords] [-catid]\n"); 36 41 return (FALSE); 37 42 } 38 43 44 /* load sky from correct table */ 39 45 char *CATDIR = GetCATDIR(); 40 46 if (!CATDIR) { … … 47 53 return FALSE; 48 54 } 49 HostTable *table = HostTableLoad (CATDIR, sky->hosts); 50 if (!table) { 51 gprint (GP_ERR, "ERROR: failure reading Host Table %s for database %s\n", sky->hosts, CATDIR); 52 return FALSE; 53 } 55 HostTable *table = NULL; 56 if (HostTableExists (CATDIR, sky->hosts)) { 57 table = HostTableLoad (CATDIR, sky->hosts); 58 if (!table) { 59 gprint (GP_ERR, "ERROR: failure reading Host Table %s for parallel database %s\n", sky->hosts, CATDIR); 60 return FALSE; 61 } 62 } 63 54 64 SkyList *skylist = SkyListByName (sky, argv[1]); 55 65 56 // prepare to handle interrupt signals 57 struct sigaction *old_sigaction = SetInterrupt(); 58 59 for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) { 60 char *filename = NULL; 61 if (PARALLEL) { 62 SkyRegion *region = skylist[0].regions[i]; 63 int hostID = (region->hostFlags & DATA_USE_BCK) ? region->backupID : region->hostID; 64 int index = table->index[hostID]; 65 66 char hostfile[1024]; 67 snprintf (hostfile, 1024, "%s/%s.cpt", table->hosts[index].pathname, region->name); 68 filename = hostfile; 69 } else { 70 filename = skylist[0].filename[i]; 71 } 72 73 gprint (GP_ERR, "%3d %s", i, skylist[0].regions[i][0].name); 74 if (stat (filename, &filestat) != -1) { 75 gprint (GP_ERR, " +"); 76 } else { 77 gprint (GP_ERR, " -"); 78 } 79 if (ShowHost) { 80 gprint (GP_ERR, " %3d", skylist[0].regions[i][0].hostID); 81 } else { 82 gprint (GP_ERR, " "); 83 } 84 if (FullName) { 85 gprint (GP_ERR, " %s", filename); 86 } 87 if (ShowBackup) { 88 gprint (GP_ERR, " %3d", skylist[0].regions[i][0].backupID); 89 } else { 90 gprint (GP_ERR, " "); 91 } 92 if (ShowFlags) { 93 gprint (GP_ERR, " 0x%04x", skylist[0].regions[i][0].hostFlags); 94 } else { 95 gprint (GP_ERR, " "); 96 } 97 gprint (GP_ERR, "\n"); 98 set_str_variable ("CATNAME", filename); 99 } 100 ClearInterrupt (old_sigaction); 66 gcat_listnames (skylist, table, ShowFile, ShowHost, ShowBackup, ShowFlags, ShowCoords, ShowID); 67 SkyListFree (skylist); 101 68 102 69 return (TRUE); 103 SkyListFree (skylist);104 70 } -
trunk/Ohana/src/opihi/dvo/gcat.c
r39457 r39602 1 1 # include "dvoshell.h" 2 int gcat_listnames (SkyList *skylist, HostTable *table, int ShowFile, int ShowHost, int ShowBackup, int ShowFlags, int ShowCoords, int ShowID); 2 3 3 4 int gcat (int argc, char **argv) { 4 5 5 int i, N; 6 struct stat filestat; 7 double Ra, Dec, Radius; 8 SkyTable *sky; 9 SkyList *skylist; 6 int N; 10 7 8 int ShowCoords = FALSE; 9 if ((N = get_argument (argc, argv, "-coords"))) { 10 remove_argument (N, &argc, argv); 11 ShowCoords = TRUE; 12 } 13 int ShowID = FALSE; 14 if ((N = get_argument (argc, argv, "-catid"))) { 15 remove_argument (N, &argc, argv); 16 ShowID = TRUE; 17 } 11 18 int ShowFile = FALSE; 12 19 if ((N = get_argument (argc, argv, "-file"))) { … … 31 38 32 39 if ((argc != 3) && (argc != 4)) { 33 gprint (GP_ERR, "USAGE: gcat RA DEC [Radius] [-host] [-backup] [-flags] \n");40 gprint (GP_ERR, "USAGE: gcat RA DEC [Radius] [-host] [-backup] [-flags] [-file] [-coords] [-catid]\n"); 34 41 return (FALSE); 35 42 } 36 43 37 44 /* load sky from correct table */ 38 Ra = atof (argv[1]);39 Dec = atof (argv[2]);40 if (argc == 4)41 Radius = atof(argv[3]);42 else43 Radius = 0.0001;44 45 sky = GetSkyTable ();46 skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);47 45 char *CATDIR = GetCATDIR(); 46 if (!CATDIR) { 47 gprint (GP_ERR, "CATDIR is not set\n"); 48 return FALSE; 49 } 50 SkyTable *sky = GetSkyTable (); 51 if (!sky) { 52 gprint (GP_ERR, "failed to load sky table for database\n"); 53 return FALSE; 54 } 48 55 HostTable *table = NULL; 49 char *CATDIR = GetCATDIR();50 56 if (HostTableExists (CATDIR, sky->hosts)) { 51 57 table = HostTableLoad (CATDIR, sky->hosts); … … 55 61 } 56 62 } 63 64 double Ra = atof (argv[1]); 65 double Dec = atof (argv[2]); 66 double Radius = (argc == 4) ? atof(argv[3]) : 0.0001; 67 68 SkyList *skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius); 69 70 gcat_listnames (skylist, table, ShowFile, ShowHost, ShowBackup, ShowFlags, ShowCoords, ShowID); 71 SkyListFree (skylist); 72 73 return (TRUE); 74 } 75 76 int gcat_listnames (SkyList *skylist, HostTable *table, int ShowFile, int ShowHost, int ShowBackup, int ShowFlags, int ShowCoords, int ShowID) { 77 78 int i; 79 struct stat filestat; 57 80 58 81 // prepare to handle interrupt signals … … 77 100 } 78 101 102 if (ShowCoords) { 103 gprint (GP_ERR, " %7.3f %7.3f : %7.3f %7.3f", region->Rmin, region->Rmax, region->Dmin, region->Dmax); 104 } else { 105 gprint (GP_ERR, " %33s", " "); 106 } 107 79 108 if (stat (hostfile, &filestat) != -1) { 80 gprint (GP_ERR, " *");109 gprint (GP_ERR, " +"); 81 110 } else { 82 gprint (GP_ERR, " ");111 gprint (GP_ERR, " -"); 83 112 } 113 if (ShowID) { 114 gprint (GP_ERR, " %5d", region->index); 115 } else { 116 gprint (GP_ERR, "%6s", " "); 117 } 84 118 if (ShowHost) { 85 119 gprint (GP_ERR, " %3d", region->hostID); … … 100 134 set_str_variable ("CATNAME", hostfile); 101 135 } 136 102 137 ClearInterrupt (old_sigaction); 103 104 138 return (TRUE); 105 SkyListFree (skylist);106 139 } -
trunk/Ohana/src/opihi/dvo/init.c
r37807 r39602 8 8 int catlog PROTO((int, char **)); 9 9 int catname PROTO((int, char **)); 10 int catid PROTO((int, char **)); 10 11 int catdir_define PROTO((int, char **)); 11 12 int ccd PROTO((int, char **)); … … 70 71 // {1, "calmextract", calmextract, "extract photometry calibration"}, 71 72 {1, "catname", catname, "list catalog files by name"}, 73 {1, "catid", catid, "list catalog files by catID"}, 72 74 {1, "catdir", catdir_define,"re-define CATDIR"}, 73 75 // {1, "ccd", ccd, "plot color-color diagram"},
Note:
See TracChangeset
for help on using the changeset viewer.
