code: def ensemble_mean_std_max_min(ens):
      
      dsOut = ens.drop(ens.data_vars)
      for v in ens.data_vars:
  
          dsOut[v + '_mean'] = ens[v].mean(dim='realization')
          dsOut[v + '_stdev'] = ens[v].std(dim='realization')
          dsOut[v + '_max'] = ens[v].max(dim='realization')
          dsOut[v + '_min'] = ens[v].min(dim='realization')
          for vv in dsOut.data_vars:
              dsOut[vv].attrs = ens[v].attrs
  
              if 'description' in dsOut[vv].attrs.keys():
                  vv.split()
                  dsOut[vv].attrs['description'] = dsOut[vv].attrs['description'] + ' : ' + vv.split('_')[
                      -1] + ' of ensemble'
  
      return dsOut
docs: Calculate ensemble statistics between a results from an ensemble of climate simulations
  
      Returns a dataset containing ensemble mean, standard-deviation,
      minimum and maximum for input climate simulations.
  
      Parameters
      ----------
      ens : Ensemble dataset (see xclim.utils.create_ensemble)
  
      Returns
      -------
      xarray dataset with containing data variables of ensemble statistics
  
      Examples
      --------
      >>> from xclim import utils
      >>> import glob
      >>> ncfiles = glob.glob('/*tas*.nc')
      Create ensemble dataset
      >>> ens = utils.create_ensemble(ncfiles)
      Calculate ensemble statistics
      >>> ens_means_std = utils.ensemble_mean_std_max_min(ens)
      >>> print(ens_mean_std['tas_mean'])