Can we map a sensor output in esphome like we do with the Arduino IDE?

Hello, I was wondering if it is possible to map values like we do in the Arduino IDE?. ie. map an analog input of 0 to 1000 to an output range of 0 to 100.

I have a 3500 gallon cylindrical cistern (12’ x 7’) laying horizontally and I’m using a water flow sensor to calculate the water in gallons left in the cistern. It works well however the tank cross section area changes because the tank is circular. So the volume per foot is non-linear and get larger towards the 3.5’ half full level and smaller towards the bottom of the tank. I would like to show the water level in feet on the HA dashboard versus gallons left.

Could we just map the water level in feet to the tank volume in gallons or would we need to do calculations which seem rather complex?

Thanks.

Nice, so we can calibrate our sensors by mapping them. Thanks