code: def test_regridding_with_invalid_extent(
      target_prj, use_scipy, monkeypatch
  ):
      # tests that when a valid extent results in invalid points in the
      # transformed coordinates, the regridding does not error.
  
      # create 3 data points
      lats = np.array([65, 10, -45])
      lons = np.array([-170, 10, 170])
      data = np.array([1, 2, 3])
      data_trans = ccrs.Geodetic()
  
      target_x, target_y, extent = img_trans.mesh_projection(
          target_prj, 8, 4
      )
  
      if use_scipy:
          monkeypatch.setattr(img_trans, "_is_pykdtree", False)
          import scipy.spatial
  
          monkeypatch.setattr(
              img_trans, "_kdtreeClass", scipy.spatial.cKDTree
          )
      _ = img_trans.regrid(
          data, lons, lats, data_trans, target_prj, target_x, target_y
      )
  
file_path: cartopy/lib/cartopy/tests/test_img_transform.py
imports: import numpy
  from numpy.testing import assert_array_equal
  import pytest
  from cartopy.tests.conftest import _HAS_PYKDTREE_OR_SCIPY, requires_pykdtree, requires_scipy
  import cartopy.crs
  import cartopy.img_transform
label_desc: Use image node_id 4 for calling a global function with example usage: test_regridding_with_invalid_extent(target_prj, use_scipy, monkeypatch) without return types