Exemplo n.º 1
0
    def recipe_paths(self, line):
        context = None
        if len(line) > 0:
            context = line
        try:
            self.ROOTDIR = self.ipython.ev("ROOTDIR")
        except NameError:
            ROOTDIR = self.ROOTDIR = os.getcwd()
            self.ipython.push({"ROOTDIR": self.ROOTDIR})

        print "ROOTDIR    = %s" % self.ROOTDIR
        print "CURRENTDIR = %s" % os.getcwd()

        tdirs_table = get_lookup_table("HydroBio/directories", context=context)
        if not tdirs_table:
            print "NO SUCH CONTEXT:", context
            return line
        tdirs = tdirs_table[0]
        #print "tdirs",tdirs
        #print ks.dict2pretty("the_dirs",tdirs)

        the_dirs = {}
        for key in tdirs:
            the_dirs[key] = tdirs[key] % os.environ
        self.ipython.push(the_dirs)
        print ks.dict2pretty("adding variables to namespace", the_dirs)
        return True
Exemplo n.º 2
0
def fstore_get(timestamp):
    """Open a url on fitsstore/qaforgui/ with the passed timestamp.
    timestamp is in epoch seconds, which is converted here to a 
    YMD string for the URL.  Return a list of dicts of qa metrics data.

    N.B. A timestamp that evaluates to False (0, None) will request everything 
    from fitsstore. This could be huge. Be careful passing no timestamp!

    parameters: <float>, time in epoch seconds
    return:     <list>,  list of dicts (json) of qametrics
    """
    # Get the fitsstore query url from calurl_dict
    qurlPath     = "Gemini/calurl_dict"
    fitsstore_qa = get_lookup_table(qurlPath, "calurl_dict")['QAQUERYURL']
    local_site   = server_time()["local_site"]

    if not timestamp:
        furl         = os.path.join(fitsstore_qa)
        store_handle = urllib2.urlopen(furl)
        qa_data      = json.loads(store_handle.read())   
    else:
        date_query    = stamp_to_opday(timestamp)
        furl          = os.path.join(fitsstore_qa, date_query)
        store_handle  = urllib2.urlopen(furl)
        qa_data       = json.loads(store_handle.read())
    return qa_data
Exemplo n.º 3
0
    def recipe_paths(self, line):
        context = None
        if len(line)>0:
            context = line
        try:
            self.ROOTDIR =  self.ipython.ev("ROOTDIR")
        except NameError:
            ROOTDIR = self.ROOTDIR = os.getcwd()
            self.ipython.push({"ROOTDIR":self.ROOTDIR})    
        
        print "ROOTDIR    = %s" % self.ROOTDIR
        print "CURRENTDIR = %s" % os.getcwd()

        
        tdirs_table = get_lookup_table("HydroBio/directories", context=context)
        if not tdirs_table:
            print "NO SUCH CONTEXT:", context
            return line
        tdirs = tdirs_table[0]
        #print "tdirs",tdirs
        #print ks.dict2pretty("the_dirs",tdirs)

        the_dirs = {}
        for key in tdirs:
            the_dirs[key] = tdirs[key] % os.environ
        self.ipython.push(the_dirs)
        print ks.dict2pretty("adding variables to namespace", the_dirs)
        return True
Exemplo n.º 4
0
    def get_config_paths(self):
        tdirs_table = get_lookup_table("HydroBio/directories")
        if not tdirs_table:
            print "NO SUCH CONTEXT:", context
            return line
        tdirs = tdirs_table[0]
        #print "tdirs",tdirs
        #print ks.dict2pretty("the_dirs",tdirs)

        the_dirs = {}
        for key in tdirs:
            the_dirs[key] = tdirs[key] % os.environ
        return the_dirs
Exemplo n.º 5
0
    def get_config_paths(self):
        tdirs_table = get_lookup_table("HydroBio/directories")
        if not tdirs_table:
            print "NO SUCH CONTEXT:", context
            return line
        tdirs = tdirs_table[0]
        #print "tdirs",tdirs
        #print ks.dict2pretty("the_dirs",tdirs)

        the_dirs = {}
        for key in tdirs:
            the_dirs[key] = tdirs[key] % os.environ
        return the_dirs
Exemplo n.º 6
0
#                                                                        07-2013
# ------------------------------------------------------------------------------
# $Id: prsproxyutil.py 4348 2013-08-09 18:47:54Z kanderson $
# ------------------------------------------------------------------------------
__version__      = '$Revision: 4348 $'[11:-2]
__version_date__ = '$Date: 2013-08-09 08:47:54 -1000 (Fri, 09 Aug 2013) $'[7:-2]
# ------------------------------------------------------------------------------
from os.path import join, basename
from xml.dom import minidom
from pprint  import pformat

from astrodata.Lookups import get_lookup_table
# ------------------------------------------------------------------------------
# bad place for this
try:
    CALURL_DICT   = get_lookup_table("Gemini/calurl_dict","calurl_dict")
    UPLOADPROCCAL = CALURL_DICT["UPLOADPROCCAL"]
    _CALMGR       = CALMGR      = CALURL_DICT["CALMGR"]
    _LOCALCALMGR  = LOCALCALMGR = CALURL_DICT["LOCALCALMGR"]
except:
    pass # do without
# ------------------------------------------------------------------------------
CALTYPEDICT = { "arc": "arc",
                "bias": "bias",
                "dark": "dark",
                "flat": "flat",
                "processed_arc":   "processed_arc",
                "processed_bias":   "processed_bias",
                "processed_dark":   "processed_dark",
                "processed_flat":   "processed_flat",
                "processed_fringe": "processed_fringe"}