gemgis.visualization.convert_to_rgb
gemgis.visualization.convert_to_rgb#
- gemgis.visualization.convert_to_rgb(array: numpy.ndarray) numpy.ndarray #
Converting array values to RGB values
- Parameters
array (np.ndarray) – Array containing the different bands of a raster
- Returns
array_stacked – Array with converted array values to RGB values
- Return type
np.ndarray
New in version 1.0.x.
Example
>>> # Loading Libraries and showing predefined array >>> import gemgis as gg >>> import numpy as np >>> array array([[0.3647059 , 0.3647059 , 0.49411765], [0.40784314, 0.40784314, 0.52156866], [0.8901961 , 0.8901961 , 0.91764706], ..., [0.59607846, 0.69803923, 0.8 ], [0.627451 , 0.7372549 , 0.7882353 ], [0.80784315, 0.78431374, 0.70980394]], dtype=float32)
>>> # Inspecting shape of array >>> array.shape (2000, 2800, 3)
>>> # Converting to RGB array >>> array_stacked = gg.visualization.convert_to_rgb(array=array) >>> array_stacked array([[[ 93, 93, 126], [104, 104, 133], [227, 227, 234], ..., [152, 178, 204], [160, 188, 201], [206, 200, 181]], [[247, 246, 248], [241, 240, 246], [243, 241, 241], ..., [150, 177, 205], [175, 187, 177], [232, 228, 219]]], dtype=uint8)
>>> # Inspecting shape of array >>> array_stacked.shape (2000, 2800, 3)
See also
read_raster
Reading Digital Elevation Model as xarray
drape_array_over_dem
Draping an array of the Digital Elevation Model