コード例 #1
0
     def __init__(self, dictionary):
        self.ES_source = ''
        self.NSF = ''
        self.NSP = ''
        self.NSM = ''
        self.Crop = ''
        self.Pesticide = ''
        self.IUCN_Amphibians = ''
        self.IUCN_Birds = ''
        self.IUCN_Mammals = ''
        self.IUCN_Mammals_Marine = ''
        self.IUCN_Coral = ''
        self.IUCN_Reptiles = ''
        self.IUCN_Seagrasses = ''
        self.IUCN_SeaCucumbers = ''
        self.IUCN_Mangrove = ''
        self.IUCN_MarineFish = ''
        self.USFWS_p = ''
        self.USFWS_l = ''
        self.jid = rest_funcs.gen_jid()
        

        dictionary = OrderedDict(sorted(dictionary.items(), key=lambda t: t[0]))
        logger.info('===================')
        dictionary = OrderedDict(dictionary)
        for k, v in dictionary.items():
            setattr(self, k, v)
コード例 #2
0
    def set_variables(self,version_terrplant,run_type,A,I,R,D,nms,lms,nds,lds,chemical_name,pc_code,use,application_method,application_form,solubility):
        self.version_terrplant = version_terrplant
        self.run_type = run_type
        self.A = A
        self.I = I
        self.R = R
        self.D = D
        self.nms = nms
        self.lms = lms
        self.nds = nds
        self.lds = lds
        self.chemical_name = chemical_name
        self.pc_code = pc_code
        self.use = use
        self.application_method = application_method
        self.application_form = application_form
        self.solubility = solubility

        all_dic = {"version_terrplant":self.version_terrplant, "run_type":self.run_type, "A":self.A, "I":self.I, "R":self.R, "D":self.D,
                   "nms":self.nms, "lms":self.lms, "nds":self.nds, "lds":self.lds, "chemical_name":self.chemical_name,
                   "pc_code":self.pc_code, "use":self.use, "application_method":self.application_method, "application_form":self.application_form, "solubility":self.solubility}
        data = json.dumps(all_dic)

        self.jid = rest_funcs.gen_jid()
        url=os.environ['UBERTOOL_REST_SERVER'] + '/terrplant/' + self.jid 
        # response = urlfetch.fetch(url=url, payload=data, method=urlfetch.POST, headers=http_headers, deadline=60)   
        response = requests.post(url, data=data, headers=http_headers, timeout=60)  
        output_val = json.loads(response.content)['result']
        for key, value in output_val.items():
            setattr(self, key, value)
コード例 #3
0
    def set_variables(self, run_type, chemical_name, label_epa_reg_no, ar_lb, frac_pest_surface, dislodge_fol_res, bird_acute_oral_study, bird_study_add_comm,
              low_bird_acute_ld50, test_bird_bw, mineau_scaling_factor, mamm_acute_derm_study, mamm_study_add_comm, mam_acute_derm_ld50, mam_acute_oral_ld50, test_mam_bw):
        self.run_type = run_type
        self.chemical_name=chemical_name
        self.label_epa_reg_no=label_epa_reg_no
        self.ar_lb=ar_lb
        self.frac_pest_surface=frac_pest_surface
        self.dislodge_fol_res=dislodge_fol_res
        self.bird_acute_oral_study=bird_acute_oral_study
        self.bird_study_add_comm=bird_study_add_comm
        self.low_bird_acute_ld50=low_bird_acute_ld50
        self.test_bird_bw=test_bird_bw
        self.mineau_scaling_factor=mineau_scaling_factor
        self.mamm_acute_derm_study=mamm_acute_derm_study
        self.mamm_study_add_comm=mamm_study_add_comm
        #self.aviandermaltype=aviandermaltype
        self.mam_acute_derm_ld50=mam_acute_derm_ld50
        self.mam_acute_oral_ld50 = mam_acute_oral_ld50
        self.test_mam_bw=test_mam_bw

        all_dic = {"chemical_name":self.chemical_name, "label_epa_reg_no":self.label_epa_reg_no, 
                   "ar_lb":self.ar_lb, "frac_pest_surface":self.frac_pest_surface, "dislodge_fol_res":self.dislodge_fol_res, 
                   "bird_acute_oral_study":self.bird_acute_oral_study, "bird_study_add_comm":self.bird_study_add_comm, 
                   "low_bird_acute_ld50":self.low_bird_acute_ld50, "test_bird_bw":self.test_bird_bw, 
                   "mineau_scaling_factor":self.mineau_scaling_factor, "mamm_acute_derm_study":self.mamm_acute_derm_study, 
                   "mamm_study_add_comm":self.mamm_study_add_comm, "mam_acute_derm_ld50":self.mam_acute_derm_ld50, 
                   "mam_acute_oral_ld50":self.mam_acute_oral_ld50, "test_mam_bw":self.test_mam_bw}
        data = json.dumps(all_dic)

        self.jid = rest_funcs.gen_jid()
        url=url_part1 + '/dust/' + self.jid 
        response = requests.post(url, data=data, headers=http_headers, timeout=60)
        output_val = json.loads(response.content)['result']
        for key, value in output_val.items():
            setattr(self, key, value)
コード例 #4
0
ファイル: agdrift_model.py プロジェクト: funkswing/HausBrew
    def set_variables(self, run_type, drop_size, ecosystem_type, application_method, boom_height, orchard_type, application_rate, distance, aquatic_type, calculation_input, init_avg_dep_foa, avg_depo_gha, avg_depo_lbac, deposition_ngL, deposition_mgcm, nasae, y, x, express_y):
        self.run_type = run_type
        self.drop_size = drop_size
        self.ecosystem_type = ecosystem_type 
        self.application_method = application_method
        self.boom_height = boom_height
        self.orchard_type = orchard_type  
        self.application_rate = application_rate
        self.distance = distance
        self.aquatic_type = aquatic_type
        self.calculation_input = calculation_input
        self.init_avg_dep_foa = init_avg_dep_foa
        self.avg_depo_gha = avg_depo_gha
        self.avg_depo_lbac = avg_depo_lbac
        self.deposition_ngL = deposition_ngL
        self.deposition_mgcm = deposition_mgcm
        self.nasae = nasae
        self.y = y
        self.x = x
        self.express_y = express_y  

        all_dic = {"drop_size":drop_size, "ecosystem_type":ecosystem_type, "application_method":application_method, 
                   "boom_height":boom_height, "orchard_type":orchard_type, "application_rate":application_rate, 
                   "distance":distance, "aquatic_type":aquatic_type, "calculation_input":calculation_input, 
                   "init_avg_dep_foa":init_avg_dep_foa, "avg_depo_gha":avg_depo_gha, "avg_depo_lbac":avg_depo_lbac, 
                   "deposition_ngL":deposition_ngL, "deposition_mgcm":deposition_mgcm, "nasae":nasae, "y":y, "x":x, 
                   "express_y":express_y}
        data = json.dumps(all_dic)

        self.jid = rest_funcs.gen_jid()
        url=os.environ['UBERTOOL_REST_SERVER'] + '/agdrift/' + self.jid 
        response = requests.post(url=url, data=data, headers=http_headers, timeout=60)
        output_val = json.loads(response.content)['result']
        for key, value in output_val.items():
            setattr(self, key, value)
コード例 #5
0
    def __init__(self,
                 set_variables=True,
                 run_methods=True,
                 run_type='single',
                 chemical_name='',
                 label_epa_reg_no='',
                 ar_lb=1,
                 frac_pest_surface=1,
                 dislodge_fol_res=1,
                 bird_acute_oral_study="",
                 bird_study_add_comm="",
                 low_bird_acute_ld50=1,
                 test_bird_bw=1,
                 mineau_scaling_factor=1,
                 mamm_acute_derm_study='',
                 mamm_study_add_comm='',
                 mam_acute_derm_ld50=1,
                 mam_acute_oral_ld50=1,
                 test_mam_bw=1,
                 vars_dict=None):
        self.set_default_variables()
        self.jid = rest_funcs.gen_jid()

        if set_variables:
            if vars_dict != None:
                self.__dict__.update(vars_dict)
            else:
                self.set_variables(run_type, chemical_name, label_epa_reg_no,
                                   ar_lb, frac_pest_surface, dislodge_fol_res,
                                   bird_acute_oral_study, bird_study_add_comm,
                                   low_bird_acute_ld50, test_bird_bw,
                                   mineau_scaling_factor,
                                   mamm_acute_derm_study, mamm_study_add_comm,
                                   mam_acute_derm_ld50, mam_acute_oral_ld50,
                                   test_mam_bw)
コード例 #6
0
ファイル: sip_model.py プロジェクト: puruckertom/uberdjango
 def __init__(self, set_variables=True,run_methods=True,run_type = "single",chemical_name='', b_species='', m_species='', bw_quail=1, bw_duck=1, bwb_other=1, bw_rat=1, bwm_other=1, sol=1, ld50_a=1, ld50_m=1, aw_bird=1, mineau=1, aw_mamm=1, noaec_d=1, noaec_q=1, noaec_o=1, Species_of_the_bird_NOAEC_CHOICES=1, noael=1,vars_dict=None):
     self.set_default_variables()
     self.jid = rest_funcs.gen_jid()
     if set_variables:
         if vars_dict != None:
             self.__dict__.update(vars_dict)
         else:
             self.set_variables(run_type, chemical_name, b_species, m_species, bw_quail, bw_duck, bwb_other, bw_rat, bwm_other, sol, ld50_a, ld50_m, aw_bird, mineau, aw_mamm, noaec_d, noaec_q, noaec_o, Species_of_the_bird_NOAEC_CHOICES, noael)
コード例 #7
0
ファイル: agdrift_model.py プロジェクト: funkswing/HausBrew
 def __init__(self, set_variables=True, run_methods=True, run_type='single', drop_size = '', ecosystem_type = '', application_method = '', boom_height = '', orchard_type = '', application_rate=1, distance=1,  aquatic_type='', calculation_input='', init_avg_dep_foa = 1, avg_depo_lbac = 1, avg_depo_gha  = 1, deposition_ngL = 1, deposition_mgcm = 1, nasae = 1, y = 1, x = 1, express_y = 1, vars_dict=None):
     self.set_default_variables()
     self.jid = rest_funcs.gen_jid()
     
     if set_variables:
         if vars_dict != None:
             self.__dict__.update(vars_dict)
         else:
             self.set_variables(run_type, drop_size, ecosystem_type, application_method, boom_height, orchard_type, application_rate, distance, aquatic_type, calculation_input, init_avg_dep_foa, avg_depo_gha, avg_depo_lbac, deposition_ngL, deposition_mgcm, nasae, y, x, express_y)
コード例 #8
0
ファイル: sip_model.py プロジェクト: puruckertom/uberdjango
    def set_variables(self, run_type, chemical_name, b_species, m_species, bw_quail, bw_duck, bwb_other, bw_rat, bwm_other, sol, ld50_a, ld50_m, aw_bird, mineau, aw_mamm, noaec_d, noaec_q, noaec_o, Species_of_the_bird_NOAEC_CHOICES, noael):
        self.run_type = run_type
        self.chemical_name = chemical_name
        self.bw_quail = bw_quail
        self.bw_duck = bw_duck
        self.bwb_other = bwb_other
        self.bw_rat = bw_rat
        self.bwm_other = bwm_other
        self.b_species = b_species
        self.m_species = m_species
        if b_species =='178':
            self.bw_bird = self.bw_quail
        elif b_species =='1580':
            self.bw_bird = self.bw_duck
        else:
            self.bw_bird = self.bwb_other
        if m_species =='350':
            self.bw_mamm = self.bw_rat
        else:
            self.bw_mamm = self.bwm_other
        self.sol = sol
        self.ld50_a = ld50_a
        self.ld50_m = ld50_m
        self.aw_bird = aw_bird
        self.mineau = mineau
        self.aw_mamm = aw_mamm
        self.noaec_d = noaec_d
        self.noaec_q = noaec_q
        self.noaec_o = noaec_o
        if Species_of_the_bird_NOAEC_CHOICES == '1':
            self.noaec = self.noaec_q
        elif Species_of_the_bird_NOAEC_CHOICES == '2':
            self.noaec = self.noaec_d
        elif Species_of_the_bird_NOAEC_CHOICES == '3':
            self.noaec = self.noaec_o
        # else:
        #     try:
        #         self.noaec = noaec
        #     except ValueError:
        #         raise ValueError\
        #         ('self.noaec=%g is a non-physical value.' % self.aw_bird)
        self.noael = noael

        all_dic = {"chemical_name":self.chemical_name, "bw_bird":self.bw_bird, "bw_quail":self.bw_quail, "bw_duck":self.bw_duck, "bwb_other":self.bwb_other, "bw_rat":self.bw_rat,
                   "bwm_other":self.bwm_other, "b_species":self.b_species, "m_species":self.m_species, "bw_mamm":self.bw_mamm, "sol":self.sol,
                   "ld50_a":self.ld50_a, "ld50_m":self.ld50_m, "aw_bird":self.aw_bird, "mineau":self.mineau, "aw_mamm":self.aw_mamm, "noaec":self.noaec, "noael":self.noael}
        data = json.dumps(all_dic)

        self.jid = rest_funcs.gen_jid()
        url=os.environ['UBERTOOL_REST_SERVER'] + '/sip/' + self.jid 
        # response = urlfetch.fetch(url=url, payload=data, method=urlfetch.POST, headers=http_headers, deadline=60)
        response = requests.post(url, data=data, headers=http_headers, timeout=60)  
        output_val = json.loads(response.content)['result']

        for key, value in output_val.items():
            setattr(self, key, value)
コード例 #9
0
    def __init__(self, set_variables=True, run_methods=True, version_terrplant='1.2.2', run_type = "single", A=1, I=1, R=1, D=1, nms=1, lms=1, nds=1, lds=1,
            chemical_name='', pc_code='', use='', application_method='', application_form='', solubility=1, vars_dict=None,):
        self.set_default_variables()
        self.jid = rest_funcs.gen_jid()

        if set_variables:
            if vars_dict != None:
                self.__dict__.update(vars_dict)
            else:
                self.set_variables(version_terrplant,run_type,A,I,R,D,nms,lms,nds,lds,chemical_name,pc_code,use,application_method,application_form,solubility)
コード例 #10
0
    def __init__(self, set_variables=True, run_methods=True, run_type='single', chemical_name='', label_epa_reg_no='', ar_lb=1, frac_pest_surface=1, dislodge_fol_res=1,  bird_acute_oral_study="", bird_study_add_comm="",
              low_bird_acute_ld50=1, test_bird_bw=1, mineau_scaling_factor=1, mamm_acute_derm_study='', mamm_study_add_comm='',  mam_acute_derm_ld50=1, mam_acute_oral_ld50=1, test_mam_bw=1, vars_dict=None):
        self.set_default_variables()
        self.jid = rest_funcs.gen_jid()

        if set_variables:
            if vars_dict != None:
                self.__dict__.update(vars_dict)
            else:
                self.set_variables(run_type, chemical_name, label_epa_reg_no, ar_lb, frac_pest_surface, dislodge_fol_res,  bird_acute_oral_study, bird_study_add_comm,
              low_bird_acute_ld50, test_bird_bw, mineau_scaling_factor, mamm_acute_derm_study, mamm_study_add_comm,  mam_acute_derm_ld50, mam_acute_oral_ld50, test_mam_bw)
コード例 #11
0
def get_jid(chem_name, noa, scenarios, unit, met_o, inp_o, run_o, exam_o, 
            MM, DD, YY, CAM_f, DEPI_text, Ar_text, EFF, Drft, 
            Apt_p, DayRe, Ap_mp, Ar, CAM_f_p, EFF_p, Drft_p, DEPI_f,
            farm, mw, sol, koc, vp, aem, anm, aqp, tmper, n_ph, ph_out, hl_out):
    all_dic = {"chem_name" : chem_name,
               "noa" : noa,
               "scenarios" : scenarios,
               "unit" : unit,
               "met" : met_o,
               "inp" : inp_o,
               "run" : run_o,
               "exam" : exam_o,
               "MM" : MM,
               "DD" : DD,
               "YY" : YY,
               "CAM_f" : CAM_f,
               "DEPI" : DEPI_text,
               "Ar" : Ar_text,
               "EFF" : EFF,
               "Drft" : Drft,
               "farm" : farm,
               "mw" : mw,
               "sol" : sol,
               "koc" : koc,
               "vp" : vp,
               "aem" : aem,
               "anm" : anm,
               "aqp" : aqp,
               "tmper" : tmper,
               "n_ph" : n_ph,
               "ph_out" : ph_out,
               "hl_out" : hl_out}

    data=json.dumps(all_dic)
    jid=rest_funcs.gen_jid()
    logging.info(jid)
    url=url_part1 + '/przm_exams/' + jid
    # response = urlfetch.fetch(url=url, payload=data, method=urlfetch.POST, headers=http_headers, deadline=60)
    response = requests.post(url=url, data=data, headers=http_headers, timeout=60)
    output_val = json.loads(response.content)['result']
    return(jid, output_val)
コード例 #12
0
def get_jid(noa, met, inp, run, MM, DD, YY, CAM_f, DEPI_text, Ar_text, EFF, Drft):
    all_dic = {"noa": noa,
               "met": met,
               "inp": inp,
               "run": run,
               "MM": MM,
               "DD": DD,
               "YY": YY,
               "CAM_f": CAM_f,
               "DEPI_text": DEPI_text,
               "Ar_text": Ar_text,
               "EFF": EFF,
               "Drft": Drft}
    data = json.dumps(all_dic)
    logger.info(data)
    jid = rest_funcs.gen_jid()
    url=url_part1 + '/przm/' + jid 

    response = requests.post(url=url, data=data, headers=http_headers, timeout=60)
    output_val = json.loads(response.content)['result']
    return(jid, output_val)
コード例 #13
0
ファイル: trex2_model.py プロジェクト: funkswing/HausBrew
    def __init__(self, run_type, chem_name, use, formu_name, a_i, Application_type, seed_treatment_formulation_name, seed_crop, seed_crop_v, r_s, b_w, p_i, den, h_l, n_a, ar_lb, day_out,
              ld50_bird, lc50_bird, NOAEC_bird, NOAEL_bird, aw_bird_sm, aw_bird_md, aw_bird_lg, 
              Species_of_the_tested_bird_avian_ld50, Species_of_the_tested_bird_avian_lc50, Species_of_the_tested_bird_avian_NOAEC, Species_of_the_tested_bird_avian_NOAEL, 
              tw_bird_ld50, tw_bird_lc50, tw_bird_NOAEC, tw_bird_NOAEL, x, ld50_mamm, lc50_mamm, NOAEC_mamm, NOAEL_mamm, aw_mamm_sm, aw_mamm_md, aw_mamm_lg, tw_mamm,
              m_s_r_p):
        self.jid = rest_funcs.gen_jid()
        self.run_type=run_type
        self.chem_name=chem_name
        self.use=use
        self.formu_name=formu_name
        self.a_i=a_i
        self.a_i_t1=100*float(a_i)
        self.Application_type=Application_type
        self.seed_treatment_formulation_name=seed_treatment_formulation_name
        self.seed_crop=seed_crop
        self.seed_crop_v=seed_crop_v
        self.r_s=r_s
        self.b_w=b_w
        self.b_w_t1=12*float(b_w)
        self.p_i=p_i
        try:
            self.p_i_t1=100*float(p_i)
        except:
            self.p_i_t1='N/A'
        self.den=den
        self.h_l=h_l
        self.n_a=n_a
        self.ar_lb=ar_lb
        self.day_out=day_out
        self.ld50_bird=ld50_bird
        self.lc50_bird=lc50_bird
        self.NOAEC_bird=NOAEC_bird
        self.NOAEL_bird=NOAEL_bird
        self.aw_bird_sm=aw_bird_sm
        self.aw_bird_md=aw_bird_md
        self.aw_bird_lg=aw_bird_lg

        self.Species_of_the_tested_bird_avian_ld50=Species_of_the_tested_bird_avian_ld50
        self.Species_of_the_tested_bird_avian_lc50=Species_of_the_tested_bird_avian_lc50
        self.Species_of_the_tested_bird_avian_NOAEC=Species_of_the_tested_bird_avian_NOAEC
        self.Species_of_the_tested_bird_avian_NOAEL=Species_of_the_tested_bird_avian_NOAEL

        self.tw_bird_ld50=tw_bird_ld50
        self.tw_bird_lc50=tw_bird_lc50
        self.tw_bird_NOAEC=tw_bird_NOAEC
        self.tw_bird_NOAEL=tw_bird_NOAEL
        self.x=x
        self.ld50_mamm=ld50_mamm
        self.lc50_mamm=lc50_mamm
        self.NOAEC_mamm=NOAEC_mamm
        self.NOAEL_mamm=NOAEL_mamm
        self.aw_mamm_sm=aw_mamm_sm
        self.aw_mamm_md=aw_mamm_md
        self.aw_mamm_lg=aw_mamm_lg
        self.tw_mamm=tw_mamm
        self.m_s_r_p=m_s_r_p

        all_dic = {"chem_name":self.chem_name, "use":self.use, "formu_name":self.formu_name, "a_i":self.a_i, 
                   "Application_type":self.Application_type, "seed_treatment_formulation_name":self.seed_treatment_formulation_name, 
                   "seed_crop":self.seed_crop, "seed_crop_v":self.seed_crop_v, "r_s":self.r_s, "b_w":self.b_w, "p_i":self.p_i, 
                   "den":self.den, "h_l":self.h_l, "n_a":self.n_a, "ar_lb":self.ar_lb, "day_out":self.day_out, "ld50_bird":self.ld50_bird, 
                   "lc50_bird":self.lc50_bird, "NOAEC_bird":self.NOAEC_bird, "NOAEL_bird":self.NOAEL_bird, "aw_bird_sm":self.aw_bird_sm, 
                   "aw_bird_md":self.aw_bird_md, "aw_bird_lg":self.aw_bird_lg, "Species_of_the_tested_bird_avian_ld50":self.Species_of_the_tested_bird_avian_ld50, 
                   "Species_of_the_tested_bird_avian_lc50":self.Species_of_the_tested_bird_avian_lc50, "Species_of_the_tested_bird_avian_NOAEC":self.Species_of_the_tested_bird_avian_NOAEC, 
                   "Species_of_the_tested_bird_avian_NOAEL":self.Species_of_the_tested_bird_avian_NOAEL, "tw_bird_ld50":self.tw_bird_ld50, "tw_bird_lc50":self.tw_bird_lc50, 
                   "tw_bird_NOAEC":self.tw_bird_NOAEC, "tw_bird_NOAEL":self.tw_bird_NOAEL, "x":self.x, "ld50_mamm":self.ld50_mamm, "lc50_mamm":self.lc50_mamm, "NOAEC_mamm":self.NOAEC_mamm, 
                   "NOAEL_mamm":self.NOAEL_mamm, "aw_mamm_sm":self.aw_mamm_sm, "aw_mamm_md":self.aw_mamm_md, "aw_mamm_lg":self.aw_mamm_lg, "tw_mamm":self.tw_mamm, "m_s_r_p":self.m_s_r_p}
        data = json.dumps(all_dic)

        self.jid = rest_funcs.gen_jid()
        url=os.environ['UBERTOOL_REST_SERVER'] + '/trex2/' + self.jid 
        response = requests.post(url, data=data, headers=http_headers, timeout=60)
        output_val = json.loads(response.content, cls=rest_funcs.NumPyDecoder)['result']
        output_val_uni=json.loads(output_val, cls=rest_funcs.NumPyDecoder)
        for key, value in output_val_uni.items():
            setattr(self, key, value)
コード例 #14
0
ファイル: geneec_model.py プロジェクト: funkswing/HausBrew
    def __init__(self, run_type, 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):
        self.run_type = run_type
        self.chem_name = chem_name
        self.application_target = application_target
        self.application_rate = application_rate
        self.number_of_applications = number_of_applications
        self.interval_between_applications = interval_between_applications
        self.Koc = Koc
        self.aerobic_soil_metabolism = aerobic_soil_metabolism
        self.wet_in = wet_in
        self.application_method = application_method
        if application_method == 'a':
            self.application_method_label = 'Aerial Spray'
        if application_method == 'b':
            self.application_method_label = 'Ground Spray'
        if application_method == 'c':
            self.application_method_label = 'Airblast Spray (Orchard & Vineyard)'
        if application_method == 'd':
            self.application_method_label = 'Granular (Non-spray)'

        if self.application_target == 'a' or 'Short grass':
            self.application_target_label = 'Short grass'
        if self.application_target == 'b' or 'Tall grass':
            self.application_target_label = 'Tall grass'
        if self.application_target == 'c' or 'Broad-leafed plants/small insects':
            self.application_target_label = 'Broad-leafed plants/small insects'
        if self.application_target == 'd' or 'Fruits/pods/seeds/large insects':
            self.application_target_label = 'Fruits/pods/seeds/large insects'

        self.aerial_size_dist = aerial_size_dist
        self.ground_spray_type = ground_spray_type
        self.airblast_type = airblast_type
        self.spray_quality = spray_quality
        self.no_spray_drift = no_spray_drift
        self.incorporation_depth = incorporation_depth
        self.solubility = solubility
        self.aerobic_aquatic_metabolism = aerobic_aquatic_metabolism
        self.hydrolysis = hydrolysis
        self.photolysis_aquatic_half_life = photolysis_aquatic_half_life

       
        http_headers = {'Authorization' : 'Basic', 'Content-Type' : 'application/json'}
        ########call the function################# 

        APPRAT = self.application_rate
        APPNUM = self.number_of_applications
        APSPAC = self.interval_between_applications
        KOC = self.Koc
        METHAF = self.aerobic_soil_metabolism
        WETTED = self.wet_in
        METHOD = self.application_method
        AIRFLG = self.aerial_size_dist
        YLOCEN = self.no_spray_drift
        GRNFLG = self.ground_spray_type
        GRSIZE = self.spray_quality
        ORCFLG = self.airblast_type
        INCORP = self.incorporation_depth
        SOL = self.solubility
        METHAP = self.aerobic_aquatic_metabolism
        HYDHAP = self.hydrolysis
        FOTHAP = self.photolysis_aquatic_half_life


        all_dic = {"APPRAT":APPRAT, "APPNUM":APPNUM, "APSPAC":APSPAC, "KOC":KOC, "METHAF":METHAF, "WETTED":WETTED,
                   "METHOD":METHOD, "AIRFLG":AIRFLG, "YLOCEN":YLOCEN, "GRNFLG":GRNFLG, "GRSIZE":GRSIZE,
                   "ORCFLG":ORCFLG, "INCORP":INCORP, "SOL":SOL, "METHAP":METHAP, "HYDHAP":HYDHAP, "FOTHAP":FOTHAP}
        data = json.dumps(all_dic)


        self.jid = rest_funcs.gen_jid()
        url=os.environ['UBERTOOL_REST_SERVER'] + '/geneec/' + self.jid 


        if run_type == "single" or "qaqc":
            # response = urlfetch.fetch(url=url, payload=data, method=urlfetch.POST, headers=http_headers, deadline=60)   
            response = requests.post(url=url, data=data, headers=http_headers, timeout=60)

            self.output_val = json.loads(response.content)['result']


        if run_type == "batch":
            response = ""
            while response =="":
                # response = urlfetch.fetch(url=url, payload=data, method=urlfetch.POST, headers=http_headers, deadline=60)   
                response = requests.post(url=url, data=data, headers=http_headers, timeout=60)
            self.output_val = json.loads(response.content)['result']
コード例 #15
0
def get_jid(run_type, pfac, snowmelt, evapDepth, 
            uslek, uslels, uslep, fieldSize, ireg, slope, hydlength,
            canopyHoldup, rootDepth, canopyCover, canopyHeight,
            NumberOfFactors, useYears,
            USLE_day, USLE_mon, USLE_year, USLE_c, USLE_n, USLE_cn,
            firstyear, lastyear,
            dayEmerge_text, monthEmerge_text, dayMature_text, monthMature_text, dayHarvest_text, monthHarvest_text, addYearM, addYearH,
            irflag, tempflag,
            fleach, depletion, rateIrrig,
            albedo, bcTemp, Q10Box, soilTempBox1,
            numHoriz,
            SoilProperty_thick, SoilProperty_compartment, SoilProperty_bulkden, SoilProperty_maxcap, SoilProperty_mincap, SoilProperty_oc, SoilProperty_sand, SoilProperty_clay,
            rDepthBox, rDeclineBox, rBypassBox,
            eDepthBox, eDeclineBox,
            appNumber_year, totalApp,
            SpecifyYears, ApplicationTypes, PestAppyDay, PestAppyMon, Rela_a, app_date_type, DepthIncorp, PestAppyRate, localEff, localSpray,
            PestDispHarvest,
            nchem, convert_Foliar1, parentTo3, deg1To2, foliarHalfLifeBox,
            koc_check, Koc,
            soilHalfLifeBox,
            convertSoil1, convert1to3, convert2to3):


    all_dic = {"pfac": pfac, 
               "snowmelt": snowmelt, 
               "evapDepth": evapDepth,
               "uslek": uslek,
               "uslels": uslels,
               "uslep": uslep,
               "fieldSize": fieldSize,
               "ireg": ireg,
               "slope": slope,
               "hydlength": hydlength,
               "canopyHoldup": canopyHoldup,
               "rootDepth": rootDepth,
               "canopyCover": canopyCover,
               "canopyHeight": canopyHeight,
               "NumberOfFactors": NumberOfFactors,
               "useYears": useYears,
               "USLE_day": USLE_day,
               "USLE_mon": USLE_mon,
               "USLE_year": USLE_year,
               "USLE_c": USLE_c,
               "USLE_n": USLE_n,
               "USLE_cn": USLE_cn,
               "firstyear": firstyear,
               "lastyear": lastyear,
               "dayEmerge_text": dayEmerge_text,
               "monthEmerge_text": monthEmerge_text,
               "dayMature_text": dayMature_text,
               "monthMature_text": monthMature_text,
               "dayHarvest_text": dayHarvest_text,
               "monthHarvest_text": monthHarvest_text,
               "addYearM": addYearM,
               "addYearH": addYearH,
               "irflag": irflag,
               "tempflag": tempflag,
               "fleach": fleach,
               "depletion": depletion,
               "rateIrrig": rateIrrig,
               "albedo": albedo,
               "bcTemp": bcTemp,
               "Q10Box": Q10Box,
               "soilTempBox1": soilTempBox1,
               "numHoriz": numHoriz,
               "SoilProperty_thick": SoilProperty_thick,
               "SoilProperty_compartment": SoilProperty_compartment,
               "SoilProperty_bulkden": SoilProperty_bulkden,
               "SoilProperty_maxcap": SoilProperty_maxcap,
               "SoilProperty_mincap": SoilProperty_mincap,
               "SoilProperty_oc": SoilProperty_oc,
               "SoilProperty_sand": SoilProperty_sand,
               "SoilProperty_clay": SoilProperty_clay,
               "rDepthBox": rDepthBox,
               "rDeclineBox": rDeclineBox,
               "rBypassBox": rBypassBox,
               "eDepthBox": eDepthBox,
               "eDeclineBox": eDeclineBox,
               "appNumber_year": appNumber_year,
               "totalApp": totalApp,
               "SpecifyYears": SpecifyYears,
               "ApplicationTypes": ApplicationTypes,
               "PestAppyDay": PestAppyDay,
               "PestAppyMon": PestAppyMon,
               "Rela_a": Rela_a,
               "app_date_type": app_date_type,
               "DepthIncorp": DepthIncorp,
               "PestAppyRate": PestAppyRate,
               "localEff": localEff,
               "localSpray": localSpray,
               "PestDispHarvest": PestDispHarvest,
               "nchem": nchem,
               "convert_Foliar1": convert_Foliar1,
               "parentTo3": parentTo3,
               "deg1To2": deg1To2,
               "foliarHalfLifeBox": foliarHalfLifeBox,
               "koc_check": koc_check,
               "Koc": Koc,
               "soilHalfLifeBox": soilHalfLifeBox,
               "convertSoil1": convertSoil1,
               "convert1to3": convert1to3,
               "convert2to3": convert2to3}
    logger.info(all_dic)
    data = json.dumps(all_dic)
    jid = rest_funcs.gen_jid()
    url=url_part1 + '/przm5/' + jid 


    if run_type == "single" or "qaqc":
        # response = urlfetch.fetch(url=url, payload=data, method=urlfetch.POST, headers=http_headers, deadline=60)
        response = requests.post(url=url, data=data, headers=http_headers, timeout=60)
        output_val = json.loads(response.content)['result']
        # jid= json.loads(response.content)['jid']
        # print "filepath=", output_val[4]
        # self.elapsed = (time.clock() - start)
        return(jid, output_val)