Example #1
0
def run_elo(request):
    diagnosticType=request.GET['plot_package']
    modelType=request.GET['plot_model']
    plot_set_name=request.GET['plot_set']
    seasonID=request.GET['seasonID']
    variableID=request.GET['variableID']
    obs=request.GET['plot_obs']
    if obs=='':
        filetable2=None
    else:
        filetable2=utils.get_filetable2(obs,diagnosticType)

    sclass,filetable1,filetable2,varid,seasonid=utils.get_input_parameter(diagnosticType,modelType,plot_set_name,seasonID,variableID,obs)
    outputPath=settings.DIAG_MEDIA
    taskID = str(time.time()) # TODO: this taskID should be a unique identifier.
    output_parent_path=settings.DIAG_MEDIA
    output_path=os.path.join(output_parent_path,taskID)
    if not os.path.exists(output_path):
        os.makedirs(output_path)
    p_object=plotdata_run(sclass,filetable1,filetable2,str(varid),seasonid, outputPath, taskID)
    pid = p_object.pid
    obj={'task_id':str(pid)}
    task_tracker=utils.TaskTracker()
    task_tracker.add_task(pid,p_object)
    json_res=simplejson.dumps(obj)
    
    return HttpResponse(json_res, content_type="application/json")
Example #2
0
File: views.py Project: imclab/uvis
def get_plot_variable(request):
    diagnosticType=request.GET['plot_package']
    dg_menu=diagnostics_menu()[diagnosticType]()
    filetable1 = utils.get_filetable1()
    filetable2 = utils.get_filetable2()
    diagnostics_set_name=request.GET['plot_set']
    variables=dg_menu.list_variables(filetable1,filetable2,diagnostics_set_name)
    obj={'variables_list':variables}
    json_res=simplejson.dumps(obj)
    return HttpResponse(json_res, content_type="application/json")
Example #3
0
File: views.py Project: imclab/uvis
def get_plot_aux_options(request):
    filetable1 = utils.get_filetable1()
    filetable2 = utils.get_filetable2()
    diagnosticType=request.GET['plot_package']
    diagnostics_set_name=request.GET['plot_set']
    dg_menu=diagnostics_menu()[diagnosticType]()
    varmenu=dg_menu.all_variables(filetable1,filetable2,diagnostics_set_name)
    varname=request.GET['plot_variable']
    if varname in varmenu.keys():
	variable=varmenu[varname](varname,diagnostics_set_name,dg_menu)
	auxList=variable.varoptions()
    else:
	auxList = None
    obj = {'aux_list':auxList}
    json_res = simplejson.dumps(obj)
    return HttpResponse(json_res, content_type="application/json")