Changeset 16898
- Timestamp:
- Mar 8, 2008, 1:55:06 PM (18 years ago)
- Location:
- trunk/pstamp/src
- Files:
-
- 1 added
- 2 edited
-
Makefile.am (modified) (4 diffs)
-
pstampdump.c (added)
-
pstamprequest.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/pstamp/src/Makefile.am
r16593 r16898 1 bin_PROGRAMS = ppstamp pstamprequest pstampparse pstampfinish 1 bin_PROGRAMS = ppstamp pstamprequest pstampparse pstampfinish pstampdump 2 2 3 3 noinst_HEADERS = \ … … 9 9 pstampparse_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) 10 10 pstampfinish_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(IPPDB_CFLAGS) 11 pstampdump_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) 11 12 12 13 # $(PSASTRO_CFLAGS) $(PPSTATS_CFLAGS) $(ppstamp_CFLAGS) … … 16 17 pstampparse_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) 17 18 pstampfinish_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(IPPDB_LIBS) 19 pstampdump_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) 18 20 19 21 ppstamp_SOURCES = \ … … 41 43 pstampfinish.c 42 44 45 pstampdump_SOURCES = \ 46 pstampdump.c 47 43 48 44 49 clean-local: -
trunk/pstamp/src/pstamprequest.c
r16593 r16898 4 4 #include "pstampROI.h" 5 5 6 // pstamprequest - create a fits table for a request to the postage stamp server 7 8 9 /******* 10 11 Description of program arguments 12 13 14 Request Style 15 ------------- 16 One of the following is required to select the target image files 17 18 -byid raw exp_id class_id 19 -byid chip exp_id chip_id 20 -byid warp warp_id 21 -byid diff diff_id 22 -byid stack stack_id 23 24 25 -byexp raw | chip | warp | diff | stack exp_name 26 27 for raw and chip level the chip name must be specified as well (see -chip) 28 29 30 -bycoord 31 32 For this style the center of the ROI must be specified in sky coordinates. 33 34 35 36 37 ROI 38 --- 39 One of the following is required to specify the center of the region of interest. 40 (Note these are the same as the arguments ppstamp uses to specify the ROI). 41 42 43 -skycenter ra dec 44 45 ra and dec are in sexagesimal notation or in decimal degrees 46 47 -pixcenter x y 48 49 -chip name may be required depending on the file class of the target 50 (ppstamp determines this) 51 52 53 One of the following is required to define the size of the ROI 54 55 -pixrange width height 56 57 width and height are in pixels 58 59 -arcrange dRA dDEC 60 61 dRA and dDEC in seconds of arc 62 63 64 Miscellaneous Arguments 65 ----------------------- 66 67 -project "project name" 68 69 -chip "chip name" 70 (required for -byid or -byexp when target file type is at chip level or below and the center 71 is specified in pixels) 72 73 74 -after date_time 75 -before date_time 76 May be used to narrow down the request for -bycoord queries 77 78 79 80 ************************************************************************************************* 81 Table Columns 82 83 Name Type Values Required Notes 84 ------------------------------------------------------------------------------------------------- 85 VERSION String N.N all file format version 86 PROJECT String any all 87 REQ_TYPE String byid | byexp | bycoord all 88 IMG_TYPE String raw | chip | warp | diff | stack byid and byexp 89 ID String any byid 90 CLASS_ID String any byid raw byexp raw 91 EXPOSURE String any byexp 92 FILTER String any only used when bycoord 93 94 RA String sexigesimal or decimal deg null if pixcenter 95 DEC String segigesimal or decimal deg null of pixcenter 96 CENTER_X S32 any null if not pixcenter 97 CENTER_Y S32 any null if not pixcenter 98 D_RA F32 > 0 0 if pixrange 99 D_DEC F32 > 0 0 if pixrange 100 WIDTH U32 > 0 0 if not pixrange 101 HEIGHT U32 > 0 0 if not pixrange 102 103 IMG_VERSION String 104 105 The following need some more thought. Perhaps I need TIME_LIMIT with values like "latest", "after", "before" 106 AFTER String YYYYMMDD-HH:MM:SS only used when bycoord UTC 107 BEFORE String YYYYMMDD-HH:MM:SS only used when bycoord UTC 108 OPTIONS String -latest 109 110 This may be useful for debugging at least. 111 FLAGS String -ls Don't make stamps 112 generate list of 113 matching images 114 115 */ 6 // pstamprequest - create a fits table containing a postage stamp server request 7 116 8 117 9 typedef struct { 118 #ifdef USE_DBNAME_FOR_PROJECT119 pmConfig *config;120 #endif121 10 psMetadata *md; 122 11 psString fileName; … … 220 109 bool gotCenter = false; 221 110 bool gotRange = false; 111 bool needROI = true; 112 bool makeStamps = true; 222 113 223 114 options->md = md; … … 225 116 psMetadataAdd (md, PS_LIST_TAIL, "VERSION", PS_DATA_STRING, "", STAMP_REQUEST_VERSION); 226 117 227 #ifdef USE_DBNAME_FOR_PROJECT 228 options->config = pmConfigRead(&argc, argv, NULL); 229 if (!options->config) { 230 psError(PS_ERR_UNKNOWN, false, "cannot find site file"); 231 psFree(options->md); 232 psFree(options); 233 return NULL; 234 } 235 236 bool status = false; 237 psString project = psMetadataLookupStr(&status, options->config->site, "DBNAME"); 238 if (!project) { 239 fprintf(stderr, "DBNAME not specified\n"); 240 } 241 psMetadataAdd(md, PS_LIST_TAIL, "PROJECT", PS_DATA_STRING, "", project); 242 #else 118 if ((argnum = psArgumentGet(argc, argv, "-list"))) { 119 psMetadataAdd (md, PS_LIST_TAIL, "CMD_MODE", PS_DATA_STRING, "", "LIST_URI"); 120 psArgumentRemove(argnum, &argc, argv); 121 // we don't need coordinates if we're listing unless mode is -bycoord. May be set true below. 122 needROI = false; 123 makeStamps = false; 124 } 125 243 126 // get project from command line 244 127 if ((argnum = psArgumentGet(argc, argv, "-project"))) { … … 254 137 usage(); 255 138 } 256 #endif257 139 258 140 // get user tag (base name for the postage stamp files … … 265 147 psMetadataAdd(md, PS_LIST_TAIL, "USER_TAG", PS_DATA_STRING, "", argv[argnum]); 266 148 psArgumentRemove(argnum, &argc, argv); 267 } else {149 } else if (makeStamps) { 268 150 psError(PS_ERR_BAD_PARAMETER_NULL, true, "no user_tag specified"); 269 151 usage(); … … 276 158 psArgumentRemove(argnum, &argc, argv); 277 159 needCoord = true; 160 needROI = true; 278 161 // TODO: we need an IMG_TYPE too... 279 162 } … … 306 189 } 307 190 308 // find roi re-using ppstamp's ROI argument parsing code which value checking309 // we just pass the strings along as provided by the user310 311 191 pstampROI roiParam; 312 192 193 // try and parse the ROI even if we don't "need it" to absorb arguments if they were provided 313 194 if (!pstampGetROI(&roiParam, &argc, argv, &gotCenter, &gotRange)) { 314 usage(); 315 } 316 317 if (roiParam.celestialCenter) { 318 psMetadataAdd (options->md, PS_LIST_TAIL, "RA", PS_DATA_STRING, "", roiParam.center[0]); 319 psMetadataAdd (options->md, PS_LIST_TAIL, "DEC", PS_DATA_STRING, "", roiParam.center[1]); 320 } else { 321 if (needCoord) { 322 fprintf(stderr, "need to specify ROI in sky coordinates\n"); 195 if (needROI) { 323 196 usage(); 324 197 } 325 psMetadataAdd (options->md, PS_LIST_TAIL, "CENTER_X", PS_DATA_STRING, "", roiParam.center[0]); 326 psMetadataAdd (options->md, PS_LIST_TAIL, "CENTER_Y", PS_DATA_STRING, "", roiParam.center[1]); 327 } 328 if (roiParam.celestialRange) { 329 psMetadataAdd (options->md, PS_LIST_TAIL, "D_RA", PS_DATA_STRING, "", roiParam.range[0]); 330 psMetadataAdd (options->md, PS_LIST_TAIL, "D_DEC", PS_DATA_STRING, "", roiParam.range[1]); 331 } else { 332 psMetadataAdd (options->md, PS_LIST_TAIL, "WIDTH", PS_DATA_STRING, "", roiParam.range[0]); 333 psMetadataAdd (options->md, PS_LIST_TAIL, "HEIGHT", PS_DATA_STRING, "", roiParam.range[1]); 334 } 335 336 if ((argnum = psArgumentGet(argc, argv, "-list"))) { 337 psMetadataAdd (options->md, PS_LIST_TAIL, "CMD_MODE", PS_DATA_STRING, "", "LIST_URI"); 338 psArgumentRemove(argnum, &argc, argv); 198 } 199 200 if (needROI) { 201 if (roiParam.celestialCenter) { 202 psMetadataAdd (md, PS_LIST_TAIL, "RA", PS_DATA_STRING, "", roiParam.center[0]); 203 psMetadataAdd (md, PS_LIST_TAIL, "DEC", PS_DATA_STRING, "", roiParam.center[1]); 204 } else { 205 if (needCoord) { 206 fprintf(stderr, "need to specify ROI in sky coordinates\n"); 207 usage(); 208 } 209 psMetadataAdd (md, PS_LIST_TAIL, "CENTER_X", PS_DATA_STRING, "", roiParam.center[0]); 210 psMetadataAdd (md, PS_LIST_TAIL, "CENTER_Y", PS_DATA_STRING, "", roiParam.center[1]); 211 } 212 if (roiParam.celestialRange) { 213 psMetadataAdd (md, PS_LIST_TAIL, "D_RA", PS_DATA_STRING, "", roiParam.range[0]); 214 psMetadataAdd (md, PS_LIST_TAIL, "D_DEC", PS_DATA_STRING, "", roiParam.range[1]); 215 } else { 216 psMetadataAdd (md, PS_LIST_TAIL, "WIDTH", PS_DATA_STRING, "", roiParam.range[0]); 217 psMetadataAdd (md, PS_LIST_TAIL, "HEIGHT", PS_DATA_STRING, "", roiParam.range[1]); 218 } 339 219 } 340 220
Note:
See TracChangeset
for help on using the changeset viewer.
