bundles / scipy latest / scipy / constants / _constants / convert_temperature
function
scipy.constants._constants:convert_temperature
source: build-install/usr/lib/python3.14/site-packages/scipy/constants/_constants.py:228
Signature
def convert_temperature(val: npt.ArrayLike, old_scale: str, new_scale: str) → AnySummary
Convert from a temperature scale to another one among Celsius, Kelvin, Fahrenheit, and Rankine scales.
Parameters
val: array_likeValue(s) of the temperature(s) to be converted expressed in the original scale.
old_scale: strSpecifies as a string the original scale from which the temperature value(s) will be converted. Supported scales are Celsius ('Celsius', 'celsius', 'C' or 'c'), Kelvin ('Kelvin', 'kelvin', 'K', 'k'), Fahrenheit ('Fahrenheit', 'fahrenheit', 'F' or 'f'), and Rankine ('Rankine', 'rankine', 'R', 'r').
new_scale: strSpecifies as a string the new scale to which the temperature value(s) will be converted. Supported scales are Celsius ('Celsius', 'celsius', 'C' or 'c'), Kelvin ('Kelvin', 'kelvin', 'K', 'k'), Fahrenheit ('Fahrenheit', 'fahrenheit', 'F' or 'f'), and Rankine ('Rankine', 'rankine', 'R', 'r').
Returns
res: float or array of floatsValue(s) of the converted temperature(s) expressed in the new scale.
Notes
Examples
from scipy.constants import convert_temperature import numpy as np✓
convert_temperature(np.array([-40, 40]), 'Celsius', 'Kelvin')
✗array([233.15, 313.15])
Aliases
scipy.constants.convert_temperature