Skip to content

Commit

Permalink
Round the values so we don't have ridiculous precision.
Browse files Browse the repository at this point in the history
  • Loading branch information
wtgee committed Sep 3, 2023
1 parent e526bde commit c73a474
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/aag/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ def get_reading(self, units: WhichUnits = 'none', get_errors: bool = False, avg_
units: The astropy units to return the reading in, default 'none',
can be 'metric' or 'imperial'.
get_errors: Whether to get the internal errors, default False.
avg_times: The number of times to average the readings, default 5.
avg_times: The number of times to average the readings, default 3.
Returns:
A dictionary of readings.
"""

def avg_times(fn, n=avg_times):
return sum(fn() for _ in range(n)) / n
return round(sum(fn() for _ in range(n)) / n, 3)

reading = {
'timestamp': datetime.now().isoformat(),
Expand Down

0 comments on commit c73a474

Please sign in to comment.