Exemple #1
0
    def xxx_initialize_dat_dicts(self, obsid, submitter, asis='norm'):
        """
        set the initial org_dict/dat_dict
        input:  obsid       --- obsid
                submitter   --- submitter
                asis        --- asis status; default: norm
                org_dict    --- a dictionary for the original values
                dat_dict    --- a dictionary for the current values
        """
        tmp_dict = pdd.prep_data_dict(obsid)
        tmp_dict['obsid'] = obsid
        tmp_dict['submitter'] = submitter
        tmp_dict['asis'] = asis
        tmp_dict['planned_roll'] = ocf.find_planned_roll(obsid)

        for key in tmp_dict.keys():
            self.org_dict[key] = tmp_dict[key]
            self.dat_dict[key] = tmp_dict[key]
#
#--- fill up the list of non-modifiable parameters; each element has a form of [param name, value]
#
        self.nc_param = pdd.return_non_changerble_param_list(tmp_dict)

        self.nc_dict = {}
        for ent in self.nc_param:
            self.nc_dict[ent[0]] = str(ent[1])
            self.org_dict[ent[0]] = str(ent[1])
            self.dat_dict[ent[0]] = str(ent[1])

        org_dict = self.org_dict
Exemple #2
0
    def prep_data_dictionaries(self, obsidrev):
        """
        create three data dictionaries for a given obsidrev
        input:  obsidrev        --- obsid + rev #
        output: self.param_dict --- a dictionary of  category name <--> a list of parameters
                self.obs_dict   --- a dictionary of param <--> [original value, requested value]
                self.ocat_dict  --- a dictionary of param <--> current DB value
        """
        #
        #--- create paramater dictioary
        #
        self.param_dict = make_parameter_lists()
        #
        #---- crate original and request value dictionary
        #
        self.obs_dict = oda.read_updates_entries_to_dictionary(obsidrev)
        self.obs_dict['obsidrev'] = [obsidrev, obsidrev]
        #
        #--- adjust older order input format
        #
        org_ordr = self.obs_dict['time_ordr'][0]
        req_ordr = self.obs_dict['time_ordr'][1]
        if self.obs_dict['window_flag'][0] in non_list:
            org_ordr = 0
        if self.obs_dict['window_flag'][1] in non_list:
            req_ordr = 0
        self.obs_dict['time_ordr'] = [org_ordr, req_ordr]

        org_ordr = self.obs_dict['roll_ordr'][0]
        req_ordr = self.obs_dict['roll_ordr'][1]
        if self.obs_dict['roll_flag'][0] in non_list:
            org_ordr = 0
        if self.obs_dict['roll_flag'][1] in non_list:
            req_ordr = 0
        self.obs_dict['roll_ordr'] = [org_ordr, req_ordr]

        org_ordr = self.obs_dict['ordr'][0]
        req_ordr = self.obs_dict['ordr'][1]
        if self.obs_dict['spwindow_flag'][0] in non_list:
            org_ordr = 0
        if self.obs_dict['spwindow_flag'][1] in non_list:
            req_ordr = 0
        self.obs_dict['ordr'] = [org_ordr, req_ordr]
        #
        #--- get the current database values
        #
        atemp = re.split('\.', obsidrev)
        obsid = atemp[0]
        self.ocat_dict = pdd.prep_data_dict(obsid)
        #
        #--- modifying time_order start and stop time format
        #
        self.check_time_order_cases()
Exemple #3
0
def read_database_to_dictionary(obsid, rev, submitter):
    """
    read data from database and put in a dictionary form
    input:  obsid   --- obsid
            rev         --- revision #
            submitter   --- poc/submitter's name
    output: pdict       --- a data dictionary, each data is a list [orig val, new val]
    """
#
#--- read data from the database and put in a dictionary
#
    tmp_dict = pdd.prep_data_dict(obsid)
#
#--- change the format to appropriate for the sql
#
    pdict = {}
    for key in tmp_dict.keys():
        val = tmp_dict[key]
        pdict[key] = [val, val]
#
#--- extra parameters
#

    obsidrev = str(obsid) + '.' + str(rev)

    pdict['obsidrev']  = [obsidrev, obsidrev]
    pdict['rev']       = [rev, rev]
    pdict['asis']      = ['asis', 'asis']
    pdict['poc']       = [submitter, submitter]
    pdict['submitter'] = [submitter, submitter]

    today              = ocf.today_date()
    odate              = ocf.disp_date_to_odate(today)

    pdict['date']      = [today, today]
    pdict['odate']     = [odate, odate]

    return pdict