IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 25, 2020, 5:26:50 PM (6 years ago)
Author:
mhuber
Message:

add PROJECT, COMPONENT_ID, TESS_ID and modifications to allow for gpc2 in dquery and add restrictions to prevent oddities

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pstamp/scripts/dqueryparse.pl

    r40747 r41440  
    7676
    7777# Project name is hardcoded to gpc1 for the moment.
     78# -- set gpc1 by default and read in PROJECT column to update for actual query
    7879$project = resolve_project($ipprc,"gpc1",$dbname,$dbserver);
    7980my $imagedb = $project->{dbname};
     
    189190        my $filter;
    190191        my $mjd;
     192        my $tess_id;
     193        my $component_id;
    191194        # Confirm that we only have one stage/filter/mjd
    192195        if ($fpa_id ne 'Not_Set') {   # We only need to check things that aren't the known odd case.
     
    195198                $temp_hash{FILTER}{$query{$fpa_id}{FILTER}[$i]} = 1;
    196199                $temp_hash{'MJD-OBS'}{$query{$fpa_id}{'MJD-OBS'}[$i]} = 1;
     200                $temp_hash{PROJECT}{$query{$fpa_id}{PROJECT}[$i]} = 1;
     201                $temp_hash{COMPONENT_ID}{$query{$fpa_id}{COMPONENT_ID}[$i]} = 1;
     202                $temp_hash{TESS_ID}{$query{$fpa_id}{TESS_ID}[$i]} = 1;
    197203            }
    198204            if (scalar(keys(%{ $temp_hash{STAGE} })) == 1) {
     
    214220                exit_with_failure(21,"Too many MJD-OBS specified");
    215221            }
     222            # add non-error cases/options as well
     223            if (scalar(keys(%{ $temp_hash{PROJECT} })) == 1) {
     224                if ( (keys(%{ $temp_hash{PROJECT} }))[0] ne 'Not_Set') {
     225                    $imagedb = (keys(%{ $temp_hash{PROJECT} }))[0];
     226                    $project = resolve_project($ipprc,$imagedb,$dbname,$dbserver);
     227                    $imagedb = $project->{dbname};
     228                    if (!$imagedb) {
     229                        my_die("failed to find imagedb for project: $project", $PS_EXIT_CONFIG_ERROR);
     230                    }
     231                }
     232            }
     233            if (scalar(keys(%{ $temp_hash{TESS_ID} })) == 1) {
     234                if ( (keys(%{ $temp_hash{TESS_ID} }))[0] ne 'Not_Set') {               
     235                    $tess_id = (keys(%{ $temp_hash{TESS_ID} }))[0];
     236                }
     237                else {
     238                    $tess_id = undef;
     239                }
     240            }
     241            if (scalar(keys(%{ $temp_hash{COMPONENT_ID} })) == 1) {
     242                if ( (keys(%{ $temp_hash{COMPONENT_ID} }))[0] ne 'Not_Set') {
     243                    $component_id = (keys(%{ $temp_hash{COMPONENT_ID} }))[0];
     244                }
     245                else {
     246                    $component_id = undef;
     247                }
     248            }
    216249        }
    217250
     
    255288
    256289        # Determine the query style for this fpa_id
     290        # fix remove g  for gpc2
    257291        if ($fpa_id =~ /o.*g.*o/) {
    258292            $query_style = 'byexp';
     
    287321            $req_filter = $filter . '%';
    288322        }
    289        
     323        # set defqults if not_set
     324#        if ($imagedb eq 'Not_Set') {
     325#            $imagedb = 'gpc1';
     326#        }
     327#        if ($component_id eq 'Not_Set') {
     328#            $component_id = undef;
     329#        }
     330#        if ($tess_id eq 'Not_Set') {
     331#            $tess_id = undef;
     332#        }
     333
    290334        # Call the PStamp code to find the images that contain the target on the given MJD in the specified filter.
    291335        my $pstamp_images_ref = locate_images($ipprc,$imagedb,
    292336                                          \@rowList,
    293337                                          $query_style,$stage,
    294                                           $fpa_id,undef,undef,
     338                                          $fpa_id,$tess_id,$component_id,
    295339                                          $option_mask,$need_magic,
    296340                                          $mjd_min,$mjd_max,$req_filter,undef,$verbose); 
    297341       
    298342        foreach my $this_image_ref (@{ $pstamp_images_ref }) {
    299 
    300343            # loop over the rows that this component matched
    301344            foreach my $valid_index (@{ $this_image_ref->{row_index} }) {
     
    308351                $query{$fpa_id}{NEED_MAGIC}[$valid_index] = $need_magic;
    309352                $query{$fpa_id}{BAD_COMPONENT}[$valid_index] = 0;
    310                
    311353                if (exists($this_image_ref->{astrom})) {
    312354                    $query{$fpa_id}{CATALOG}[$valid_index] = $this_image_ref->{astrom};
Note: See TracChangeset for help on using the changeset viewer.