Example #1
0
    def post(self):
        form = cgi.FieldStorage() 
        #Get variables needed to construct terrplant object
        version_terrplant = form.getvalue('version_terrplant')
        I = form.getvalue('incorporation')
        A = form.getvalue('application_rate')
        D = form.getvalue('drift_fraction')
        R = form.getvalue('runoff_fraction')
        nms = form.getvalue('EC25_for_nonlisted_seedling_emergence_monocot')
        nds = form.getvalue('EC25_for_nonlisted_seedling_emergence_dicot')
        lms = form.getvalue('NOAEC_for_listed_seedling_emergence_monocot')
        lds = form.getvalue('NOAEC_for_listed_seedling_emergence_dicot')
        #fill out terrplant object with yet to be used data
        chemical_name = form.getvalue('chemical_name')
        # terr.chemical_name = chemical_name
        pc_code = form.getvalue('pc_code')
        # terr.pc_code = pc_code
        use = form.getvalue('use')
        # terr.use = use
        application_method = form.getvalue('application_method')
        # terr.application_method = application_method
        application_form = form.getvalue('application_form')
        # terr.application_form = application_form
        solubility = form.getvalue('solubility')
        # terr.sol = sol
        terr = terrplant_model.terrplant(True,True,version_terrplant,"single",A,I,R,D,nms,lms,nds,lds,chemical_name,pc_code,use,application_method,application_form,solubility)
        nmv = form.getvalue('EC25_for_nonlisted_vegetative_vigor_monocot')
        terr.nmv = nmv
        ndv = form.getvalue('EC25_for_nonlisted_vegetative_vigor_dicot')
        terr.ndv = ndv
        lmv = form.getvalue('NOAEC_for_listed_vegetative_vigor_monocot')
        terr.lmv = lmv
        ldv = form.getvalue('NOAEC_for_listed_vegetative_vigor_dicot')
        terr.ldv = ldv
        logger.info(terr.__dict__)

        text_file = open('terrplant/terrplant_description.txt','r')
        x = text_file.read()
        templatepath = os.path.dirname(__file__) + '/../templates/'
        ChkCookie = self.request.cookies.get("ubercookie")
        html = uber_lib.SkinChk(ChkCookie, "TerrPlant Output")
        html = html + template.render(templatepath + '02uberintroblock_wmodellinks.html', {'model':'terrplant','page':'output'})
        html = html + template.render (templatepath + '03ubertext_links_left.html', {})                                
        html = html + template.render(templatepath + '04uberoutput_start.html',{
                'model':'terrplant',
                'model_attributes':'TerrPlant Output'})
        html = html + terrplant_tables.timestamp(terr)
        html = html + terrplant_tables.table_all(terrplant_tables.pvheadings, terrplant_tables.pvuheadings,terrplant_tables.deheadings,
                                        terrplant_tables.plantec25noaecheadings,terrplant_tables.plantecdrysemisprayheadings, 
                                        terrplant_tables.sumheadings, terrplant_tables.tmpl, terr)
        html = html + template.render(templatepath + 'export.html', {})
        html = html + template.render(templatepath + '04uberoutput_end.html', {})
        html = html + template.render(templatepath + '06uberfooter.html', {'links': ''})
        rest_funcs.save_dic(html, terr.__dict__, "terrplant", "single")
        self.response.out.write(html)
    def post(self):
        form = cgi.FieldStorage() 
        #Get variables needed to construct terrplant object
        I = form.getvalue('incorporation')
        A = form.getvalue('application_rate')
        D = form.getvalue('drift_fraction')
        R = form.getvalue('runoff_fraction')
        nms = form.getvalue('EC25_for_nonlisted_seedling_emergence_monocot')
        nds = form.getvalue('EC25_for_nonlisted_seedling_emergence_dicot')
        lms = form.getvalue('NOAEC_for_listed_seedling_emergence_monocot')
        lds = form.getvalue('NOAEC_for_listed_seedling_emergence_dicot')
        terr = terrplant_model.terrplant(True,True,A,I,R,D,nms,lms,nds,lds)
        #fill out terrplant object with yet to be used data
        chemical_name = form.getvalue('chemical_name')
        terr.chemical_name = chemical_name
        pc_code = form.getvalue('pc_code')
        terr.pc_code = pc_code
        use = form.getvalue('use')
        terr.use = use
        application_method = form.getvalue('application_method')
        terr.application_method = application_method
        application_form = form.getvalue('application_form')
        terr.application_form = application_form
        solubility = form.getvalue('solubility')
        terr.solubility = solubility
        nmv = form.getvalue('EC25_for_nonlisted_vegetative_vigor_monocot')
        terr.nmv = nmv
        ndv = form.getvalue('EC25_for_nonlisted_vegetative_vigor_dicot')
        terr.ndv = ndv
        lmv = form.getvalue('NOAEC_for_listed_vegetative_vigor_monocot')
        terr.lmv = lmv
        ldv = form.getvalue('NOAEC_for_listed_vegetative_vigor_dicot')
        terr.ldv = ldv

        text_file = open('terrplant/terrplant_description.txt','r')
        x = text_file.read()
        templatepath = os.path.dirname(__file__) + '/../templates/'
        html = template.render(templatepath + '01uberheader.html', {'title':'Ubertool'})
        html = html + template.render(templatepath + '02uberintroblock_wmodellinks.html', {'model':'terrplant','page':'output'})
        html = html + template.render (templatepath + '03ubertext_links_left.html', {})                                
        html = html + template.render(templatepath + '04uberoutput_start.html',{'model':'terrplant', 'model_attributes':'TerrPlant Output'})   
        html = html + terrplant_tables.table_all(terrplant_tables.pvheadings, terrplant_tables.pvuheadings,terrplant_tables.deheadings,
                                        terrplant_tables.plantec25noaecheadings,terrplant_tables.plantecdrysemisprayheadings, 
                                        terrplant_tables.sumheadings, terrplant_tables.tmpl, terr)
        html = html + template.render(templatepath + 'export.html', {})
        html = html + template.render(templatepath + '04uberoutput_end.html', {})
        html = html + template.render(templatepath + '06uberfooter.html', {'links': ''})
        self.response.out.write(html)
def get_terrplant_data(numiter):
    params_matrix = get_params_matrix()
    A = params_matrix.get('A')[numiter]
    I =  params_matrix.get('I')[numiter]
    R =  params_matrix.get('R')[numiter]
    D =  params_matrix.get('D')[numiter]
    nms = params_matrix.get('nms')[numiter]
    lms =  params_matrix.get('lms')[numiter]
    nds =  params_matrix.get('nds')[numiter]
    lds =  params_matrix.get('D')[numiter]
    terr = terrplant_model.terrplant(True,False,A,I,R,D,nms,lms,nds,lds)
    terrplant_expected_results = {}
    terrplant_expected_results['rundry_out'] = params_matrix.get('rundry_out')[numiter]
    terrplant_expected_results['runsemi_out'] = params_matrix.get('runsemi_out')[numiter]
    terrplant_expected_results['spray_out'] = params_matrix.get('spray_out')[numiter]
    terrplant_expected_results['totaldry_out'] = params_matrix.get('totaldry_out')[numiter]
    terrplant_expected_results['totalsemi_out'] = params_matrix.get('totalsemi_out')[numiter]
    terrplant_expected_results['nmsRQdry_out'] = params_matrix.get('nmsRQdry_out')[numiter]
    terrplant_expected_results['LOCnmsdry_out'] = params_matrix.get('LOCnmsdry_out')[numiter]
    terrplant_expected_results['nmsRQsemi_out'] = params_matrix.get('nmsRQsemi_out')[numiter]
    terrplant_expected_results['LOCnmssemi_out'] = params_matrix.get('LOCnmssemi_out')[numiter]
    terrplant_expected_results['nmsRQspray_out'] = params_matrix.get('nmsRQspray_out')[numiter]
    terrplant_expected_results['LOCnmsspray_out'] = params_matrix.get('LOCnmsspray_out')[numiter]
    terrplant_expected_results['lmsRQdry_out'] = params_matrix.get('lmsRQdry_out')[numiter]
    terrplant_expected_results['LOClmsdry_out'] = params_matrix.get('LOClmsdry_out')[numiter]
    terrplant_expected_results['lmsRQsemi_out'] = params_matrix.get('lmsRQsemi_out')[numiter]
    terrplant_expected_results['LOClmssemi_out'] = params_matrix.get('LOClmssemi_out')[numiter]
    terrplant_expected_results['lmsRQspray_out'] = params_matrix.get('lmsRQspray_out')[numiter]
    terrplant_expected_results['LOClmsspray_out'] = params_matrix.get('LOClmsspray_out')[numiter]

    terrplant_expected_results['ndsRQdry_out'] = params_matrix.get('ndsRQdry_out')[numiter]
    terrplant_expected_results['LOCndsdry_out'] = params_matrix.get('LOCndsdry_out')[numiter]
    terrplant_expected_results['ndsRQsemi_out'] = params_matrix.get('ndsRQsemi_out')[numiter]
    terrplant_expected_results['LOCndssemi_out'] = params_matrix.get('LOCndssemi_out')[numiter]
    terrplant_expected_results['ndsRQspray_out'] = params_matrix.get('ndsRQspray_out')[numiter]
    terrplant_expected_results['LOCndsspray_out'] = params_matrix.get('LOCndsspray_out')[numiter]
    terrplant_expected_results['ldsRQdry_out'] = params_matrix.get('ldsRQdry_out')[numiter]
    terrplant_expected_results['LOCldsdry_out'] = params_matrix.get('LOCldsdry_out')[numiter]
    terrplant_expected_results['ldsRQsemi_out'] = params_matrix.get('ldsRQsemi_out')[numiter]
    terrplant_expected_results['LOCldssemi_out'] = params_matrix.get('LOCldssemi_out')[numiter]
    terrplant_expected_results['ldsRQspray_out'] = params_matrix.get('ldsRQspray_out')[numiter]
    terrplant_expected_results['LOCldsspray_out'] = params_matrix.get('LOCldsspray_out')[numiter]
    return (terr,terrplant_expected_results)
def html_table(row_inp_all):
    while True:
        row_inp_temp_all = row_inp_all.get()
        if row_inp_temp_all is None:
            break
        else:
            row_inp = row_inp_temp_all[0]
            iter = row_inp_temp_all[1]

            A_temp=float(row_inp[0])
            A.append(A_temp)
            I_temp=float(row_inp[1])
            I.append(I_temp)
            R_temp=float(row_inp[2])
            R.append(R_temp)
            D_temp=float(row_inp[3])
            D.append(D_temp)
            nms_temp=float(row_inp[4])
            nms.append(nms_temp)
            lms_temp=float(row_inp[5])        
            lms.append(lms_temp)
            nds_temp=float(row_inp[6])   
            nds.append(nds_temp)
            lds_temp=float(row_inp[7])
            lds.append(lds_temp)
            terr = terrplant_model.terrplant(True,True,"batch",A_temp,I_temp,R_temp,D_temp,nms_temp,lms_temp,nds_temp,lds_temp)
            logger.info("===============")
            rundry_temp=terr.rundry_results
            rundry_out.append(rundry_temp)
            runsemi_temp=terr.runsemi_results
            runsemi_out.append(runsemi_temp)
            spray_temp=terr.spray_results
            spray_out.append(spray_temp)
            totaldry_temp=terr.totaldry_results
            totaldry_out.append(totaldry_temp)
            totalsemi_temp=terr.totalsemi_results
            totalsemi_out.append(totalsemi_temp)
            nmsRQdry_temp=terr.nmsRQdry_results
            nmsRQdry_out.append(nmsRQdry_temp)
            LOCnmsdry_temp=terr.LOCnmsdry_results
            LOCnmsdry_out.append(LOCnmsdry_temp)
            nmsRQsemi_temp=terr.nmsRQsemi_results
            nmsRQsemi_out.append(nmsRQsemi_temp)
            LOCnmssemi_temp=terr.LOCnmssemi_results
            LOCnmssemi_out.append(LOCnmssemi_temp)
            nmsRQspray_temp=terr.nmsRQspray_results
            nmsRQspray_out.append(nmsRQspray_temp)
            LOCnmsspray_temp=terr.LOCnmsspray_results
            LOCnmsspray_out.append(LOCnmsspray_temp)
            lmsRQdry_temp=terr.lmsRQdry_results
            lmsRQdry_out.append(lmsRQdry_temp)
            LOClmsdry_temp=terr.LOClmsdry_results
            LOClmsdry_out.append(LOClmsdry_temp)
            lmsRQsemi_temp=terr.lmsRQsemi_results
            lmsRQsemi_out.append(lmsRQsemi_temp)
            LOClmssemi_temp=terr.LOClmssemi_results
            LOClmssemi_out.append(LOClmssemi_temp)
            lmsRQspray_temp=terr.lmsRQspray_results
            lmsRQspray_out.append(lmsRQspray_temp)
            LOClmsspray_temp=terr.LOClmsspray_results
            LOClmsspray_out.append(LOClmsspray_temp)
            ndsRQdry_temp=terr.ndsRQdry_results
            ndsRQdry_out.append(ndsRQdry_temp)
            LOCndsdry_temp=terr.LOCndsdry_results
            LOCndsdry_out.append(LOCndsdry_temp)
            ndsRQsemi_temp=terr.ndsRQsemi_results
            ndsRQsemi_out.append(ndsRQsemi_temp)
            LOCndssemi_temp=terr.LOCndssemi_results
            LOCndssemi_out.append(LOCndssemi_temp)
            ndsRQspray_temp=terr.ndsRQspray_results
            ndsRQspray_out.append(ndsRQspray_temp)
            LOCndsspray_temp=terr.LOCndsspray_results
            LOCndsspray_out.append(LOCndsspray_temp)
            ldsRQdry_temp=terr.ldsRQdry_results
            ldsRQdry_out.append(ldsRQdry_temp)
            LOCldsdry_temp=terr.LOCldsdry_results
            LOCldsdry_out.append(LOCldsdry_temp)
            ldsRQsemi_temp=terr.ldsRQsemi_results
            ldsRQsemi_out.append(ldsRQsemi_temp)
            LOCldssemi_temp=terr.LOCldssemi_results
            LOCldssemi_out.append(LOCldssemi_temp)
            ldsRQspray_temp=terr.ldsRQspray_results
            ldsRQspray_out.append(ldsRQspray_temp)
            LOCldsspray_temp=terr.LOCldsspray_results
            LOCldsspray_out.append(LOCldsspray_temp)

            jid_all.append(terr.jid)
            terr_all.append(terr)    
            if iter == 1:
                jid_batch.append(terr.jid)

            batch_header = """
                <div class="out_">
                    <br><H3>Batch Calculation of Iteration %s:</H3>
                </div>
                """%(iter)

            html_temp = terrplant_tables.table_all(terrplant_tables.pvheadings, terrplant_tables.pvuheadings,terrplant_tables.deheadings,
                                            terrplant_tables.plantec25noaecheadings,terrplant_tables.plantecdrysemisprayheadings, 
                                            terrplant_tables.sumheadings, terrplant_tables.tmpl, terr)

            out_html_temp = batch_header + html_temp
            out_html_all[iter]=out_html_temp
def html_table(row_inp,iter):
    A_temp=float(row_inp[0])
    A.append(A_temp)
    I_temp=float(row_inp[1])
    I.append(I_temp)
    R_temp=float(row_inp[2])
    R.append(R_temp)
    D_temp=float(row_inp[3])
    D.append(D_temp)
    nms_temp=float(row_inp[4])
    nms.append(nms_temp)
    lms_temp=float(row_inp[5])        
    lms.append(lms_temp)
    nds_temp=float(row_inp[6])   
    nds.append(nds_temp)
    lds_temp=float(row_inp[7])
    lds.append(lds_temp)
    terr = terrplant_model.terrplant(True,True,A_temp,I_temp,R_temp,D_temp,nms_temp,lms_temp,nds_temp,lds_temp)
    rundry_temp=terr.rundry_results
    rundry_out.append(rundry_temp)
    runsemi_temp=terr.runsemi_results
    runsemi_out.append(runsemi_temp)
    spray_temp=terr.spray_results
    spray_out.append(spray_temp)
    totaldry_temp=terr.totaldry_results
    totaldry_out.append(totaldry_temp)
    totalsemi_temp=terr.totalsemi_results
    totalsemi_out.append(totalsemi_temp)
    nmsRQdry_temp=terr.nmsRQdry_results
    nmsRQdry_out.append(nmsRQdry_temp)
    LOCnmsdry_temp=terr.LOCnmsdry_results
    LOCnmsdry_out.append(LOCnmsdry_temp)
    nmsRQsemi_temp=terr.nmsRQsemi_results
    nmsRQsemi_out.append(nmsRQsemi_temp)
    LOCnmssemi_temp=terr.LOCnmssemi_results
    LOCnmssemi_out.append(LOCnmssemi_temp)
    nmsRQspray_temp=terr.nmsRQspray_results
    nmsRQspray_out.append(nmsRQspray_temp)
    LOCnmsspray_temp=terr.LOCnmsspray_results
    LOCnmsspray_out.append(LOCnmsspray_temp)
    lmsRQdry_temp=terr.lmsRQdry_results
    lmsRQdry_out.append(lmsRQdry_temp)
    LOClmsdry_temp=terr.LOClmsdry_results
    LOClmsdry_out.append(LOClmsdry_temp)
    lmsRQsemi_temp=terr.lmsRQsemi_results
    lmsRQsemi_out.append(lmsRQsemi_temp)
    LOClmssemi_temp=terr.LOClmssemi_results
    LOClmssemi_out.append(LOClmssemi_temp)
    lmsRQspray_temp=terr.lmsRQspray_results
    lmsRQspray_out.append(lmsRQspray_temp)
    LOClmsspray_temp=terr.LOClmsspray_results
    LOClmsspray_out.append(LOClmsspray_temp)
    ndsRQdry_temp=terr.ndsRQdry_results
    ndsRQdry_out.append(ndsRQdry_temp)
    LOCndsdry_temp=terr.LOCndsdry_results
    LOCndsdry_out.append(LOCndsdry_temp)
    ndsRQsemi_temp=terr.ndsRQsemi_results
    ndsRQsemi_out.append(ndsRQsemi_temp)
    LOCndssemi_temp=terr.LOCndssemi_results
    LOCndssemi_out.append(LOCndssemi_temp)
    ndsRQspray_temp=terr.ndsRQspray_results
    ndsRQspray_out.append(ndsRQspray_temp)
    LOCndsspray_temp=terr.LOCndsspray_results
    LOCndsspray_out.append(LOCndsspray_temp)
    ldsRQdry_temp=terr.ldsRQdry_results
    ldsRQdry_out.append(ldsRQdry_temp)
    LOCldsdry_temp=terr.LOCldsdry_results
    LOCldsdry_out.append(LOCldsdry_temp)
    ldsRQsemi_temp=terr.ldsRQsemi_results
    ldsRQsemi_out.append(ldsRQsemi_temp)
    LOCldssemi_temp=terr.LOCldssemi_results
    LOCldssemi_out.append(LOCldssemi_temp)
    ldsRQspray_temp=terr.ldsRQspray_results
    ldsRQspray_out.append(ldsRQspray_temp)
    LOCldsspray_temp=terr.LOCldsspray_results
    LOCldsspray_out.append(LOCldsspray_temp)

    html = terrplant_tables.table_all(terrplant_tables.pvheadings, terrplant_tables.pvuheadings,terrplant_tables.deheadings,
                                        terrplant_tables.plantec25noaecheadings,terrplant_tables.plantecdrysemisprayheadings, 
                                        terrplant_tables.sumheadings, terrplant_tables.tmpl, terr)
    
    return html
Example #6
0
    def get(self):
        text_file1 = open('terrplant/terrplant_description.txt','r')
        x = text_file1.read()
        templatepath = os.path.dirname(__file__) + '/../templates/'
        ChkCookie = self.request.cookies.get("ubercookie")
        html = uber_lib.SkinChk(ChkCookie, "TerrPlant QA/QC")
        html = html + template.render(templatepath + '02uberintroblock_wmodellinks.html', {'model':'terrplant','page':'qaqc'})
        html = html + template.render (templatepath + '03ubertext_links_left.html', {})                
        html = html + template.render(templatepath + '04uberoutput_start.html', {
                'model':'terrplant',
                'model_attributes':'TerrPlant QAQC'})
        terr = terrplant_model.terrplant(True,True,version_terrplant,"qaqc",A[0],I[0],R[0],D[0],nms[0],lms[0],nds[0],lds[0],chemical_name[0],pc_code[0],use[0],application_method[0],application_form[0],solubility[0])
        terr.chemical_name_expected = chemical_name[0]
        terr.pc_code_expected = pc_code[0]
        terr.use_expected = use[0]
        terr.application_method_expected = application_method[0]
        terr.application_form_expected = application_form[0]
        terr.solubility_expected = solubility[0]

        # terr.rundry_results_expected = out_fun_rundry[0]
        # terr.runsemi_results_expected = out_fun_runsemi[0]
        # terr.spray_results_expected = out_fun_spray[0]
        # terr.totaldry_results_expected = out_fun_totaldry[0]
        # terr.totalsemi_results_expected = out_fun_totalsemi[0]

        terr.nms_expected = nms[0]
        terr.nds_expected = nds[0]
        terr.lms_expected = lms[0]
        terr.lds_expected = lds[0]
        terr.nmv_expected = nmv[0]
        terr.ndv_expected = ndv[0]
        terr.lmv_expected = lmv[0]
        terr.ldv_expected = ldv[0]
        terr.nmsRQdry_results_expected = nmsRQdry_results[0]
        terr.lmsRQdry_results_expected = lmsRQdry_results[0]
        terr.ndsRQdry_results_expected = ndsRQdry_results[0]
        terr.ldsRQdry_results_expected = ldsRQdry_results[0]
        terr.nmsRQsemi_results_expected = nmsRQsemi_results[0]
        terr.lmsRQsemi_results_expected = lmsRQsemi_results[0]
        terr.ndsRQsemi_results_expected = ndsRQsemi_results[0]
        terr.ldsRQsemi_results_expected = ldsRQsemi_results[0]
        terr.nmsRQspray_results_expected = nmsRQspray_results[0]
        terr.lmsRQspray_results_expected = lmsRQspray_results[0]
        terr.ndsRQspray_results_expected = ndsRQspray_results[0]
        terr.ldsRQspray_results_expected = ldsRQspray_results[0]

        # terr.nmsRQdry_results_expected = out_fun_nmsRQdry[0]
        # terr.nmsRQsemi_results_expected = out_fun_nmsRQsemi[0]
        # terr.nmsRQspray_results_expected = out_fun_nmsRQspray[0]
        # terr.lmsRQdry_results_expected = out_fun_lmsRQdry[0]
        # terr.lmsRQsemi_results_expected = out_fun_lmsRQsemi[0]
        # terr.lmsRQspray_results_expected = out_fun_lmsRQspray[0]
        # terr.ndsRQdry_results_expected = out_fun_ndsRQdry[0]
        # terr.ndsRQsemi_results_expected = out_fun_ndsRQsemi[0]
        # terr.ndsRQspray_results_expected = out_fun_ndsRQspray[0]
        # terr.ldsRQdry_results_expected = out_fun_ldsRQdry[0]
        # terr.ldsRQsemi_results_expected = out_fun_ldsRQsemi[0]
        # terr.ldsRQspray_results_expected = out_fun_ldsRQspray[0]

        html = html + terrplant_tables.timestamp(terr)
        html = html + terrplant_tables.table_all_qaqc(terrplant_tables.pvheadings, terrplant_tables.pvuheadings,terrplant_tables.deheadingsqaqc,
                                        terrplant_tables.plantec25noaecheadings,terrplant_tables.plantecdrysemisprayheadingsqaqc, 
                                        terrplant_tables.tmpl, terr)
        html = html + template.render(templatepath + 'export.html', {})
        html = html + template.render(templatepath + '04uberoutput_end.html', {'sub_title': ''})
        html = html + template.render(templatepath + '06uberfooter.html', {'links': ''})
        rest_funcs.save_dic(html, terr.__dict__, 'terrplant', 'qaqc')
        self.response.out.write(html)
 def setUp(self):
     #####Pre-defined inputs########
     self.terr = terrplant_model.terrplant(True,False,A_in,I_in,R_in,D_in,nms_in,lms_in,nds_in,lds_in)
     #####Pre-defined outputs########
     self.LOCldsspray_out_in=LOCldsspray_out_in