title: Extract Single Value From Xarray Dataset
body: <p>I have an Xarray dataset with just two pieces of information, a time referenced by 'time' and a time referenced by 'reftime':</p>
  
  <pre><code>&lt;xarray.Dataset&gt;
  Dimensions:  ()
  Coordinates:
      reftime  datetime64[ns] 2020-03-31T06:00:00
      time     datetime64[ns] 2020-03-31T12:00:00
      crs      object Projection: latitude_longitude
  Data variables:
      *empty*
  Attributes:
      Originating_or_generating_Center:                                        ...
      Originating_or_generating_Subcenter:                                     ...
      GRIB_table_version:                                                      ...
      Type_of_generating_process:                                              ...
      Analysis_or_forecast_generating_process_identifier_defined_by_originating...
      Conventions:                                                             ...
      history:                                                                 ...
      featureType:                                                             ...
      History:                                                                 ...
      geospatial_lat_min:                                                      ...
      geospatial_lat_max:                                                      ...
      geospatial_lon_min:                                                      ...
      geospatial_lon_max:                                                      ...
  </code></pre>
  
  <p>everything else is empty. My goal is to get whatever date is referenced by 'reftime' into a string format. Normally, I understand that this can be done by calling dataset['reftime'], but the catch is that this code is intended to run in the background and sometimes it will find xarray datasets where the time I want is referenced by 'reftimeX' where X is some number. How can I extract whatever information is stored in the first coordinate (be it reftime, reftime1, or reftimeX') such that it could be stored as a string?</p>
  
  <p>I've tried turning it into a DataArray in the hopes that I could then turn it into a numpy array and extract the string from there, but when I try to turn it into a DataArray:</p>
  
  <pre><code>filtered_dataarray = filtered_ds.to_array()
  </code></pre>
  
  <p>I get an error:</p>
  
  <pre><code>ValueError: at least one array or dtype is required
  </code></pre>
  
  <p>The Xarray docs suggest that this function needs some <em>self</em> parameter:</p>
  
  <pre><code>Dataset.to_array(self, dim='variable', name=None)
  </code></pre>
  
  <p>But thus far I have been unable to figure out to what this is referring.</p>