code: def _get_animation_frames(self, all_datasets, shape, fill_value=None,
                                ignore_missing=False):
          
          for idx, ds in enumerate(all_datasets):
              if ds is None and ignore_missing:
                  continue
              elif ds is None:
                  log.debug("Missing frame: %d", idx)
                  data = da.zeros(shape, dtype=np.uint8, chunks=shape)
                  data = xr.DataArray(data)
              else:
                  img = get_enhanced_image(ds)
                  data, mode = img.finalize(fill_value=fill_value)
                  if data.ndim == 3:
                      # assume all other shapes are (y, x)
                      # we need arrays grouped by pixel so
                      # transpose if needed
                      data = data.transpose('y', 'x', 'bands')
              yield data.data
docs: Create enhanced image frames to save to a file.