def save_solution(self, how):
        """Save model solution. ``how`` can be 'netcdf' or 'csv'"""

        if 'path' not in self.config_run.output:
            self.config_run.output['path'] = 'Output'
            logging.warning('`config_run.output.path` not set, using default: `Output`')

        # Create output dir, but ignore if it already exists
        try:
            os.makedirs(self.config_run.output.path)
        except __HOLE__:  # Hoping this isn't raised for more serious stuff
            pass
        # except KeyError:  # likely because `path` or `output` not defined
        #     raise exceptions.ModelError('`config_run.output.path` not configured.')

        # Add r and e_eff time series alongside the solution
        additional_params = ['r', 'e_eff']
        for param in additional_params:
            subset_name = '_y_def_' + param
            if len(self.data[subset_name]) > 0:
                self.solution[param] = self._get_data_array(param, subset_name)

        if how == 'netcdf':
            self._save_netcdf4()
        elif how == 'csv':
            self._save_csv()
        else:
            raise ValueError('Unsupported value for `how`: {}'.format(how))

        # Remove r and e_eff from solution again
        for param in additional_params:
            if param in self.solution:
                del self.solution[param]

        return None
dataset/ETHPy150Open calliope-project/calliope/calliope/core.py/Model.save_solution