I have an array storing pressure coefficient values for each triangular face from a 3D geometry, and I am trying to obtain the RGB index values from a jet colormap based on the min and max from this array.
I have done this on Matlab like this
cmap = jet(40) * 255;
cvars_map = (cvar - min(cvar))/(max(cvar)-min(cvar)) * (40 - 1) + 1;
cvars_map = round(cvars_map);
cmap = cmap(cvars_map(1:end), :);
where cvar is the array storing the values.
How can I achieve this on Python? Ultimately I will write a PLY file for the geometry with the RGB values for each face.
We may use NumPy, the syntax is almost the same as MATLAB: