title: Producing an xarray with multi-dimensional non-dimensional coordinates
body: <p>I want to work with EEG data in <em>xarray</em>. In particular, the data comes in the following format: channel x time. The channel dimension consists of 64 unique channel names, which in turn correspond to locations on the head (and therefore have 3D coordinates).</p>
  
  <p>I'd like to create a <code>DataArray</code> that I can index using the channel names (e.g. "Oz"), but which also contains the 3D locations in some way (so that I could e.g. interpolate between locations, or plot them in 3D space).</p>
  
  <p>In the <a href="http://xarray.pydata.org/en/stable/examples/multidimensional-coords.html" rel="nofollow noreferrer">documentation</a>, the following is mentioned:</p>
  
  <blockquote>
    <p>In this example, the logical coordinates are x and y, while the physical coordinates are xc and yc, which represent the latitudes and longitude of the data.</p>
  </blockquote>
  
  <p>It seems to me that this is exactly what applies here: the "logical" coordinates are the channel names, but the "physical" coordinates are the 3d position.</p>
  
  <p>But How do I create this?</p>
  
  <p>Just as an example, this is some dummy data:</p>
  
  <pre class="lang-py prettyprint-override"><code>import numpy as np
  import xarray as xr
  
  data = np.random.rand(64, 1024)
  time = np.linspace(0, 1, 1024)
  channel_names = [f"electrode {i}" for i in range(64)]
  positions = np.random.randn(64, 3)  # x, y and z for each channel
  
  
  data_array = xr.DataArray(
      data,
      dims=['channel', 'time'],
      coords={'channel': channel_names, 'time': time}
  )
  </code></pre>
  
  <p>How do I incorporate positions as physical coordinates for the logical coordinate channel?</p>
  
  <p>Thanks!</p>