title: Workaround for Item Assignment in Dask
body: <p>I have a piece of code in a model that transforms arrays based on the value of another array one day prior. If the maximum temperature for the current day is lower than the minimum temperature from the day before, the value should be changed to the value of the minimum temperature of the day before the current date. Likewise when the minimum temperature of the before the current day for the current day is higher than the maximum temperature from the day before, the value should be changed to the value of the maximum temperature of the day before the current date. I have two versions that both give the same error, as the Dask arrays do not support item assignment:</p>
  <pre><code>for ens in range(0,num_ens):
      for lat in range(0, num_lats):
          for lon in range(0, num_lons):
              for day in range(1, 240):
                  if max_ens[ens, lat, lon, day] &lt; min_ens[ens, lat, lon, day-1]:
                      max_ens[ens, lat, lon, day] = min_ens[ens, lat, lon, day-1]
                  if min_ens[ens, lat, lon, day] &gt; max_ens[ens, lat, lon, day-1]:
                      min_ens[ens, lat, lon, day] = max_ens[ens, lat, lon, day-1]
  </code></pre>
  <p>Vectorized version:</p>
  <pre><code>max_ens[:, :, :, day] = np.maximum(max_ens[:, :, :, day], min_ens[:, :, :, day - 1])
  min_ens[:, :, :, day] = np.minimum(min_ens[:, :, :, day], max_ens[:, :, :, day - 1]) 
  </code></pre>
  <p>Does anyone know how to efficiently do this in Dask?</p>
  <p>Thanks in advance!</p>
  <p>EDIT:</p>
  <p>I have been trying to implement the where function but the shape of the arrays is adjusted when the where function is applied.</p>