domains ======= .. py:module:: domains Attributes ---------- .. autoapisummary:: domains.NO_BBOX domains.NO_TRANSFORM_FIRST Classes ------- .. autoapisummary:: domains.Domain domains.PresetDomain Functions --------- .. autoapisummary:: domains.force_0_to_360 domains.force_minus_180_to_180 domains.format_name domains.is_latlon domains.roll_from_0_360_to_minus_180_180 domains.roll_from_minus_180_180_to_0_360 domains.union Module Contents --------------- .. py:class:: Domain(bbox, crs=DEFAULT_CRS, name=None) Class for storing domain information. :param bbox: The bounding box of the domain in the form [west, east, south, north]. :type bbox: list of float :param crs: The coordinate reference system of the domain. :type crs: cartopy.crs.CRS, optional :param name: The name of the domain. :type name: str, optional .. py:attribute:: bbox .. py:property:: can_bbox Whether the domain can be used to slice data. .. py:property:: crs The coordinate reference system of the domain. .. py:method:: extract(x, y, values=None, extra_values=None, source_crs=ccrs.PlateCarree()) Slice data to fit the domain. Works for both gridded and unstructured data. :param x: The x-coordinates of the data. :type x: array-like :param y: The y-coordinates of the data. :type y: array-like :param values: The values of the data. :type values: array-like, optional :param extra_values: Additional values to be sliced. :type extra_values: list of array-like, optional :param source_crs: The coordinate reference system of the input data. :type source_crs: cartopy.crs.CRS, optional .. py:method:: from_bbox(*args, name=None, **kwargs) :classmethod: Create a domain from a bounding box. :param \*args: The bounding box of the domain in the form [west, east, south, north]. :type \*args: list of float :param name: The name of the domain. :type name: str, optional :param \*\*kwargs: Additional keyword arguments to be passed to the BoundingBox constructor. .. py:method:: from_data(data) :classmethod: Create a domain from a dataset. The domain will be created based on the bounding box and CRS of the dataset. :param data: The dataset from which to create the domain. :type data: xarray.Dataset or earthkit.data.core.Base .. py:method:: from_string(string, crs=None) :classmethod: Create a domain from a string. The name of the domain can be a country, region, or a custom domain as defined in the domain lookup associated with your schema. :param string: The name of the domain. :type string: str :param crs: The coordinate reference system to be used. :type crs: cartopy.crs.CRS, optional .. py:property:: is_complete Whether the domain is fully defined. .. py:property:: name The name of the domain. .. py:property:: title The title of the domain. .. py:data:: NO_BBOX .. py:data:: NO_TRANSFORM_FIRST .. py:class:: PresetDomain(bbox=None, crs=None, name=None) Bases: :py:obj:`Domain` Class for storing domain information. :param bbox: The bounding box of the domain in the form [west, east, south, north]. :type bbox: list of float :param crs: The coordinate reference system of the domain. :type crs: cartopy.crs.CRS, optional :param name: The name of the domain. :type name: str, optional .. py:attribute:: BBOX .. py:attribute:: CRS .. py:attribute:: NAME :value: 'Custom Domain' .. py:attribute:: bbox .. py:property:: can_bbox Whether the domain can be used to slice data. .. py:property:: crs The coordinate reference system of the domain. .. py:method:: extract(x, y, values=None, extra_values=None, source_crs=ccrs.PlateCarree()) Slice data to fit the domain. Works for both gridded and unstructured data. :param x: The x-coordinates of the data. :type x: array-like :param y: The y-coordinates of the data. :type y: array-like :param values: The values of the data. :type values: array-like, optional :param extra_values: Additional values to be sliced. :type extra_values: list of array-like, optional :param source_crs: The coordinate reference system of the input data. :type source_crs: cartopy.crs.CRS, optional .. py:method:: from_bbox(*args, name=None, **kwargs) :classmethod: Create a domain from a bounding box. :param \*args: The bounding box of the domain in the form [west, east, south, north]. :type \*args: list of float :param name: The name of the domain. :type name: str, optional :param \*\*kwargs: Additional keyword arguments to be passed to the BoundingBox constructor. .. py:method:: from_data(data) :classmethod: Create a domain from a dataset. The domain will be created based on the bounding box and CRS of the dataset. :param data: The dataset from which to create the domain. :type data: xarray.Dataset or earthkit.data.core.Base .. py:method:: from_string(string, crs=None) :classmethod: Create a domain from a string. The name of the domain can be a country, region, or a custom domain as defined in the domain lookup associated with your schema. :param string: The name of the domain. :type string: str :param crs: The coordinate reference system to be used. :type crs: cartopy.crs.CRS, optional .. py:property:: is_complete Whether the domain is fully defined. .. py:property:: name The name of the domain. .. py:property:: title The title of the domain. .. py:function:: force_0_to_360(x) Force an array of longitudes to be in the range 0 to 360. :param x: The longitudes to be forced into the range 0 to 360. :type x: array-like .. py:function:: force_minus_180_to_180(x) Force an array of longitudes to be in the range -180 to 180. :param x: The longitudes to be forced into the range -180 to 180. :type x: array-like .. py:function:: format_name(domain_name) Format a domain name to match the lookup keys in the domain lookup. :param domain_name: The domain name to be formatted. :type domain_name: str .. py:function:: is_latlon(data) Determine whether a dataset' coordinates are in latitude and longitude. :param data: The dataset to be checked. :type data: xarray.Dataset or earthkit.data.core.Base .. py:function:: roll_from_0_360_to_minus_180_180(x) Find the index at which an array of longitudes crosses the 180° meridian. :param x: The longitudes to be checked. :type x: array-like (1D or 2D) :returns: The index at which the array crosses 180°. :rtype: int .. py:function:: roll_from_minus_180_180_to_0_360(x) Find the index at which an array of longitudes crosses the 0° meridian. :param x: The longitudes to be checked. :type x: array-like .. py:function:: union(domains, name=None) Combine multiple domains into a single domain. :param domains: The domains to be combined. :type domains: list of Domain or str :param name: The name of the new domain. :type name: str, optional .. rubric:: Example >>> union(["Norway", "Sweden", "Finland"], name="Fennoscandia")