def _save_netcdf4(self):
        sol = self.solution
        store_file = os.path.join(self.config_run.output.path, 'solution.nc')
        # Raise error if file exists already, to make sure we don't destroy
        # existing data
        if os.path.exists(store_file):
            i = 0
            alt_file = os.path.join(self.config_run.output.path,
                                    'solution_{}.nc')
            while os.path.exists(alt_file.format(i)):
                i += 1
            alt_file = alt_file.format(i)  # Now "pick" the first free filename
            message = ('File `{}` exists, '
                       'using `{}` instead.'.format(store_file, alt_file))
            logging.warning(message)
            store_file = alt_file

        # Serialize config dicts to YAML strings
        for k in ['config_model', 'config_run']:
            sol.attrs[k] = sol.attrs[k].to_yaml()

        self.solution.to_netcdf(store_file, format='netCDF4')

        # Return the path we used
        return store_file
searches for an object with the name given inside the object given.
dataset/ETHPy150Open calliope-project/calliope/calliope/core.py/Model._save_netcdf4--crossover with--dataset/ETHPy150Open anandology/pyjamas/examples/jsonrpc/public/services/jsonrpc/__init__.py/getMethodByName