maps ==== .. py:module:: maps Classes ------- .. autoapisummary:: maps.Map Module Contents --------------- .. py:class:: Map(*args, domain=None, crs=None, **kwargs) Bases: :py:obj:`earthkit.plots.components.subplots.Subplot` A specialized Subplot for plotting geospatial data. :param row: The row index of the subplot in the figure. :type row: int, optional :param column: The column index of the subplot in the figure. :type column: int, optional :param figure: The Figure to which the subplot belongs. :type figure: Figure, optional :param domain: The domain of the map. Can be a string, a tuple or a list of coordinates, or a Domain object. This is used to set the extent and projection of the map. :type domain: str, tuple, list or Domain, optional :param crs: The CRS of the map. If not provided, it will be inferred from the domain or set to PlateCarree. :type crs: cartopy.crs.CRS, optional :param \*\*kwargs: Additional keyword arguments to pass to the matplotlib Axes object. .. py:method:: administrative_areas(*args, **kwargs) Add country boundary polygons from Natural Earth. :param resolution: One of "low", "medium" or "high", or a named resolution from the Natrual Earth dataset. :type resolution: (str, optional) .. py:property:: ax The matplotlib Axes object of the subplot. .. py:method:: borders(*args, **kwargs) Add country boundary polygons from Natural Earth. :param resolution: One of "low", "medium" or "high", or a named resolution from the Natrual Earth dataset. :type resolution: (str, optional) .. py:method:: cities(density=None, labels=True, capital_cities=False, capital_cities_kwargs=None, medium_cities_kwargs=None, small_cities_kwargs=None, adjust_labels=False, **kwargs) Add city markers to the map. :param density: The resolution of the Natural Earth dataset to use. Can be one of "low", "medium" or "high". :type density: str or int, optional :param labels: Whether to add city names as labels. Default is True. :type labels: bool, optional :param capital_cities: Whether to include capital cities only. Default is False. :type capital_cities: bool, optional :param capital_cities_kwargs: Keyword arguments to pass to the scatter method for capital cities. :type capital_cities_kwargs: dict, optional :param medium_cities_kwargs: Keyword arguments to pass to the scatter method for medium cities. :type medium_cities_kwargs: dict, optional :param small_cities_kwargs: Keyword arguments to pass to the scatter method for small cities. :type small_cities_kwargs: dict, optional :param adjust_labels: Whether to adjust the positions of city labels to avoid overlap. Default is False. Note that this adjustment can be slow for large numbers of labels. :type adjust_labels: bool, optional :param \*\*kwargs: Additional keyword arguments to pass to the scatter method. .. py:method:: coastlines(*args, **kwargs) Add country boundary polygons from Natural Earth. :param resolution: One of "low", "medium" or "high", or a named resolution from the Natrual Earth dataset. :type resolution: (str, optional) .. py:method:: countries(*args, **kwargs) Add country boundary polygons from Natural Earth. :param resolution: One of "low", "medium" or "high", or a named resolution from the Natrual Earth dataset. :type resolution: (str, optional) .. py:property:: crs The CRS of the map. .. py:property:: crs_name The human-readable name of the CRS of the map. .. py:method:: disputed_boundaries(*args, **kwargs) Add country boundary polygons from Natural Earth. :param resolution: One of "low", "medium" or "high", or a named resolution from the Natrual Earth dataset. :type resolution: (str, optional) .. py:property:: domain_name The human-readable name of the domain of the map. .. py:property:: fig The matplotlib Figure object to which the subplot belongs. .. py:method:: grid_points(*args, **kwargs) Plot gridpoint centroids on the map. :param data: The data source for which to plot grid_points. :type data: xarray.DataArray or earthkit.data.core.Base, optional :param x: The name of the x-coordinate variable in the data source. :type x: str, optional :param y: The name of the y-coordinate variable in the data source. :type y: str, optional :param \*\*kwargs: Additional keyword arguments to pass to `matplotlib.pyplot.scatter`. .. py:method:: gridlines(*args, xstep=None, xref=0, ystep=None, yref=0, **kwargs) Add gridlines to the map. :param \*args: Positional arguments to pass to cartopy.mpl.gridliner.Gridliner. :param xstep: The step size for the x-axis gridlines. Default is None. :type xstep: float, optional :param xref: The reference point for the xstep. Default is 0. :type xref: float, optional :param ystep: The step size for the y-axis gridlines. Default is None. :type ystep: float, optional :param yref: The reference point for the ystep. Default is 0. :type yref: float, optional :param \*\*kwargs: Additional keyword arguments to pass to cartopy.mpl.gridliner.Gridliner. .. py:method:: image(img, extent, origin='upper', transform=ccrs.PlateCarree()) Add an image to the map. :param img: The image to add to the map. :type img: str or PIL.Image :param extent: The extent of the image in the form (xmin, xmax, ymin, ymax). :type extent: tuple :param origin: The origin of the image. Default is "upper". :type origin: str, optional :param transform: The CRS of the image. Default is PlateCarree (euirectangular). :type transform: cartopy.crs.CRS, optional .. py:method:: labels(data=None, label=None, x=None, y=None, **kwargs) .. py:method:: land(*args, **kwargs) Add country boundary polygons from Natural Earth. :param resolution: One of "low", "medium" or "high", or a named resolution from the Natrual Earth dataset. :type resolution: (str, optional) .. py:method:: map_units(*args, **kwargs) Add country boundary polygons from Natural Earth. :param resolution: One of "low", "medium" or "high", or a named resolution from the Natrual Earth dataset. :type resolution: (str, optional) .. py:method:: natural_earth_layer(name, default_attribute='NAME_LONG', default_label='NAME_LONG', max_resolution='high', min_resolution='low', line=False) .. py:attribute:: natural_earth_resolution :value: 'medium' .. py:method:: ocean(*args, **kwargs) Add country boundary polygons from Natural Earth. :param resolution: One of "low", "medium" or "high", or a named resolution from the Natrual Earth dataset. :type resolution: (str, optional) .. py:method:: point_cloud(*args, **kwargs) Plot a point cloud on the map. :param data: The data source for which to plot grid_points. :type data: xarray.DataArray or earthkit.data.core.Base, optional :param x: The name of the x-coordinate variable in the data source. :type x: str, optional :param y: The name of the y-coordinate variable in the data source. :type y: str, optional :param \*\*kwargs: Additional keyword arguments to pass to `matplotlib.pyplot.scatter`. .. py:method:: shapes(shapes, *args, transform=ccrs.PlateCarree(), adjust_labels=False, labels=False, **kwargs) Add shapes to the map. :param shapes: The shapes to add to the map. Can be a path to a shapefile or a cartopy Reader object. :type shapes: str or cartopy.io.shapereader.Reader :param \*args: Positional arguments to pass to the add_geometries method. :param transform: The CRS of the shapes. Default is PlateCarree. :type transform: cartopy.crs.CRS, optional :param adjust_labels: Whether to adjust the positions of shape labels to avoid overlap. Default is False. Note that this adjustment can be slow for large numbers of labels. :type adjust_labels: bool, optional :param labels: The attribute of the shapes to use as labels. Default is False. :type labels: str, optional :param \*\*kwargs: Additional keyword arguments to pass to the add_geometries method. .. py:method:: standard_layers() Add standard map layers to the map. This method adds the following layers to the map: - land - coastlines - borders - gridlines .. py:method:: stock_img(*args, **kwargs) Add the cartopy stock image to the map. :param \*args: Positional arguments to pass to the stock_img method. :param \*\*kwargs: Keyword arguments to pass to the stock_img method. .. py:method:: unit_boundaries(*args, **kwargs) Add country boundary polygons from Natural Earth. :param resolution: One of "low", "medium" or "high", or a named resolution from the Natrual Earth dataset. :type resolution: (str, optional) .. py:method:: urban_areas(*args, **kwargs) Add country boundary polygons from Natural Earth. :param resolution: One of "low", "medium" or "high", or a named resolution from the Natrual Earth dataset. :type resolution: (str, optional)