In memory texture in python

I’m doing some visualization of scientific data, and I want to dynamically change a cylinder’s material based on some temperature data. What I plan on doing is to set the vertex color from a cold to hot color lookup table, and I’d like to set the emit based on temperature as well. Easy enough to do with a 1D texture. The temperature is a function of the Z-coord along the cylinder. I’m hoping that I can generate the textures in python (as opposed to pre-generate them and save to disk). Is this possible? I’m pretty new to Blender, and my attempts at googling didn’t shed any light on the topic.

Thanks.