GridWorld.get_area_altitude#

GridWorld.get_area_altitude(area)[source]#

Get the altitude of each state in one area.

Parameters:

area (int or str) – Index or name of the area to get its state altitude.

Returns:

altitude_matrix – Altitude matrix of the area with index area_idx. Each element in the matrix corresponds to the altitude of one state in the area.

Return type:

numpy.ndarray

Examples

>>> W = GridWorld()
>>> W.add_area((3, 5))
>>> W.add_area((3, 5), name="Right")
>>> mat = np.ones((3, 5))
>>> W.set_altitude(1, altitude_mat=mat)
>>> W.get_area_altitude(1)
array([[1., 1., 1., 1., 1.],
       [1., 1., 1., 1., 1.],
       [1., 1., 1., 1., 1.]])
>>> W.get_area_altitude("Right")
array([[0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0.],
       [0., 0., 0., 0., 0.]])