Ejemplo n.º 1
0
def verify_input():
    # get the data from input folder
    val1 = v1.get()
    chem_type = get_chemType(val1)
    chem_file = get_chemFile(chem_type)
    region_file = CUR_PATH + './Input/Region.xlsx'
    release_file = CUR_PATH + './Input/ChemRelease.xlsx'
    start_date_temp = '2005 1 1'
    end_date_temp = '2005 12 31'

    if chem_type != 'Nanomaterial':
        load_data_nonNano = LoadData(chem_type, chem_file, region_file,
                                     release_file, start_date_temp,
                                     end_date_temp)
        chem_params, presence, env, climate, bgConc, release, release_scenario = load_data_nonNano.run_loadData(
        )
    else:
        time, presence, env, climate, bgConc, chem_params, release, release_scenario = load_data(
            region_file, release_file, chem_file, start_date_temp,
            end_date_temp)

    chem_txt4 = Label(text='Chemical:', bg=bg_col).place(x=140, y=170)
    chem_name = StringVar(window, value=chem_params['name'])
    entry1 = Entry(window,
                   textvariable=chem_name,
                   bg='lightgrey',
                   state='disabled')
    entry1.place(x=220, y=170, width=250)

    chem_txt5 = Label(text='Region:', bg=bg_col).place(x=140, y=200)
    region_name = StringVar(window, value=env['name'])
    entry2 = Entry(window,
                   textvariable=region_name,
                   bg='lightgrey',
                   state='disabled')
    entry2.place(x=220, y=200, width=250)

    chem_txt6 = Label(text='Release:', bg=bg_col).place(x=140, y=230)
    release_scenario = StringVar(window, value=release_scenario)
    entry3 = Entry(window,
                   textvariable=release_scenario,
                   bg='lightgrey',
                   state='disabled')
    entry3.place(x=220, y=230, width=250)

    return chem_params, env, release_scenario
Ejemplo n.º 2
0
    def run_model(self):
        if self.chem_type != 'Nanomaterial':
            # load data
            data = LoadData(self.chem_type, self.chem_file, self.region_file,
                            self.release_file, self.start_date, self.end_date)
            chemParams, presence, env, climate, bgConc, release, release_scenario = data.run_loadData(
            )
            V_bulk_list = [
                env['airV'], env['fwV'], env['sedFWV'], env['swV'],
                env['sedSWV'], env['soilV1'], env['soilV2'], env['soilV3'],
                env['soilV4']
            ]
            sim_days = self.simulation_days()
            funC_df_list = []
            funM_df_list = []
        else:
            # load data
            time, presence, env, climate, bgConc, chemParams, release, release_scenario = load_data(
                self.region_file, self.release_file, self.chem_file,
                self.start_date, self.end_date)

            V_bulk_list = [
                env['airV'], env['freshwV'], env['sedFWV'], env['seawV'],
                env['sedSWV'], env['soilV1'], env['soilV2'], env['soilV3'],
                env['soilV4']
            ]

        if self.run_option == 1:
            if self.chem_type == 'NonionizableOrganic':
                date_array, process_array, funC_kg_1, funC_kg_1_sub, funM_kg_1, funM_kg_1_sub = \
                    org_solver(self.start_date, sim_days, presence, env, climate, chemParams, bgConc, release)
                funC_df_list = [funC_kg_1, funC_kg_1_sub]
                funM_df_list = [funM_kg_1, funM_kg_1_sub]

            elif self.chem_type == 'IonizableOrganic' or self.chem_type == 'Metal':
                date_array, process_array, funC_kg_1, funC_kg_2, funC_kg_3, funC_kg_1_sub, funC_kg_2_sub, funC_kg_3_sub, \
                funM_kg_1, funM_kg_2, funM_kg_3, funM_kg_1_sub, funM_kg_2_sub, funM_kg_3_sub = \
                    ion_solver(self.chem_type, self.start_date, sim_days, presence, env, climate, chemParams, bgConc, release)
                funC_df_list = [
                    funC_kg_1, funC_kg_1_sub, funC_kg_2, funC_kg_2_sub,
                    funC_kg_3, funC_kg_3_sub
                ]
                funM_df_list = [
                    funM_kg_1, funM_kg_1_sub, funM_kg_2, funM_kg_2_sub,
                    funM_kg_3, funM_kg_3_sub
                ]

            elif self.chem_type == 'Nanomaterial':
                # run option 1 is for a single run
                date_array, process_array, funC_kg, funC_kg_sub, funM_kg, funM_kg_sub, \
                funC_kg_1, funC_kg_2, funC_kg_3, funM_kg_1, funM_kg_2, funM_kg_3 = \
                    nano_solver(self.start_date, time, presence, env, climate, chemParams, bgConc, release)
                funC_df_list = [funC_kg_1, funC_kg_2, funC_kg_3]
                funM_df_list = [funM_kg_1, funM_kg_2, funM_kg_3]

        # generate results and plots
        result = GenerateResult()
        result.store_output(self.chem_type, chemParams['name'], env['name'],
                            release_scenario, release, date_array,
                            process_array, V_bulk_list, funC_df_list,
                            funM_df_list, self.output_file_path,
                            self.file_name)