uxarray.grid.geometry._insert_pt_in_latlonbox

uxarray.grid.geometry._insert_pt_in_latlonbox#

uxarray.grid.geometry._insert_pt_in_latlonbox(old_box, new_pt, is_lon_periodic=True)#

Update the latitude-longitude box to include a new point in radians.

This function compares the new point’s latitude and longitude with the existing latitude-longitude box and updates the box if necessary to include the new point.

Parameters:
  • old_box (np.ndarray) – The original latitude-longitude box in radian, a 2x2 array: [min_lat, max_lat],[left_lon, right_lon]].

  • new_pt (np.ndarray) – The new latitude-longitude point in radian, an array: [lat, lon].

  • is_lon_periodic (bool, optional) – Flag indicating if the latitude-longitude box is periodic in longitude (default is True).

Returns:

Updated latitude-longitude box including the new point in radians.

Return type:

np.ndarray

Raises:

Exception – If logic errors occur in the calculation process.

Examples

>>> _insert_pt_in_latlonbox(np.array([[1.0, 2.0], [3.0, 4.0]]),np.array([1.5, 3.5]))
array([[1.0, 2.0], [3.0, 4.0]])