title: Drop dimension for exporting dataarray to geotiff not working
body: <p>I want to export a single date and variable <code>fwi</code> of a xarray dataset <code>ds</code> to a tif file. However, my dataarray has too many dimensions and I cannot figure out how to effectively remove the dimension <code>lsm_time</code>.</p>
  <pre><code>    ds
      &lt;xarray.Dataset&gt;
      Dimensions:      (time: 2436, y: 28, x: 58, lsm_time: 1)
      Coordinates:
        * time         (time) datetime64[ns] 2015-05-02T12:00:00 ... 2021-12-31T12:...
          step         &lt;U8 '12:00:00'
          surface      float64 0.0
        * y            (y) float64 36.01 36.11 36.21 36.31 ... 38.41 38.51 38.61 38.71
        * x            (x) float64 -7.64 -7.54 -7.44 -7.34 ... -2.24 -2.14 -2.04 -1.94
          spatial_ref  int32 0
      Dimensions without coordinates: lsm_time
      Data variables:
          ffmc         (time, y, x, lsm_time) float32 nan nan nan ... 88.93 88.53     
          dmc          (time, y, x, lsm_time) float32 nan nan nan ... 6.511 7.908 8.45
          dc           (time, y, x, lsm_time) float32 nan nan nan ... 406.2 428.5
          isi          (time, y, x, lsm_time) float32 nan nan nan ... 3.872 3.852
          bui          (time, y, x, lsm_time) float32 nan nan nan ... 15.08 16.11
          fwi          (time, y, x, lsm_time) float32 nan nan nan ... 5.303 5.486
  </code></pre>
  <p>Exporting the dataarray raises the error <code>TooManyDimensions</code>:</p>
  <pre><code>    ds.fwi.sel(time=&quot;07-14-2021&quot;).rio.to_raster(&quot;file_out.tif&quot;)
  
      raise TooManyDimensions(
      rioxarray.exceptions.TooManyDimensions: Only 2D and 3D data arrays supported. Data variable: fwi
  </code></pre>
  <p>I already dropped the dimension <code>lsm_time</code> in a previous step, when I masked the dataset <code>ds</code> with a land sea mask <code>lsm</code> (single date), and had to duplicate/add the time dimension of the dataset <code>ds</code>. So maybe this is an error resulting from this data handling.. However, I could figure out how to mask otherwise.</p>
  <pre><code>    lsm
      Dimensions:      (x: 58, y: 28, time: 1)
      Coordinates:
        * x            (x) float64 -7.64 -7.54 -7.44 -7.34 ... -2.24 -2.14 -2.04 -1.94
        * y            (y) float64 36.01 36.11 36.21 36.31 ... 38.41 38.51 38.61 38.71
        * time         (time) datetime64[ns] 2013-11-29
      Data variables:
          spatial_ref  int32 0
          lsm          (time, y, x) float64 0.0 0.0 0.0 0.0 0.0 ... 1.0 1.0 1.0 0.9996
  
      lsm = lsm.expand_dims({&quot;new_time&quot; : ds.time})
      lsm = lsm.rename({&quot;time&quot;:&quot;lsm_time&quot;}).rename({&quot;new_time&quot; : &quot;time&quot;}).drop(&quot;lsm_time&quot;) #issue here: drop_dims removes variable..
  
      ds = ds.where(lsm&gt;=threshold)
  </code></pre>
  <p>So I already applied <code>.drop(&quot;lsm_time&quot;)</code></p>
  <p>But, it is still</p>
  <pre><code>    print(ds.fwi.sel(time=&quot;07-14-2021&quot;).dims)
      &gt; ('time', 'y', 'x', 'lsm_time')
  </code></pre>
  <p>When trying <code>.drop_dims</code>, it removes all data variables.</p>
  <pre><code>    ds.drop_dims('lsm_time')
      &lt;xarray.Dataset&gt;
      Dimensions:      (time: 2436, y: 28, x: 58)
      Coordinates:
        * time         (time) datetime64[ns] 2015-05-02T12:00:00 ... 2021-12-31T12:...
          step         &lt;U8 '12:00:00'
          surface      float64 0.0
        * y            (y) float64 36.01 36.11 36.21 36.31 ... 38.41 38.51 38.61 38.71
        * x            (x) float64 -7.64 -7.54 -7.44 -7.34 ... -2.24 -2.14 -2.04 -1.94
          spatial_ref  int32 0
      Data variables:
          *empty*
  </code></pre>
  <p>What am I missing or what did I do wrong? Thanks for any help!</p>