def space_subset(ds, lat_lim, long_lim ):
    """
    Extract spatial subset of a dataset given lat and long limits.

   :param ds: 
     dataset.
  :type ds: xarray DataSet.
  :return:
     subset of dataset.
  :rtype: xarray DataSet.
 """
    
    s_subset=ds.where((long_lim[0] < ds.XLONG) & (ds.XLONG < long_lim[1]) & 
                (lat_lim[0] < ds.XLAT) & (ds.XLAT < lat_lim[1]), drop=True)
  
    return s_subset