Expand temperature calculators

This commit is contained in:
Codex
2026-03-07 21:25:13 +00:00
parent 16ca847d55
commit 006ae4fa06
3 changed files with 245 additions and 129 deletions

View File

@@ -71,8 +71,8 @@ def guess_category(name):
if any(x in name_l for x in ['watt', 'horsepower']): return 'power'
if any(x in name_l for x in ['byte', 'bit', 'nibble', 'baud']): return 'data'
if 'light' in name_l or any(x in name_l for x in ['lumen', 'lux', 'candela']): return 'light'
if any(x in name_l for x in ['degree', 'degrees', 'radian', 'radians', 'arcminute', 'arcminutes', 'arcsecond', 'arcseconds', 'gradian', 'gradians', 'mil', 'mils', 'quadrant', 'quadrants', 'sextant', 'sextants', 'turn', 'turns', 'points (compass', 'points-compass']): return 'angle'
if any(x in name_l for x in ['second', 'minute', 'hour', 'day', 'week', 'month', 'year']): return 'time'
if any(x in name_l for x in ['degree', 'radian', 'mil ', 'arc', 'gradian', 'quadrant']): return 'angle'
if any(x in name_l for x in ['binary', 'hex', 'octal', 'decimal', 'ascii', 'fraction']): return 'number-systems'
if any(x in name_l for x in ['becquerel', 'curie', 'gray', 'rad', 'sievert', 'rem', 'roentgen', 'rutherford']): return 'radiation'
if any(x in name_l for x in ['volt', 'amp', 'ohm', 'siemens', 'farad', 'henry', 'coulomb']): return 'electrical'
@@ -134,7 +134,7 @@ def process():
c_type = 'base'
elif 'Linear Offset' in factor_raw:
# "Linear Offset (1.8x + 32)"
m = re.search(r'Linear Offset \(([\d\./]+)x\s*([+-]\s*[\d\.]+)\)', factor_raw)
m = re.search(r'Linear Offset \(([-\d\./]+)x\s*([+-]\s*[\d\.]+)\)', factor_raw)
if m:
f_v = m.group(1)
# handle frac
@@ -143,7 +143,7 @@ def process():
factor_val = f_v
offset_val = o_v
else:
m2 = re.search(r'Linear Offset \(([\d\./]+)x\)', factor_raw)
m2 = re.search(r'Linear Offset \(([-\d\./]+)x\)', factor_raw)
if m2: factor_val = m2.group(1)
c_type = 'standard'
else: