pytmosph3r.grid
Module Contents
- class Grid[source]
Bases:
pytmosph3r.log.logger.Logger
Standard logging using logger library
- Parameters:
name (str) – Name used for logging
- abstract property shape: Tuple
- property ndim
- class Grid3D(n_vertical: int | None = None, n_latitudes: int | None = None, n_longitudes: int | None = None, mid_latitudes: numpy.ndarray | None = None, mid_longitudes: numpy.ndarray | None = None)[source]
Bases:
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
mid_latitudes
andmid_longitudes
parameters. Note thatlatitudes
andlongitudes
are derived from these and return the boundaries of each cell of the grid.- Parameters:
n_vertical (int) – Number of vertical points in the grid.
n_latitudes (int) – Number of latitudinal points in the grid.
n_longitudes (int) – Number of longitudinal points in the grid.
- property regular_latitudes
- property to_east: bool
True if longitude is in increasing order.
- property to_north: bool
True if latitude is in increasing order.
- property shape: Tuple[int, int, int]
Shape of arrays in this grid.
- property latitudes: numpy.ndarray
Latitudinal boundaries (deduced from
mid_latitudes
).
- property positive_latitudes: numpy.ndarray
Positive latitudinal boundaries (deduced from
mid_latitudes
).
- property mid_latitudes: numpy.ndarray
Latitudes in the “middle” of each latitude box.
- property lat_angle
Angle between two latitudes.
- property longitudes: numpy.ndarray
Longitudinal boundaries (unique). Deduced from
mid_longitudes
.
- property half_longitudes
Half-list of longitudinal boundaries to avoid duplication. Deduced from
all_longitudes
.
- property all_longitudes: numpy.ndarray
Longitudinal boundaries (first longitude duplicated to make a full circle). Deduced from
longitudes
.
- property mid_longitudes: numpy.ndarray
List of longitudes (in the “middle” of each longitude box). By default, start at -Pi.
- property night_longitudes: 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.
- property day_longitudes: List
List of longitudinal indices on the day side. The day side is here defined as the second and third quarters of longitudinal indices.
- property lon_angle
Angle between two longitudes.
- index_colatitude(colatitude) int [source]
Returns index corresponding to an angle with the pole 0 (by convention, north).
- index_latitude(latitude) int [source]
Gives the index of the latitude interval containing a latitude (given in radians).
- index_longitude(longitude) int [source]
Gives the index of the longitude interval containing a longitude (given in radians).
- make_3D(obj: numpy.ndarray | dict, axis: List[int] | None = None) numpy.ndarray [source]
This function will try to transform
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.- Parameters:
obj (ndarray | dict) – 1, 2 or 3 dimensional array (or dict with such arrays).
axis (Optional[List[int]]) – Allow to choose the value of axis. Use [0] to set a 1D pressure
or temperature array seen as an atmospheric column to a 3D one.
- Returns:
3D array (or dict with 3D arrays).
- Return type:
(ndarray | dict)