class_docstr: Test creating new Scenes by cropping an existing Scene.
docstr: Test the crop method.
docstr_tok: ["Test","the","crop","method","."]
code: def test_crop(self):
      """Test the crop method."""
      from pyresample.geometry import AreaDefinition
  
      scene1 = Scene()
      area_extent = (
          -5570248.477339745,
          -5561247.267842293,
          5567248.074173927,
          5570248.477339745,
      )
      proj_dict = {
          "a": 6378169.0,
          "b": 6356583.8,
          "h": 35785831.0,
          "lon_0": 0.0,
          "proj": "geos",
          "units": "m",
      }
      x_size = 3712
      y_size = 3712
      area_def = AreaDefinition(
          "test",
          "test",
          "test",
          proj_dict,
          x_size,
          y_size,
          area_extent,
      )
      area_def2 = AreaDefinition(
          "test2",
          "test2",
          "test2",
          proj_dict,
          x_size // 2,
          y_size // 2,
          area_extent,
      )
      scene1["1"] = xr.DataArray(np.zeros((y_size, x_size)))
      scene1["2"] = xr.DataArray(
          np.zeros((y_size, x_size)), dims=("y", "x")
      )
      scene1["3"] = xr.DataArray(
          np.zeros((y_size, x_size)),
          dims=("y", "x"),
          attrs={"area": area_def},
      )
      scene1["4"] = xr.DataArray(
          np.zeros((y_size // 2, x_size // 2)),
          dims=("y", "x"),
          attrs={"area": area_def2},
      )
  
      # by area
      crop_area = AreaDefinition(
          "test",
          "test",
          "test",
          proj_dict,
          x_size,
          y_size,
          (
              area_extent[0] + 10000.0,
              area_extent[1] + 500000.0,
              area_extent[2] - 10000.0,
              area_extent[3] - 500000.0,
          ),
      )
      new_scn1 = scene1.crop(crop_area)
      assert "1" in new_scn1
      assert "2" in new_scn1
      assert "3" in new_scn1
      assert new_scn1["1"].shape == (y_size, x_size)
      assert new_scn1["2"].shape == (y_size, x_size)
      assert new_scn1["3"].shape == (3380, 3708)
      assert new_scn1["4"].shape == (1690, 1854)
  
      # by lon/lat bbox
      new_scn1 = scene1.crop(ll_bbox=(-20.0, -5.0, 0, 0))
      assert "1" in new_scn1
      assert "2" in new_scn1
      assert "3" in new_scn1
      assert new_scn1["1"].shape == (y_size, x_size)
      assert new_scn1["2"].shape == (y_size, x_size)
      assert new_scn1["3"].shape == (184, 714)
      assert new_scn1["4"].shape == (92, 357)
  
      # by x/y bbox
      new_scn1 = scene1.crop(xy_bbox=(-200000.0, -100000.0, 0, 0))
      assert "1" in new_scn1
      assert "2" in new_scn1
      assert "3" in new_scn1
      assert new_scn1["1"].shape == (y_size, x_size)
      assert new_scn1["2"].shape == (y_size, x_size)
      assert new_scn1["3"].shape == (36, 70)
      assert new_scn1["4"].shape == (18, 35)
  
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 1 for calling the TestSceneCrop obj's underlying member method code with example usage: obj.test_crop() without return types