code: def _warped_located_image(
      image,
      source_projection,
      source_extent,
      output_projection,
      output_extent,
      target_resolution,
  ):
      """
      Reproject an Image from one source-projection and extent to another.
  
      Returns
      -------
      LocatedImage
          A reprojected LocatedImage, the extent of which is >= the requested
          'output_extent'.
  
      """
      if source_projection == output_projection:
          extent = output_extent
      else:
          # Convert Image to numpy array (flipping so that origin
          # is 'lower').
          # Convert to RGBA to keep the color palette in the regrid process
          # if any
          img, extent = warp_array(
              np.asanyarray(image.convert("RGBA"))[::-1],
              source_proj=source_projection,
              source_extent=source_extent,
              target_proj=output_projection,
              target_res=np.asarray(target_resolution, dtype=int),
              target_extent=output_extent,
              mask_extrapolated=True,
          )
  
          # Convert arrays with masked RGB(A) values to non-masked RGBA
          # arrays, setting the alpha channel to zero for masked values.
          # This avoids unsightly grey boundaries appearing when the
          # extent is limited (i.e. not global).
          if np.ma.is_masked(img):
              img[:, :, 3] = np.where(
                  np.any(img.mask, axis=2), 0, img[:, :, 3]
              )
              img = img.data
  
          # Convert warped image array back to an Image, undoing the
          # earlier flip.
          image = Image.fromarray(img[::-1])
  
      return LocatedImage(image, extent)
  
imports: import collections
  import io
  import math
  from urllib.parse import urlparse
  import warnings
  import weakref
  from xml.etree import ElementTree
  import numpy
  from PIL import Image
  import shapely.geometry
  import cartopy.crs
  from cartopy.img_transform import warp_array
  from cartopy.io import LocatedImage, RasterSource
label_desc: Use image node_id 1 for calling a global function with example usage: _warped_located_image(image, source_projection, source_extent, output_projection, output_extent, target_resolution) and returns: LocatedImage