epygram.geometries.AcademicGeometry
— Academic Geometry class¶
Contains the classes for 3D geometries of fields.
- class epygram.geometries.AcademicGeometry.AcademicGeometry(name, grid, dimensions, vcoordinate, projection, position_on_horizontal_grid='__unknown__', geoid=None)[source]¶
Bases:
epygram.geometries.AbstractGeometry.RectangularGridGeometry
Handles the geometry for an academic 3-Dimensions Field.
- Parameters
name – Name of geometrical type of representation of points on the Globe. Name must be ‘academic’
grid – Handles description of the horizontal grid.
dimensions – Handles grid dimensions.
vcoordinate – Handles vertical geometry parameters.
position_on_horizontal_grid –
Position of points w/r to the horizontal. among: [‘upper-right’, ‘upper-left’,
’lower-left’, ‘lower-right’, ‘center-left’, ‘center-right’, ‘lower-center’, ‘upper-center’, ‘center’, ‘__unknown__’]
geoid – To specify geoid shape (of no meaning in this geometry).
- default_cartopy_CRS()¶
Note
Requires plugin: with_cartopy (config.activate_plugins)
Create a cartopy.crs appropriate to the Geometry.
In this case, cartopy is not used but raw matplotlib, so returned CRS is None.
- distance(end1, end2)[source]¶
Computes the distance between two points along a straight line in the geometry. :param end1: must be a tuple (lon, lat) in degrees. :param end2: must be a tuple (lon, lat) in degrees.
- ij2ll(i, j, position=None)[source]¶
Return the (lon, lat) coordinates of point (i,j), in degrees.
- Parameters
i – X index of point in the 2D matrix of gridpoints
j – Y index of point in the 2D matrix of gridpoints
position – lat lon position to return with respect to the model cell. Defaults to self.position_on_horizontal_grid.
This routine has a special meaning for this geometry. It returns the (i, j) position in the original grid (especially after a section extraction) with an offset of one (for old tools compatibility).
- ij2xy(i, j, position=None)[source]¶
Return the (x, y) coordinates of point (i,j), in the projection.
- Parameters
i – X index of point in the 2D matrix of gridpoints
j – Y index of point in the 2D matrix of gridpoints
position – position to return with respect to the model cell. Defaults to self.position_on_horizontal_grid.
Note that origin of coordinates in projection is the center of the C+I domain.
- linspace(end1, end2, num)[source]¶
Returns evenly spaced points over the specified interval. Points are lined up in the geometry.
- Parameters
end1 – must be a tuple (lon, lat) in degrees.
end2 – must be a tuple (lon, lat) in degrees.
num – number of points, including point1 and point2.
- ll2ij(lon, lat, position=None)[source]¶
Return the (i, j) indexes of point (lon, lat) in degrees, in the 2D matrix of gridpoints.
- Parameters
lon – longitude of point in degrees
lat – latitude of point in degrees
position – lat lon position to return with respect to the model cell. Defaults to self.position_on_horizontal_grid.
Caution: the returned (i,j) are float.
This routine has a special meaning for this geometry. It returns the (lon, lat) position in the original grid (especially after a section extraction) with an offset of one (for old tools compatibility).
- ll2xy(lon, lat)[source]¶
Return the (x, y) coordinates of point (lon, lat) in degrees.
- Parameters
lon – longitude of point in degrees
lat – latitude of point in degrees
Note that origin of coordinates in projection is the center of the C+I domain.
- make_section_geometry(end1, end2, points_number=None, resolution=None, position=None)[source]¶
Returns a academic Geometry.
- Parameters
end1 – must be a tuple (lon, lat) in degrees.
end2 – must be a tuple (lon, lat) in degrees.
points_number – defines the total number of horizontal points of the section (including ends). If None, defaults to a number computed from the ends and the resolution.
resolution – defines the horizontal resolution to be given to the field. If None, defaults to the horizontal resolution of the field.
position – defines the position of data in the grid (defaults to ‘center’)
- plane_azimuth(end1, end2)[source]¶
Initial bearing from end1 to end2 points in plane local referential geometry.
- Parameters
end1 – must be a tuple (lon, lat) in degrees.
end2 – must be a tuple (lon, lat) in degrees.
- tolerant_equal(other, tolerance=2.220446049250313e-16)[source]¶
Test of equality by recursion on the object’s attributes, with a tolerance.
- xy2ij(x, y, position=None)[source]¶
Return the (i, j) indexes of point (x, y), in the 2D matrix of gridpoints.
- Parameters
x – X coordinate of point in the academic projection
y – Y coordinate of point in the academic projection
position – position to return with respect to the model cell. Defaults to self.position_on_horizontal_grid.
Caution: (i,j) are float (the nearest grid point is the nearest integer).
Note that origin of coordinates in projection is the center of the C+I domain.
- xy2ll(x, y)[source]¶
Return the (lon, lat) coordinates of point (x, y) in the 2D matrix of gridpoints*(i,j)*, in degrees.
- Parameters
x – X coordinate of point in the academic projection
y – Y coordinate of point in the academic projection
Note that origin of coordinates in projection is the center of the C+I domain.