{ "cells": [ { "cell_type": "markdown", "id": "96af4827-258e-4d9b-abe1-2167c28df082", "metadata": {}, "source": [ "# Module - Data" ] }, { "cell_type": "code", "execution_count": 1, "id": "bad32b27-2cc2-4655-8059-d8c7d14323a2", "metadata": {}, "outputs": [], "source": [ "# Import to be able to import python package from src\n", "import sys\n", "sys.path.insert(0, '../../../src')" ] }, { "cell_type": "code", "execution_count": 2, "id": "7f4b4cf8-e3de-4409-a33e-3735ba67957f", "metadata": {}, "outputs": [], "source": [ "from ontime.module.datasets.dataset import Dataset" ] }, { "cell_type": "markdown", "id": "f63cfca5-f597-455b-ab74-0024231aa0e7", "metadata": {}, "source": [ "### Get dataset reference\n", "Available datasets are referenced as static variables of the DatasetLoader class. The variable is a tuple of (dataset object, source library)" ] }, { "cell_type": "code", "execution_count": 11, "id": "6e5d6c1d-040e-4f9a-a994-846b4643a1a1", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n" ] } ], "source": [ "ds = Dataset.GasRateCO2Dataset \n", "print(ds)" ] }, { "cell_type": "markdown", "id": "120ac9b5-fba3-4ccb-8980-f103b7fd959a", "metadata": {}, "source": [ "### Load the selected dataset" ] }, { "cell_type": "code", "execution_count": 12, "id": "15d5230a-ca36-4ca1-b4f2-d2fe47055057", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.LayerChart(...)" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ts = ds.load() #loaded as a TimeSeries\n", "ts.plot()" ] }, { "cell_type": "code", "execution_count": 16, "id": "d53a5170-5ca9-455f-bb48-9d3d5da13d59", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n" ] } ], "source": [ "ds2 = Dataset.HeartRateDataset \n", "print(ds2)" ] }, { "cell_type": "code", "execution_count": 17, "id": "3bafa241-e7e1-4c5b-926a-78d9987b5456", "metadata": {}, "outputs": [ { "data": { "text/html": [ "\n", "\n", "
\n", "" ], "text/plain": [ "alt.LayerChart(...)" ] }, "execution_count": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ts2 = ds2.load() #loaded as a TimeSeries\n", "ts2.plot()" ] } ], "metadata": { "kernelspec": { "display_name": "ontime-2OQVvbNf-py3.10", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.12" } }, "nbformat": 4, "nbformat_minor": 5 }