IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16898


Ignore:
Timestamp:
Mar 8, 2008, 1:55:06 PM (18 years ago)
Author:
bills
Message:

If the we're building a "list" request don't require an ROI (unless style
is bycoord).
Don't require user_tag unless we're making stamps.
Added a program to dump request and response fits tables.
Removed long comment section which is contained in the design document now.

Location:
trunk/pstamp/src
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/src/Makefile.am

    r16593 r16898  
    1 bin_PROGRAMS = ppstamp pstamprequest pstampparse pstampfinish
     1bin_PROGRAMS = ppstamp pstamprequest pstampparse pstampfinish pstampdump
    22
    33noinst_HEADERS = \
     
    99pstampparse_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS)
    1010pstampfinish_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(IPPDB_CFLAGS)
     11pstampdump_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS)
    1112
    1213# $(PSASTRO_CFLAGS) $(PPSTATS_CFLAGS) $(ppstamp_CFLAGS)
     
    1617pstampparse_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS)
    1718pstampfinish_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(IPPDB_LIBS)
     19pstampdump_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS)
    1820
    1921ppstamp_SOURCES = \
     
    4143        pstampfinish.c
    4244
     45pstampdump_SOURCES = \
     46        pstampdump.c
     47
    4348
    4449clean-local:
  • trunk/pstamp/src/pstamprequest.c

    r16593 r16898  
    44#include "pstampROI.h"
    55
    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
    1168
    1179typedef struct {
    118 #ifdef USE_DBNAME_FOR_PROJECT
    119     pmConfig    *config;
    120 #endif
    12110    psMetadata  *md;
    12211    psString    fileName;
     
    220109    bool        gotCenter = false;
    221110    bool        gotRange = false;
     111    bool        needROI = true;
     112    bool        makeStamps = true;
    222113
    223114    options->md = md;
     
    225116    psMetadataAdd (md, PS_LIST_TAIL, "VERSION", PS_DATA_STRING, "", STAMP_REQUEST_VERSION);
    226117
    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
    243126    // get project from command line
    244127    if ((argnum = psArgumentGet(argc, argv, "-project"))) {
     
    254137        usage();
    255138    }
    256 #endif
    257139
    258140    // get user tag (base name for the postage stamp files
     
    265147        psMetadataAdd(md, PS_LIST_TAIL, "USER_TAG", PS_DATA_STRING, "", argv[argnum]);
    266148        psArgumentRemove(argnum, &argc, argv);
    267     } else {
     149    } else if (makeStamps) {
    268150        psError(PS_ERR_BAD_PARAMETER_NULL, true, "no user_tag specified");
    269151        usage();
     
    276158        psArgumentRemove(argnum, &argc, argv);
    277159        needCoord = true;
     160        needROI = true;
    278161        // TODO: we need an IMG_TYPE too...
    279162    }
     
    306189    }
    307190
    308     // find roi re-using ppstamp's ROI argument parsing code which value checking
    309     // we just pass the strings along as provided by the user
    310 
    311191    pstampROI roiParam;
    312192
     193    // try and parse the ROI even if we don't "need it" to absorb arguments if they were provided
    313194    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) {
    323196            usage();
    324197        }
    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        }
    339219    }
    340220
Note: See TracChangeset for help on using the changeset viewer.