예제 #1
0
        ncpus = int(os.getenv(
            'NUM_PROCS'))  # try to use variable defined in sbatch script
    except:
        ncpus = ncpus  # otherwise default to this number of cores

    # combine data files
    tt.combine(project_path=project_path,
               primary=data_files[0],
               data_files=data_files[1:],
               output='data_combined_sensitivity.xlsx')
    modelInputs_XLSX = 'data_combined_sensitivity.xlsx'

    # =======================================================
    # Move modelInputs_XLSX to database
    # =======================================================
    modelInputs = tt.move_data_to_db(modelInputs_XLSX, path=project_path)

    # =======================================================
    # Create directories - best completed before using multiprocessing
    # =======================================================
    sens_dir = 'sensitivity'
    tt.create_dir(project_path=project_path, optional_dir=sens_dir)

    # ====================================
    # Perform Simulations
    # ====================================

    for scenarioName in scenarioNames:
        # Create sensitivity cases
        cases = tt.createSensitivityCases(scenarioInputs, scenarioName,
                                          sensitivityInputs,
예제 #2
0
if __name__ == '__main__':

    # =======================================================
    # Model Inputs
    # =======================================================
    modelInputs_XLSX = 'data.xlsx'
    scenarioInputs = 'scenarios.xlsx'
    scenarioNames = ['A', 'B', 'C', 'D']
    paths = 'paths.csv'
    sensitivityInputs = 'sensitivityVariables.xlsx'
    sensitivityMultiplier = 10.0  # percent perturbation

    # =======================================================
    # Move modelInputs_XLSX to database
    # =======================================================
    modelInputs = tt.move_data_to_db(modelInputs_XLSX, path='data')

    # =======================================================
    # Create directory to hold sensitivity inputs and outputs
    # =======================================================
    workDir = os.getcwd()
    sensDir = workDir + "\\sensitivity"
    try:
        os.stat(sensDir)
    except:
        os.mkdir(sensDir)

    # ====================================
    # Perform Simulations
    # ====================================