Skip to content

Commit

Permalink
Fix for voltage data gaps
Browse files Browse the repository at this point in the history
  • Loading branch information
aguinane committed Jul 18, 2024
1 parent eea21a5 commit 0f3827f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
6 changes: 6 additions & 0 deletions nemreader/split_days.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ def make_set_interval(

if r.uom and r.uom[-1].lower() == "h":
grp_value = sum([x.read_value for x in grp_readings])
elif r.uom and r.uom[-1].lower() == "v":
# Exclude zero values to avoid ~120V when averaging 0 and 240 V
voltages = [x.read_value for x in grp_readings if x.read_value]
if not voltages: # If all zero then that is okay
voltages = [x.read_value for x in grp_readings]
grp_value = mean(voltages)
else:
grp_value = mean([x.read_value for x in grp_readings])

Expand Down
16 changes: 8 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ click==8.1.7
# typer
click-default-group==1.2.4
# via sqlite-utils
coverage==7.5.3
coverage==7.6.0
# via pytest-cov
exceptiongroup==1.2.1
exceptiongroup==1.2.2
# via pytest
iniconfig==2.0.0
# via pytest
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
mypy==1.10.0
mypy==1.10.1
mypy-extensions==1.0.0
# via mypy
numpy==1.26.4
numpy==2.0.0
# via pandas
packaging==24.0
packaging==24.1
# via pytest
pandas==2.2.2
pluggy==1.5.0
Expand All @@ -31,7 +31,7 @@ pluggy==1.5.0
# sqlite-utils
pygments==2.18.0
# via rich
pytest==8.2.1
pytest==8.2.2
# via pytest-cov
pytest-cov==5.0.0
python-dateutil==2.9.0.post0
Expand All @@ -42,7 +42,7 @@ pytz==2024.1
# via pandas
rich==13.7.1
# via typer
ruff==0.4.6
ruff==0.5.2
shellingham==1.5.4
# via typer
six==1.16.0
Expand All @@ -58,7 +58,7 @@ tomli==2.0.1
# mypy
# pytest
typer==0.12.3
typing-extensions==4.12.0
typing-extensions==4.12.2
# via
# mypy
# typer
Expand Down

0 comments on commit 0f3827f

Please sign in to comment.