class_docstr: A WMS imagery retriever which can be added to a map.
  
  Note
  ----
      Requires owslib and Pillow to work.
  
  No caching of retrieved maps is done with this WMSRasterSource.
  
  To reduce load on the WMS server it is encouraged to tile
  map requests and subsequently stitch them together to recreate
  a single raster, thus allowing for a more aggressive caching scheme,
  but this WMSRasterSource does not currently implement WMS tile
  fetching.
  
  Whilst not the same service, there is also a WMTSRasterSource which
  makes use of tiles and comes with built-in caching for fast repeated
  map retrievals.
class_docstr_tok: ["A","WMS","imagery","retriever","which","can","be","added","to","a","map",".","Note","--","--","Requires","owslib","and","Pillow","to","work",".","No","caching","of","retrieved","maps","is","done","with","this","WMSRasterSource",".","To","reduce","load","on","the","WMS","server","it","is","encouraged","to","tile","map","requests","and","subsequently","stitch","them","together","to","recreate","a","single","raster",",","thus","allowing","for","a","more","aggressive","caching","scheme",",","but","this","WMSRasterSource","does","not","currently","implement","WMS","tile","fetching",".","Whilst","not","the","same","service",",","there","is","also","a","WMTSRasterSource","which","makes","use","of","tiles","and","comes","with","built-in","caching","for","fast","repeated","map","retrievals","."]
code: def fetch_raster(self, projection, extent, target_resolution):
      target_resolution = [math.ceil(val) for val in target_resolution]
      wms_srs = self._native_srs(projection)
      if wms_srs is not None:
          wms_proj = projection
          wms_extents = [extent]
      else:
          # The SRS for the requested projection is not known, so
          # attempt to use the fallback and perform the necessary
          # transformations.
          wms_proj, wms_srs = self._fallback_proj_and_srs()
  
          # Calculate the bounding box(es) in WMS projection.
          wms_extents = _target_extents(extent, projection, wms_proj)
  
      located_images = []
      for wms_extent in wms_extents:
          located_images.append(
              self._image_and_extent(
                  wms_proj,
                  wms_srs,
                  wms_extent,
                  projection,
                  extent,
                  target_resolution,
              )
          )
      return located_images
  
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 6 for calling the WMSRasterSource obj's underlying member method code with example usage: obj.fetch_raster(projection, extent, target_resolution) and returns: located_images