uxarray.grid.geometry._get_latlonbox_width

uxarray.grid.geometry._get_latlonbox_width#

uxarray.grid.geometry._get_latlonbox_width(latlonbox_rad)#

Calculate the width of a latitude-longitude box in radians. The box should be represented by a 2x2 array in radians and lon0 represent the “left” side of the box. while lon1 represent the “right” side of the box.

This function computes the width of a given latitude-longitude box. It accounts for periodicity in the longitude direction.

Non-Periodic Longitude: This is the usual case where longitude values are considered within a fixed range,

typically between -180 and 180 degrees, or 0 and 360 degrees. Here, the longitude does not “wrap around” when it reaches the end of this range.

Periodic Longitude: In this case, the longitude is considered to wrap around the globe.

This means that if you have a longitude range from 350 to 10 degrees, it is understood to cross the 0-degree meridian and actually represents a 20-degree span (350 to 360 degrees, then 0 to 10 degrees).

Parameters:

latlonbox_rad (np.ndarray) – A latitude-longitude box represented by a 2x2 array in radians and lon0 represent the “left” side of the box. while lon1 represent the “right” side of the box: [[lat_0, lat_1], [lon_0, lon_1]].

Returns:

The width of the latitude-longitude box in radians.

Return type:

float

Raises:
  • Exception – If the input longitude range is invalid.

  • Warning – If the input longitude range is flagged as periodic but in the form [lon0, lon1] where lon0 < lon1. The function will automatically use the is_lon_periodic=False instead.