code: def to_xarray_dataset(self, datasets=None):
          
          if datasets is not None:
              datasets = [self[ds] for ds in datasets]
          else:
              datasets = [self.datasets.get(ds) for ds in self.wishlist]
              datasets = [ds for ds in datasets if ds is not None]
  
          ds_dict = {i.attrs['name']: i.rename(i.attrs['name']) for i in datasets if i.attrs.get('area') is not None}
          mdata = combine_metadata(*tuple(i.attrs for i in datasets))
          if mdata.get('area') is None or not isinstance(mdata['area'], SwathDefinition):
              # either don't know what the area is or we have an AreaDefinition
              ds = xr.merge(ds_dict.values())
          else:
              # we have a swath definition and should use lon/lat values
              lons, lats = mdata['area'].get_lonlats()
              if not isinstance(lons, DataArray):
                  lons = DataArray(lons, dims=('y', 'x'))
                  lats = DataArray(lats, dims=('y', 'x'))
              # ds_dict['longitude'] = lons
              # ds_dict['latitude'] = lats
              ds = xr.Dataset(ds_dict, coords={"latitude": (["y", "x"], lats),
                                               "longitude": (["y", "x"], lons)})
  
          ds.attrs = mdata
          return ds
docs: Merge all xr.DataArrays of a scene to a xr.DataSet.
  
          Parameters:
              datasets (list):
                  List of products to include in the :class:`xarray.Dataset`
  
          Returns: :class:`xarray.Dataset`