This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / 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) → Any

Summary

Convert from a temperature scale to another one among Celsius, Kelvin, Fahrenheit, and Rankine scales.

Parameters

val : array_like

Value(s) of the temperature(s) to be converted expressed in the original scale.

old_scale : str

Specifies 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 : str

Specifies 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 floats

Value(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

Referenced by