Operations on geographical grid

octant.grid.cell_centres(bounds, bound_position=0.5)[source]

Calculate coordinate cell centres.

Inspired by SciTools iris package.

Parameters
  • bounds (numpy.array) – One-dimensional array of cell boundaries of shape (M,)

  • bound_position (bool, optional) – The desired position of the bounds relative to the position of the points.

Returns

centres – Array of shape (M+1,)

Return type

numpy.array

Examples

>>> a = np.arange(-1, 3., 1.)
>>> a
array([-1,  0,  1,  2])
>>> cell_centres(a)
array([-0.5,  0.5,  1.5])
octant.grid.cell_bounds(points, bound_position=0.5)[source]

Calculate coordinate cell boundaries.

Inspired by SciTools iris package.

Parameters
  • points (numpy.array) – One-dimensional array of uniformy spaced values of shape (M,)

  • bound_position (bool, optional) – The desired position of the bounds relative to the position of the points.

Returns

bounds – Array of shape (M+1,)

Return type

numpy.array

Examples

>>> a = np.arange(-1, 2.5, 0.5)
>>> a
array([-1. , -0.5,  0. ,  0.5,  1. ,  1.5,  2. ])
>>> cell_bounds(a)
array([-1.25, -0.75, -0.25,  0.25,  0.75,  1.25,  1.75,  2.25])
octant.grid.grid_cell_areas(lon1d, lat1d, r_planet=6371009.0)[source]

Simplified iris function to calculate grid cell areas.