SG and Plato conversion calcs.

This commit is contained in:
Chris Giacofei 2024-06-25 14:48:59 -04:00
parent 1d830eb22d
commit 07c881bdfe

View File

@ -86,3 +86,12 @@ def get_batches(api_user, api_key, batch=''):
data = data + get_batches(batch=last_id)
return data
def sg_plato(sg):
"""Convert specific gravtiy to °P."""
sg = float(sg)
return (-1*616.868) + (1111.14*sg) - (630.272*sg**2) + (135.997*sg**3)
def plato_sg(plato):
"""Convert °P to specific gravtiy."""
return 1 + (plato / (258.6 - (plato/258.2) * 227.1))