Example #1
0
def multinetcdfresult(request):
    #print 'URLREQ: ',request.matched_route.name
    sessionid = request.matchdict[
        'session']  #request.session.get_csrf_token();#params.getone('csrf_token')
    #folder=picnicsession.sessionfolder(sessionid);
    #sessiontask=tasks[sessionid]
    #session=sessiontask['session']
    #scan session folder for images
    session = picnicsession.loadsession(sessionid)

    if 'starttime' in session:
        session['starttime'] = datetime.strptime(session['starttime'],
                                                 picnicsession.json_dateformat)
    if 'endtime' in session:
        session['endtime'] = datetime.strptime(session['endtime'],
                                               picnicsession.json_dateformat)

    return {
        'plainurls': sessionUrls(request, sessionid, ('.json', '.cdl')),
        'session': session,
        'datetime': datetime,
        'timedelta': timedelta,
        'printNumber': picnicsession.printNumber,
        'sessionActive': picnicsession.sessionActive(session)
    }
Example #2
0
def netcdfresult(request):
    #print 'URLREQ: ',request.matched_route.name
    sessionid = request.matchdict[
        'session']  #request.session.get_csrf_token();#params.getone('csrf_token')
    #folder=picnicsession.sessionfolder(sessionid);
    #sessiontask=tasks[sessionid]
    #session=sessiontask['session']
    #scan session folder for images
    session = picnicsession.loadsession(sessionid)

    if 'starttime' in session:
        session['starttime'] = datetime.strptime(session['starttime'],
                                                 picnicsession.json_dateformat)
    if 'endtime' in session:
        session['endtime'] = datetime.strptime(session['endtime'],
                                               picnicsession.json_dateformat)
    fullfilename = picnicsession.sessionfile(
        sessionid, session['filename'])  #safejoin(folder,session['filename'])
    try:
        from netCDF4 import Dataset
        nc = Dataset(fullfilename, 'r')
        inf = picnicsession.infoOfFile(fullfilename)
        e = None
    except Exception, err:
        nc = None
        inf = [None, None, 0, None]
        e = err
Example #3
0
def netcdfreimage(request):
    #print 'URLREQ: ',request.matched_route.name
    sessionid = request.matchdict[
        'session']  #request.session.get_csrf_token();#params.getone('csrf_token')
    #folder=picnicsession.sessionfolder(sessionid);
    session = picnicsession.loadsession(sessionid)
    return picnicsession.newSessionProcess("readnetcdf", request, session)
Example #4
0
def imageresult(request):
    #print 'URLREQ: ',request.matched_route.name
    sessionid=request.matchdict['session']#request.session.get_csrf_token();#params.getone('csrf_token')
    #folder=picnicsession.sessionfolder(sessionid);
    #sessiontask=tasks[sessionid]
    #session=sessiontask['session']
    #scan session folder for images
    session=picnicsession.loadsession(sessionid)

    if 'starttime' in session:
        session['starttime']=datetime.strptime(session['starttime'],picnicsession.json_dateformat)
    if 'endtime' in session:
        session['endtime']=datetime.strptime(session['endtime'],picnicsession.json_dateformat)
    #send to template
    return { 'imageurls':sessionUrls(request,sessionid,('.png','.jpg')) , 'plainurls':sessionUrls(request,sessionid,('.json','.cdl')), 'session':session, 'timedelta':timedelta } 
Example #5
0
def multinetcdfresult(request):
    #print 'URLREQ: ',request.matched_route.name
    sessionid=request.matchdict['session']#request.session.get_csrf_token();#params.getone('csrf_token')
    #folder=picnicsession.sessionfolder(sessionid);
    #sessiontask=tasks[sessionid]
    #session=sessiontask['session']
    #scan session folder for images
    session=picnicsession.loadsession(sessionid)

    if 'starttime' in session:
        session['starttime']=datetime.strptime(session['starttime'],picnicsession.json_dateformat)
    if 'endtime' in session:
        session['endtime']=datetime.strptime(session['endtime'],picnicsession.json_dateformat)

    return { 'plainurls':sessionUrls(request,sessionid,('.json','.cdl')), 'session':session,
        'datetime':datetime, 'timedelta':timedelta, 'printNumber':picnicsession.printNumber, 'sessionActive':picnicsession.sessionActive(session)}
Example #6
0
def reimagerequest(request):
    #print 'URLREQ: ',request.matched_route.name
    sessionid=request.matchdict['session']#request.session.get_csrf_token();#params.getone('csrf_token')
    #folder=picnicsession.sessionfolder(sessionid);
    session=picnicsession.loadsession(sessionid)
    if True:
        oldsessionid=sessionid
        pysession=request.session
        sessionid=pysession.new_csrf_token()
        session['sessionid']=sessionid
        session['finalpage']=request.route_path('imageresult',session=sessionid);
        for f in ('display_parameters.json','process_parameters.json'):
            j=picnicsession.loadjson(oldsessionid,f,failvalue=None)
            if j!=None:
                picnicsession.storejson(sessionid,j,f)
    return picnicsession.newSessionProcess("createimages",request,session)
Example #7
0
def main():
    import sys
    import os
    import picnicsession
    picnicsession.addDispatchers(getDispatchers())
    loc = sys.argv[1]
    sess = ''
    while len(sess) == 0:
        sess = os.path.basename(loc)
        loc = os.path.dirname(loc)
    sessions = loc
    print sess
    print sessions
    os.environ['SESSIONFOLDER'] = sessions
    os.putenv('SESSIONFOLDER', sessions)
    session = picnicsession.loadsession(sess)
    picnicsession.taskdispatch('createimages', None, session)
Example #8
0
def main():
    import sys
    import os
    import picnicsession
    picnicsession.addDispatchers(getDispatchers())
    loc=sys.argv[1]
    sess=''
    while len(sess)==0:
        sess=os.path.basename(loc)
        loc=os.path.dirname(loc)
    sessions=loc
    print sess
    print sessions
    os.environ['SESSIONFOLDER']=sessions
    os.putenv('SESSIONFOLDER',sessions)
    session=picnicsession.loadsession(sess)
    picnicsession.taskdispatch('createimages',None,session)
Example #9
0
def reimagerequest(request):
    #print 'URLREQ: ',request.matched_route.name
    sessionid = request.matchdict[
        'session']  #request.session.get_csrf_token();#params.getone('csrf_token')
    #folder=picnicsession.sessionfolder(sessionid);
    session = picnicsession.loadsession(sessionid)
    if True:
        oldsessionid = sessionid
        pysession = request.session
        sessionid = pysession.new_csrf_token()
        session['sessionid'] = sessionid
        session['finalpage'] = request.route_path('imageresult',
                                                  session=sessionid)
        for f in ('display_parameters.json', 'process_parameters.json'):
            j = picnicsession.loadjson(oldsessionid, f, failvalue=None)
            if j != None:
                picnicsession.storejson(sessionid, j, f)
    return picnicsession.newSessionProcess("createimages", request, session)
Example #10
0
def imageresult(request):
    #print 'URLREQ: ',request.matched_route.name
    sessionid = request.matchdict[
        'session']  #request.session.get_csrf_token();#params.getone('csrf_token')
    #folder=picnicsession.sessionfolder(sessionid);
    #sessiontask=tasks[sessionid]
    #session=sessiontask['session']
    #scan session folder for images
    session = picnicsession.loadsession(sessionid)

    if 'starttime' in session:
        session['starttime'] = datetime.strptime(session['starttime'],
                                                 picnicsession.json_dateformat)
    if 'endtime' in session:
        session['endtime'] = datetime.strptime(session['endtime'],
                                               picnicsession.json_dateformat)
    #send to template
    return {
        'imageurls': sessionUrls(request, sessionid, ('.png', '.jpg')),
        'plainurls': sessionUrls(request, sessionid, ('.json', '.cdl')),
        'session': session,
        'timedelta': timedelta
    }
Example #11
0
def netcdfresult(request):
    #print 'URLREQ: ',request.matched_route.name
    sessionid=request.matchdict['session']#request.session.get_csrf_token();#params.getone('csrf_token')
    #folder=picnicsession.sessionfolder(sessionid);
    #sessiontask=tasks[sessionid]
    #session=sessiontask['session']
    #scan session folder for images
    session=picnicsession.loadsession(sessionid)

    if 'starttime' in session:
        session['starttime']=datetime.strptime(session['starttime'],picnicsession.json_dateformat)
    if 'endtime' in session:
        session['endtime']=datetime.strptime(session['endtime'],picnicsession.json_dateformat)
    fullfilename=picnicsession.sessionfile(sessionid,session['filename'])#safejoin(folder,session['filename'])
    try:
        from netCDF4 import Dataset
        nc=Dataset(fullfilename,'r')
        inf=picnicsession.infoOfFile(fullfilename)
        e=None
    except Exception, err:
        nc=None
        inf=[None,None,0,None]
        e=err
Example #12
0
def netcdfreimage(request):
    #print 'URLREQ: ',request.matched_route.name
    sessionid=request.matchdict['session']#request.session.get_csrf_token();#params.getone('csrf_token')
    #folder=picnicsession.sessionfolder(sessionid);
    session=picnicsession.loadsession(sessionid)
    return picnicsession.newSessionProcess("readnetcdf",request,session)