class_docstr: Test resampling a Scene to another Scene object.
docstr: Test that the Scene can be reduced or not reduced during resampling.
docstr_tok: ["Test","that","the","Scene","can","be","reduced","or","not","reduced","during","resampling","."]
code: def test_resample_reduce_data_toggle(self, rs):
      """Test that the Scene can be reduced or not reduced during resampling."""
      from pyresample.geometry import AreaDefinition
  
      rs.side_effect = self._fake_resample_dataset_force_20x20
      proj_str = (
          "+proj=lcc +datum=WGS84 +ellps=WGS84 "
          "+lon_0=-95. +lat_0=25 +lat_1=25 +units=m +no_defs"
      )
      target_area = AreaDefinition(
          "test",
          "test",
          "test",
          proj_str,
          4,
          4,
          (-1000.0, -1500.0, 1000.0, 1500.0),
      )
      area_def = AreaDefinition(
          "test",
          "test",
          "test",
          proj_str,
          5,
          5,
          (-1000.0, -1500.0, 1000.0, 1500.0),
      )
      area_def.get_area_slices = mock.MagicMock()
      get_area_slices = area_def.get_area_slices
      get_area_slices.return_value = (
          slice(0, 3, None),
          slice(0, 3, None),
      )
      area_def_big = AreaDefinition(
          "test",
          "test",
          "test",
          proj_str,
          10,
          10,
          (-1000.0, -1500.0, 1000.0, 1500.0),
      )
      area_def_big.get_area_slices = mock.MagicMock()
      get_area_slices_big = area_def_big.get_area_slices
      get_area_slices_big.return_value = (
          slice(0, 6, None),
          slice(0, 6, None),
      )
  
      # Test that data reduction can be disabled
      scene = Scene(filenames=["fake1_1.txt"], reader="fake1")
      scene.load(["comp19"])
      scene["comp19"].attrs["area"] = area_def
      scene["comp19_big"] = xr.DataArray(
          da.zeros((10, 10)),
          dims=("y", "x"),
          attrs=scene["comp19"].attrs.copy(),
      )
      scene["comp19_big"].attrs["area"] = area_def_big
      scene["comp19_copy"] = scene["comp19"].copy()
      orig_slice_data = scene._slice_data
      # we force the below order of processing to test that success isn't
      # based on data of the same resolution being processed together
      test_order = [
          make_cid(**scene["comp19"].attrs),
          make_cid(**scene["comp19_big"].attrs),
          make_cid(**scene["comp19_copy"].attrs),
      ]
      with mock.patch(
          "satpy.scene.Scene._slice_data"
      ) as slice_data, mock.patch(
          "satpy.dataset.dataset_walker"
      ) as ds_walker:
          ds_walker.return_value = test_order
          slice_data.side_effect = orig_slice_data
          scene.resample(target_area, reduce_data=False)
          slice_data.assert_not_called()
          get_area_slices.assert_not_called()
          scene.resample(target_area)
          assert slice_data.call_count == 3
          assert get_area_slices.call_count == 1
          assert get_area_slices_big.call_count == 1
          scene.resample(target_area, reduce_data=True)
          # 2 times for each dataset
          # once for default (reduce_data=True)
          # once for kwarg forced to `True`
          assert slice_data.call_count == 2 * 3
          # get area slices is called again, once per area
          assert get_area_slices.call_count == 2
          assert get_area_slices_big.call_count == 2
  
imports: from unittest import mock
  import numpy
  import pytest
  import xarray
  from dask import array
  from satpy import Scene
  from satpy.dataset.dataid import default_id_keys_config
  from satpy.tests.utils import make_cid, make_dataid
label_desc: Use image node_id 5 for calling the TestSceneResampling obj's underlying member method code with example usage: obj.test_resample_reduce_data_toggle(rs) without return types