diff --git a/beer/extras.py b/beer/extras.py index 9069ffe..1d120c0 100644 --- a/beer/extras.py +++ b/beer/extras.py @@ -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))