def run(self, scenario=None, only=None, **kwargs):
if not exists(self.root_dir):<EOL><INDENT>raise FileNotFoundError(self.root_dir)<EOL><DEDENT>if self.executable is None:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>".format(<EOL>self.version<EOL>)<EOL>)<EOL><DEDENT>if scenario is not None:<EOL><INDENT>kwargs = self.set_emission_scenario_setup(scenario, kwargs)<EOL><DEDENT>yr_config = {}<EOL>if "<STR_LIT>" in kwargs:<EOL><INDENT>yr_config["<STR_LIT>"] = kwargs.pop("<STR_LIT>")<EOL><DEDENT>if "<STR_LIT>" in kwargs:<EOL><INDENT>yr_config["<STR_LIT>"] = kwargs.pop("<STR_LIT>")<EOL><DEDENT>if yr_config:<EOL><INDENT>self.set_years(**yr_config)<EOL><DEDENT>kwargs.setdefault("<STR_LIT>", get_date_time_string())<EOL>self.update_config(**kwargs)<EOL>self.check_config()<EOL>exec_dir = basename(self.original_dir)<EOL>command = [join(self.root_dir, exec_dir, self.binary_name)]<EOL>if not IS_WINDOWS and self.binary_name.endswith("<STR_LIT>"):  <EOL><INDENT>command.insert(<NUM_LIT:0>, "<STR_LIT>")<EOL><DEDENT>subprocess.check_call(command, cwd=self.run_dir, shell=IS_WINDOWS)<EOL>outfiles = self._get_output_filenames()<EOL>read_cols = {"<STR_LIT>": ["<STR_LIT>".format(self.version)]}<EOL>if scenario is not None:<EOL><INDENT>read_cols["<STR_LIT>"] = scenario["<STR_LIT>"].unique().tolist()<EOL>read_cols["<STR_LIT>"] = scenario["<STR_LIT>"].unique().tolist()<EOL><DEDENT>else:<EOL><INDENT>read_cols.setdefault("<STR_LIT>", ["<STR_LIT>"])<EOL>read_cols.setdefault("<STR_LIT>", ["<STR_LIT>"])<EOL><DEDENT>mdata = None<EOL>for filepath in outfiles:<EOL><INDENT>try:<EOL><INDENT>openscm_var = _get_openscm_var_from_filepath(filepath)<EOL>if only is None or openscm_var in only:<EOL><INDENT>tempdata = MAGICCData(<EOL>join(self.out_dir, filepath), columns=deepcopy(read_cols)<EOL>)<EOL>mdata = mdata.append(tempdata) if mdata is not None else tempdata<EOL><DEDENT><DEDENT>except (NoReaderWriterError, InvalidTemporalResError):<EOL><INDENT>continue<EOL><DEDENT><DEDENT>if mdata is None:<EOL><INDENT>error_msg = "<STR_LIT>".format(only)<EOL>raise ValueError(error_msg)<EOL><DEDENT>try:<EOL><INDENT>run_paras = self.read_parameters()<EOL>self.config = run_paras<EOL>mdata.metadata["<STR_LIT>"] = run_paras<EOL><DEDENT>except FileNotFoundError:<EOL><INDENT>pass<EOL><DEDENT>return mdata<EOL>
Run MAGICC and parse the output.

As a reminder, putting ``out_parameters=1`` will cause MAGICC to write out its
parameters into ``out/PARAMETERS.OUT`` and they will then be read into
``output.metadata["parameters"]`` where ``output`` is the returned object.

Parameters
----------
scenario : :obj:`pymagicc.io.MAGICCData`
    Scenario to run. If None MAGICC will simply run with whatever config has
    already been set.

only : list of str
    If not None, only extract variables in this list.

kwargs
    Other config values to pass to MAGICC for the run

Returns
-------
:obj:`pymagicc.io.MAGICCData`
    MAGICCData object containing that data in its ``df`` attribute and
    metadata and parameters (depending on the value of ``include_parameters``)
    in its ``metadata`` attribute.

Raises
------
ValueError
    If no output is found which matches the list specified in ``only``.