code: def _fill_weights_for_invalid_dataset_pixels(
      datasets: Sequence[xr.DataArray], weights: Sequence[xr.DataArray]
  ) -> Iterable[xr.DataArray]:
      """Replace weight valus with 0 where data values are invalid/null."""
      has_bands_dims = "bands" in datasets[0].dims
      for i, dataset in enumerate(datasets):
          # if multi-band only use the red-band
          compare_ds = dataset[0] if has_bands_dims else dataset
          try:
              yield xr.where(
                  compare_ds == compare_ds.attrs["_FillValue"],
                  0,
                  weights[i],
              )
          except KeyError:
              yield xr.where(compare_ds.isnull(), 0, weights[i])
  
file_path: satpy/satpy/multiscene/_blend_funcs.py
imports: from __future__ import annotations
  from datetime import datetime
  from typing import Callable, Iterable, Mapping, Optional, Sequence
  import pandas
  import xarray
  from dask import array
  from satpy.dataset import combine_metadata
label_desc: Use image node_id 4 for calling a global function with example usage: _fill_weights_for_invalid_dataset_pixels(datasets, weights) without return types