Skip to content
Snippets Groups Projects
Verified Commit 1f0620ca authored by Ruben van Dijk's avatar Ruben van Dijk
Browse files

Initial commit.

parents
Branches
No related tags found
No related merge requests found
Pipeline #13354 failed
.gitlab-ci.yml
Dockerfile
.gitignore
*.iml
.idea
output
.idea
*.iml
output
include:
- project: internal/templates
file: templates.yml
FROM python as builder
WORKDIR /app
RUN curl -sSL https://install.python-poetry.org | POETRY_HOME=/app/.poetry python3 -
ENV PATH="/app/.poetry/bin:${PATH}"
COPY pyproject.toml poetry.lock ./
RUN poetry install
COPY . .
RUN poetry run python3 generate.py
FROM halverneus/static-file-server:latest
WORKDIR /web
COPY --from=builder /app/output/* ./
import mpld3
import pandas as pd
import matplotlib.pyplot as plt
from mpld3 import plugins
#"off":"dicht", 'on':"open"
df = pd.read_csv(r"input/input.csv")
df['datetime'] = pd.to_datetime(df['datetime'])
raam = df[df['metadata_id'] == 420].drop(columns='metadata_id')
raam = raam.set_index(raam['datetime'])
raam['RaamDicht'] = raam['state'].replace({"off": True, 'on': False})
raam = raam['RaamDicht']
co2 = df[df['metadata_id'] == 2269].drop(columns='metadata_id')
co2['state'] = co2['state'].astype(int)
co2 = co2.set_index(co2['datetime'])
co2 = co2['state'].sort_index()
import matplotlib.dates as mdates
format_wekelijks = mdates.DateFormatter('%a %d %b')
format_dagelijks = mdates.DateFormatter("%d")
fig, axs = plt.subplots(2, sharex=True, gridspec_kw={'height_ratios': [2, 1]})
for ax in axs:
ax.xaxis.set_major_locator(mdates.DayLocator(interval=7))
ax.xaxis.set_major_formatter(format_wekelijks)
ax.xaxis.set_minor_locator(mdates.DayLocator(interval=1))
ax.xaxis.set_minor_formatter(format_dagelijks)
ax.set_xlim(left=co2.index[0], right=co2.index[-1])
co2.plot(figsize=(9, 4), ax=axs[0], ylabel='Co2', xlabel='')
raam.astype(float).plot(figsize=(9, 4), ax=axs[1],
ylabel='Raam Dicht', drawstyle='steps-post', xlabel="")
plugins.connect(fig, plugins.MousePosition())
html_str = mpld3.fig_to_html(fig)
Html_file = open("output/all.html", "w")
Html_file.write(html_str)
Html_file.close()
This diff is collapsed.
[[package]]
name = "contourpy"
version = "1.2.1"
description = "Python library for calculating contours of 2D quadrilateral grids"
category = "main"
optional = false
python-versions = ">=3.9"
[package.dependencies]
numpy = ">=1.20"
[package.extras]
docs = ["furo", "sphinx (>=7.2)", "sphinx-copybutton"]
bokeh = ["bokeh", "selenium"]
mypy = ["contourpy", "docutils-stubs", "mypy (==1.8.0)", "types-pillow"]
test = ["contourpy", "matplotlib", "pillow"]
test-no-images = ["pytest", "pytest-cov", "pytest-xdist", "wurlitzer"]
[[package]]
name = "cycler"
version = "0.12.1"
description = "Composable style cycles"
category = "main"
optional = false
python-versions = ">=3.8"
[package.extras]
docs = ["ipython", "matplotlib", "numpydoc", "sphinx"]
tests = ["pytest", "pytest-cov", "pytest-xdist"]
[[package]]
name = "fonttools"
version = "4.51.0"
description = "Tools to manipulate font files"
category = "main"
optional = false
python-versions = ">=3.8"
[package.extras]
all = ["fs (>=2.2.0,<3)", "lxml (>=4.0)", "zopfli (>=0.1.4)", "lz4 (>=1.7.4.2)", "pycairo", "matplotlib", "sympy", "skia-pathops (>=0.5.0)", "uharfbuzz (>=0.23.0)", "brotlicffi (>=0.8.0)", "scipy", "brotli (>=1.0.1)", "munkres", "unicodedata2 (>=15.1.0)", "xattr"]
graphite = ["lz4 (>=1.7.4.2)"]
interpolatable = ["pycairo", "scipy", "munkres"]
lxml = ["lxml (>=4.0)"]
pathops = ["skia-pathops (>=0.5.0)"]
plot = ["matplotlib"]
repacker = ["uharfbuzz (>=0.23.0)"]
symfont = ["sympy"]
type1 = ["xattr"]
ufo = ["fs (>=2.2.0,<3)"]
unicode = ["unicodedata2 (>=15.1.0)"]
woff = ["zopfli (>=0.1.4)", "brotlicffi (>=0.8.0)", "brotli (>=1.0.1)"]
[[package]]
name = "jinja2"
version = "3.1.4"
description = "A very fast and expressive template engine."
category = "main"
optional = false
python-versions = ">=3.7"
[package.dependencies]
MarkupSafe = ">=2.0"
[package.extras]
i18n = ["Babel (>=2.7)"]
[[package]]
name = "kiwisolver"
version = "1.4.5"
description = "A fast implementation of the Cassowary constraint solver"
category = "main"
optional = false
python-versions = ">=3.7"
[[package]]
name = "markupsafe"
version = "2.1.5"
description = "Safely add untrusted strings to HTML/XML markup."
category = "main"
optional = false
python-versions = ">=3.7"
[[package]]
name = "matplotlib"
version = "3.8.4"
description = "Python plotting package"
category = "main"
optional = false
python-versions = ">=3.9"
[package.dependencies]
contourpy = ">=1.0.1"
cycler = ">=0.10"
fonttools = ">=4.22.0"
kiwisolver = ">=1.3.1"
numpy = ">=1.21"
packaging = ">=20.0"
pillow = ">=8"
pyparsing = ">=2.3.1"
python-dateutil = ">=2.7"
[[package]]
name = "mpld3"
version = "0.5.10"
description = "D3 Viewer for Matplotlib"
category = "main"
optional = false
python-versions = "*"
[package.dependencies]
jinja2 = "*"
matplotlib = "*"
[[package]]
name = "numpy"
version = "1.26.4"
description = "Fundamental package for array computing in Python"
category = "main"
optional = false
python-versions = ">=3.9"
[[package]]
name = "packaging"
version = "24.0"
description = "Core utilities for Python packages"
category = "main"
optional = false
python-versions = ">=3.7"
[[package]]
name = "pandas"
version = "2.2.2"
description = "Powerful data structures for data analysis, time series, and statistics"
category = "main"
optional = false
python-versions = ">=3.9"
[package.dependencies]
numpy = [
{version = ">=1.22.4", markers = "python_version < \"3.11\""},
{version = ">=1.23.2", markers = "python_version == \"3.11\""},
{version = ">=1.26.0", markers = "python_version >= \"3.12\""},
]
python-dateutil = ">=2.8.2"
pytz = ">=2020.1"
tzdata = ">=2022.7"
[package.extras]
test = ["hypothesis (>=6.46.1)", "pytest (>=7.3.2)", "pytest-xdist (>=2.2.0)"]
pyarrow = ["pyarrow (>=10.0.1)"]
performance = ["bottleneck (>=1.3.6)", "numba (>=0.56.4)", "numexpr (>=2.8.4)"]
computation = ["scipy (>=1.10.0)", "xarray (>=2022.12.0)"]
fss = ["fsspec (>=2022.11.0)"]
aws = ["s3fs (>=2022.11.0)"]
gcp = ["gcsfs (>=2022.11.0)", "pandas-gbq (>=0.19.0)"]
excel = ["odfpy (>=1.4.1)", "openpyxl (>=3.1.0)", "python-calamine (>=0.1.7)", "pyxlsb (>=1.0.10)", "xlrd (>=2.0.1)", "xlsxwriter (>=3.0.5)"]
parquet = ["pyarrow (>=10.0.1)"]
feather = ["pyarrow (>=10.0.1)"]
hdf5 = ["tables (>=3.8.0)"]
spss = ["pyreadstat (>=1.2.0)"]
postgresql = ["SQLAlchemy (>=2.0.0)", "psycopg2 (>=2.9.6)", "adbc-driver-postgresql (>=0.8.0)"]
mysql = ["SQLAlchemy (>=2.0.0)", "pymysql (>=1.0.2)"]
sql-other = ["SQLAlchemy (>=2.0.0)", "adbc-driver-postgresql (>=0.8.0)", "adbc-driver-sqlite (>=0.8.0)"]
html = ["beautifulsoup4 (>=4.11.2)", "html5lib (>=1.1)", "lxml (>=4.9.2)"]
xml = ["lxml (>=4.9.2)"]
plot = ["matplotlib (>=3.6.3)"]
output-formatting = ["jinja2 (>=3.1.2)", "tabulate (>=0.9.0)"]
clipboard = ["PyQt5 (>=5.15.9)", "qtpy (>=2.3.0)"]
compression = ["zstandard (>=0.19.0)"]
consortium-standard = ["dataframe-api-compat (>=0.1.7)"]
all = ["adbc-driver-postgresql (>=0.8.0)", "adbc-driver-sqlite (>=0.8.0)", "beautifulsoup4 (>=4.11.2)", "bottleneck (>=1.3.6)", "dataframe-api-compat (>=0.1.7)", "fastparquet (>=2022.12.0)", "fsspec (>=2022.11.0)", "gcsfs (>=2022.11.0)", "html5lib (>=1.1)", "hypothesis (>=6.46.1)", "jinja2 (>=3.1.2)", "lxml (>=4.9.2)", "matplotlib (>=3.6.3)", "numba (>=0.56.4)", "numexpr (>=2.8.4)", "odfpy (>=1.4.1)", "openpyxl (>=3.1.0)", "pandas-gbq (>=0.19.0)", "psycopg2 (>=2.9.6)", "pyarrow (>=10.0.1)", "pymysql (>=1.0.2)", "PyQt5 (>=5.15.9)", "pyreadstat (>=1.2.0)", "pytest (>=7.3.2)", "pytest-xdist (>=2.2.0)", "python-calamine (>=0.1.7)", "pyxlsb (>=1.0.10)", "qtpy (>=2.3.0)", "scipy (>=1.10.0)", "s3fs (>=2022.11.0)", "SQLAlchemy (>=2.0.0)", "tables (>=3.8.0)", "tabulate (>=0.9.0)", "xarray (>=2022.12.0)", "xlrd (>=2.0.1)", "xlsxwriter (>=3.0.5)", "zstandard (>=0.19.0)"]
[[package]]
name = "pillow"
version = "10.3.0"
description = "Python Imaging Library (Fork)"
category = "main"
optional = false
python-versions = ">=3.8"
[package.extras]
docs = ["furo", "olefile", "sphinx (>=2.4)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinx-removed-in", "sphinxext-opengraph"]
fpx = ["olefile"]
mic = ["olefile"]
tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "packaging", "pyroma", "pytest", "pytest-cov", "pytest-timeout"]
typing = ["typing-extensions"]
xmp = ["defusedxml"]
[[package]]
name = "pyparsing"
version = "3.1.2"
description = "pyparsing module - Classes and methods to define and execute parsing grammars"
category = "main"
optional = false
python-versions = ">=3.6.8"
[package.extras]
diagrams = ["railroad-diagrams", "jinja2"]
[[package]]
name = "python-dateutil"
version = "2.9.0.post0"
description = "Extensions to the standard Python datetime module"
category = "main"
optional = false
python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,>=2.7"
[package.dependencies]
six = ">=1.5"
[[package]]
name = "pytz"
version = "2024.1"
description = "World timezone definitions, modern and historical"
category = "main"
optional = false
python-versions = "*"
[[package]]
name = "six"
version = "1.16.0"
description = "Python 2 and 3 compatibility utilities"
category = "main"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*"
[[package]]
name = "tzdata"
version = "2024.1"
description = "Provider of IANA time zone data"
category = "main"
optional = false
python-versions = ">=2"
[metadata]
lock-version = "1.1"
python-versions = "^3.10"
content-hash = "3a725fc91fadf54e5a40d73173fe3412387e531beece90b0ab8966754fff7fa8"
[metadata.files]
contourpy = []
cycler = []
fonttools = []
jinja2 = []
kiwisolver = []
markupsafe = []
matplotlib = []
mpld3 = []
numpy = []
packaging = []
pandas = []
pillow = []
pyparsing = []
python-dateutil = []
pytz = []
six = []
tzdata = []
[tool.poetry]
name = "co2-visualizer"
version = "0.1.0"
description = ""
authors = ["Ruben <co2project@rubend.nl>", "Berinda"]
[tool.poetry.dependencies]
python = "^3.10"
matplotlib = "^3.8.4"
pandas = "^2.2.2"
mpld3 = "^0.5.10"
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment