uxarray.grid.geometry._populate_face_latlon_bound

uxarray.grid.geometry._populate_face_latlon_bound#

uxarray.grid.geometry._populate_face_latlon_bound(face_edges_cartesian, face_edges_lonlat_rad, is_latlonface=False, is_GCA_list=None)#

Populates the bounding box for each face in the grid by evaluating the geographical bounds based on the Cartesian and latitudinal/longitudinal edge connectivity. This function also considers the presence of pole points within the face’s bounds and adjusts the bounding box accordingly.

Parameters:
  • face_edges_cartesian (np.ndarray, shape (n_edges, 2, 3)) – An array holding the Cartesian coordinates for the edges of a face, where n_edges is the number of edges for the specific face. Each edge is represented by two points (start and end), and each point is a 3D vector (x, y, z) in Cartesian coordinates.

  • face_edges_lonlat_connectivity_rad (np.ndarray, shape (n_edges, 2, 2)) – An array holding the longitude and latitude in radians for the edges of a face, formatted similarly to face_edges_cartesian. Each edge’s start and end points are represented by their longitude and latitude values in radians.

  • is_latlonface (bool, optional) – A flag indicating if the current face is a latitudinal/longitudinal (latlon) face, meaning its edges align with lines of constant latitude or longitude. If True, edges are treated as following constant latitudinal or longitudinal lines. If False, edges are considered as great circle arcs (GCA). Default is False.

  • is_GCA_list (list or np.ndarray, optional) – A list or an array of boolean values corresponding to each edge within the face, indicating whether the edge is a GCA. If None, the determination of whether an edge is a GCA or a constant latitudinal/longitudinal line is based on is_latlonface. Default is None.

Returns:

face_latlon_array – An array representing the bounding box for the face in latitude and longitude coordinates (in radians). The first row contains the minimum and maximum latitude values, while the second row contains the minimum and maximum longitude values.

Return type:

np.ndarray, shape (2, 2)

Notes

This function evaluates the presence of North or South pole points within the face’s bounds by inspecting the Cartesian coordinates of the face’s edges. It then constructs the face’s bounding box by considering the extreme latitude and longitude values found among the face’s edges, adjusting for the presence of pole points as necessary.

The bounding box is used to determine the face’s geographical extent and is crucial for spatial analyses involving the grid.

Example

Assuming the existence of a grid face with edges defined in both Cartesian and latitudinal/longitudinal coordinates:

face_edges_cartesian = np.array([…]) # Cartesian coords face_edges_connectivity_rad = np.array([…]) # Lon/Lat coords in radians

Populate the bounding box for the face, treating it as a latlon face:

face_latlon_bound = _populate_face_latlon_bound(face_edges_cartesian,

face_edges_lonlat_connectivity_rad, is_latlonface=True)