Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pywws.livelog crashed with math domain error. Impossible to relaunch. #113

Open
pablus opened this issue Sep 4, 2023 · 1 comment
Open

Comments

@pablus
Copy link

pablus commented Sep 4, 2023

livelog crashed with this error:

File "/usr/local/lib/python3.9/dist-packages/pywws/conversions.py",
line 199, in dew_point
gamma = ((a * temp) / (b + temp)) + math.log(float(hum) / 100)
ValueError: math domain error

When this happened, every time we tried to relaunch the program it failed with the same error message. Somehow, it seems that hum took a value of zero, hence the math domain error of the logarithm.

To work around the problem we have locally changed line 195 of conversion.py to:

if temp is None or hum is None or hum == 0:

Weather station model is PCE-FWS 20N. pywws-version is 23.2.0. It is running on a Raspberry Pi.

@jim-easterbrook
Copy link
Owner

A humidity value of zero is invalid, so ideally you need to find it in your data and remove it.

If it happens a lot with your station you could deal with it in a user calibration module:

class Calib(object):
    def calib(self, raw):
        result = dict(raw)
        if not (result['hum_in'] and result['hum_in'] >= 20):
            result['hum_in'] = None
        if not (result['hum_out'] and result['hum_out'] >= 20):
            result['hum_out'] = None
        return result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants