:py:mod:`pytmosph3r.grid` ========================= .. py:module:: pytmosph3r.grid Module Contents --------------- .. py:class:: Grid Bases: :py:obj:`pytmosph3r.log.logger.Logger` Standard logging using logger library :param name: Name used for logging :type name: str .. py:property:: shape :type: Tuple :abstractmethod: .. py:property:: ndim .. py:method:: walk(dims=None) Return iterator over multiple dimensions. Args: dims (:obj:`array`): List of dimensions to iterate over. By default, iterates over all dimensions (defined in the attribute `shape` of the current object.) .. py:class:: Grid3D(n_vertical: Optional[int] = None, n_latitudes: Optional[int] = None, n_longitudes: Optional[int] = None, mid_latitudes: Optional[numpy.ndarray] = None, mid_longitudes: Optional[numpy.ndarray] = None) Bases: :py:obj:`Grid` Simple 3D grid based on a 2D longitude/latitude grid and an (abstract) vertical axis. You can overwrite the latitudes and longitudes of your grid points with the :attr:`mid_latitudes` and :attr:`mid_longitudes` parameters. Note that :attr:`latitudes` and :attr:`longitudes` are derived from these and return the boundaries of each cell of the grid. :param n_vertical: Number of vertical points in the grid. :type n_vertical: int :param n_latitudes: Number of latitudinal points in the grid. :type n_latitudes: int :param n_longitudes: Number of longitudinal points in the grid. :type n_longitudes: int .. py:property:: regular_latitudes .. py:property:: to_east :type: bool True if longitude is in increasing order. .. py:property:: to_north :type: bool True if latitude is in increasing order. .. py:property:: shape :type: Tuple[int, int, int] Shape of arrays in this grid. .. py:property:: latitudes :type: numpy.ndarray Latitudinal boundaries (deduced from :attr:`mid_latitudes`). .. py:property:: positive_latitudes :type: numpy.ndarray Positive latitudinal boundaries (deduced from :attr:`mid_latitudes`). .. py:property:: mid_latitudes :type: numpy.ndarray Latitudes in the "middle" of each latitude box. .. py:property:: lat_angle Angle between two latitudes. .. py:property:: longitudes :type: numpy.ndarray Longitudinal boundaries (unique). Deduced from :attr:`mid_longitudes`. .. py:property:: half_longitudes Half-list of longitudinal boundaries to avoid duplication. Deduced from :attr:`all_longitudes`. .. py:property:: all_longitudes :type: numpy.ndarray Longitudinal boundaries (first longitude duplicated to make a full circle). Deduced from :attr:`longitudes`. .. py:property:: mid_longitudes :type: numpy.ndarray List of longitudes (in the "middle" of each longitude box). By default, start at -Pi. .. py:property:: night_longitudes :type: List List of longitudinal indices on the `night` side. The night side is here defined as the first quarter of longitudinal indices and the last one. .. py:property:: day_longitudes :type: List List of longitudinal indices on the `day` side. The day side is here defined as the second and third quarters of longitudinal indices. .. py:property:: lon_angle Angle between two longitudes. .. py:method:: index_colatitude(colatitude) -> int Returns index corresponding to an angle with the pole 0 (by convention, north). .. py:method:: index_latitude(latitude) -> int Gives the index of the latitude interval containing a `latitude` (given in `radians`). .. py:method:: latitude(i) Boundary angles in `rad` of latitude box with index `i`. .. py:method:: index_longitude(longitude) -> int Gives the index of the longitude interval containing a `longitude` (given in `radians`). .. py:method:: longitude(i) Boundary angles in `rad` of longitude box with index `i`. .. py:method:: make_3D(obj: Union[numpy.ndarray, dict], axis: Optional[List[int]] = None) -> numpy.ndarray This function will try to transform :attr:`obj` from whatever dimension it is (or a dict of arrays with whatever dimensions) into a 3D array (or a dict with 3D arrays) of the same shape as the grid. :param obj: 1, 2 or 3 dimensional array (or dict with such arrays). :type obj: ndarray | dict :param axis: Allow to choose the value of axis. Use [0] to set a 1D pressure :type axis: Optional[List[int]] or temperature array seen as an atmospheric column to a 3D one. :returns: 3D array (or dict with 3D arrays). :rtype: (ndarray | dict) .. py:method:: horizontal_walk(*args) Iterator over horizontal grid (latitude, longitude). .. py:method:: horizontal_run(function, *args, **kwargs) Run a function over horizontal grid (latitude, longitude). .. py:method:: outputs()