Example #1
0
def create_jid(row_inp):
    while True:
        row_inp_temp_all = row_inp.get()
        if row_inp_temp_all is None:
            break
        else:
            row_inp_temp = row_inp_temp_all[0]
            iter = row_inp_temp_all[1]

            chem_name_temp = row_inp_temp[0]
            application_target_temp = row_inp_temp[1]
            application_rate_temp = float(row_inp_temp[2])
            number_of_applications_temp = float(row_inp_temp[3])
            interval_between_applications_temp = float(row_inp_temp[4])
            Koc_temp = float(row_inp_temp[5])
            aerobic_soil_metabolism_temp = float(row_inp_temp[6])
            wet_in_temp = row_inp_temp[7]
            application_method_temp = row_inp_temp[8]
            aerial_size_dist_temp = row_inp_temp[9]
            ground_spray_type_temp = row_inp_temp[10]
            airblast_type_temp = row_inp_temp[11]
            spray_quality_temp = row_inp_temp[12]
            no_spray_drift_temp = float(row_inp_temp[13])
            incorporation_depth_temp = float(row_inp_temp[14])
            solubility_temp = float(row_inp_temp[15])
            aerobic_aquatic_metabolism_temp = float(row_inp_temp[16])
            hydrolysis_temp = float(row_inp_temp[17])
            photolysis_aquatic_half_life_temp = float(row_inp_temp[18])

            geneec_obj = geneec_model.geneec('batch', chem_name_temp, application_target_temp, application_rate_temp, number_of_applications_temp, interval_between_applications_temp, Koc_temp, aerobic_soil_metabolism_temp, wet_in_temp, application_method_temp, application_method_label, aerial_size_dist_temp, ground_spray_type_temp, airblast_type_temp, spray_quality_temp, no_spray_drift_temp, incorporation_depth_temp, solubility_temp, aerobic_aquatic_metabolism_temp, hydrolysis_temp, photolysis_aquatic_half_life_temp)
            # logger.info(genee_obj)
            jid_all.append(geneec_obj.jid)
            geneec_obj_all.append(geneec_obj)
            if iter == 0:
                jid_batch.append(geneec_obj.jid)

            batch_header = """
                <div class="out_">
                    <br><H3>Batch Calculation of Iteration %s:</H3>
                </div>
                """%(iter + 1)
            out_html_temp = batch_header + geneec_tables.table_all(geneec_obj)
            out_html_all[iter]=out_html_temp
Example #2
0
    def post(self):
        form = cgi.FieldStorage()
        chem_name = form.getvalue("chemical_name")
        application_target = form.getvalue("application_target")
        application_rate = form.getvalue("application_rate")
        number_of_applications = form.getvalue("number_of_applications")
        interval_between_applications = form.getvalue("interval_between_applications")
        Koc = form.getvalue("Koc")
        aerobic_soil_metabolism = form.getvalue("aerobic_soil_metabolism")
        wet_in = form.getvalue("wet_in")
        application_method = form.getvalue("application_method")
        # A1
        aerial_size_dist = form.getvalue("aerial_size_dist")
        # B1
        ground_spray_type = form.getvalue("ground_spray_type")
        # C1
        airblast_type = form.getvalue("airblast_type")
        # B2
        spray_quality = form.getvalue("spray_quality")

        no_spray_drift = form.getvalue("no_spray_drift")
        incorporation_depth = form.getvalue("incorporation_depth")
        solubility = form.getvalue("solubility")
        aerobic_aquatic_metabolism = form.getvalue("aerobic_aquatic_metabolism")
        hydrolysis = form.getvalue("hydrolysis")
        photolysis_aquatic_half_life = form.getvalue("photolysis_aquatic_half_life")

        if application_method == "a" or application_method == "c":
            incorporation_depth = 0
        if application_method == "d":
            no_spray_drift = 0
        if aerobic_aquatic_metabolism > 0:
            hydrolysis_label = "NA"
        else:
            hydrolysis_label = hydrolysis

        ################label selection###################################
        if application_method == "a":
            application_method_label = "Aerial Spray"
            if aerial_size_dist == "a":
                aerial_size_dist_label = "Very Fine to Fine"
                ground_spray_type_label = "NA"
                spray_quality_label = "NA"
                airblast_type_label = "NA"
            elif aerial_size_dist == "b":
                aerial_size_dist_label = "Fine to Medium (EFED Default)"
                ground_spray_type_label = "NA"
                spray_quality_label = "NA"
                airblast_type_label = "NA"
            elif aerial_size_dist == "c":
                aerial_size_dist_label = "Medium to Coarse"
                ground_spray_type_label = "NA"
                spray_quality_label = "NA"
                airblast_type_label = "NA"
            else:
                aerial_size_dist_label = "Coarse to Very Coarse"
                ground_spray_type_label = "NA"
                spray_quality_label = "NA"
                airblast_type_label = "NA"

        elif application_method == "b":
            application_method_label = "Ground Spray"
            if ground_spray_type == "a":
                if spray_quality == "a":
                    aerial_size_dist_label = "NA"
                    ground_spray_type_label = 'Low Boom Ground Spray (20" or less)'
                    spray_quality_label = "Fine (EFED Default)"
                    airblast_type_label = "NA"
                else:
                    aerial_size_dist_label = "NA"
                    ground_spray_type_label = 'Low Boom Ground Spray (20" or less)'
                    spray_quality_label = "Medium-Coarse"
                    airblast_type_label = "NA"
            else:
                if spray_quality == "a":
                    aerial_size_dist_label = "NA"
                    ground_spray_type_label = 'High Boom Ground Spray (20-50"; EFED Default)'
                    spray_quality_label = "Fine (EFED Default)"
                    airblast_type_label = "NA"
                else:
                    aerial_size_dist_label = "NA"
                    ground_spray_type_label = 'High Boom Ground Spray (20-50"; EFED Default)'
                    spray_quality_label = "Medium-Coarse"
                    airblast_type_label = "NA"
        elif application_method == "c":
            application_method_label = "Airblast Spray (Orchard & Vineyard)"
            if airblast_type == "a":
                aerial_size_dist_label = "NA"
                ground_spray_type_label = "NA"
                spray_quality_label = "NA"
                airblast_type_label = "Orchards and Dormant Vineyards"
            else:
                aerial_size_dist_label = "NA"
                ground_spray_type_label = "NA"
                spray_quality_label = "NA"
                airblast_type_label = "Foliated Vineyards"
        else:
            application_method_label = "NA"
            aerial_size_dist_label = "NA"
            ground_spray_type_label = "NA"
            spray_quality_label = "NA"
            airblast_type_label = "NA"
        ##########################################################################################

        geneec_obj = geneec_model.geneec(
            "single",
            chem_name,
            application_target,
            application_rate,
            number_of_applications,
            interval_between_applications,
            Koc,
            aerobic_soil_metabolism,
            wet_in,
            application_method,
            application_method_label,
            aerial_size_dist,
            ground_spray_type,
            airblast_type,
            spray_quality,
            no_spray_drift,
            incorporation_depth,
            solubility,
            aerobic_aquatic_metabolism,
            hydrolysis,
            photolysis_aquatic_half_life,
        )
        templatepath = os.path.dirname(__file__) + "/../templates/"
        ChkCookie = self.request.cookies.get("ubercookie")
        html = uber_lib.SkinChk(ChkCookie, "GENEEC Output")
        html = html + template.render(
            templatepath + "02uberintroblock_wmodellinks.html", {"model": "geneec", "page": "output"}
        )
        html = html + template.render(templatepath + "03ubertext_links_left.html", {})
        html = html + template.render(
            templatepath + "04uberoutput_start.html", {"model": "geneec", "model_attributes": "GENEEC Output"}
        )
        html = html + geneec_tables.timestamp(geneec_obj)
        html = html + geneec_tables.table_all(geneec_obj)
        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, geneec_obj.__dict__, "geneec", "single")
        self.response.out.write(html)