{
"cells": [
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00000-a14710bb-0646-4bbc-bd8f-38596c0b34f2",
"deepnote_cell_type": "markdown"
},
"source": [
"# Wind Farms Dataset Quick Start \n",
"\n",
"Version 0.9\n",
"\n",
"The Wind Farms is an Academic Hub dataset hosted by the OSIsoft Cloud Service (OCS, https://www.osisoft.com/solutions/cloud/vision/), a cloud-native real-time data infrastructure used to perform enterprise-wide analytics using tools and languages of the user's choice. \n",
"\n",
"
\n",
"\n",
"**Raw operational data has specific characteristics making it difficult to deal with directly**, among them:\n",
"\n",
"* variable data collection frequencies\n",
"* bad values (system error codes)\n",
"* data gaps \n",
"\n",
"\n",
"**But data science projects using operational data needs to be:**\n",
"\n",
"* **Time-aligned** to deal with the characteritics above in consistent way according to the data type (e.g. interpolation for float values, repeat last good value for categorical data, etc)\n",
"* **Context aware** so that the data can be understandable, across as many real-world assets that you need it for\n",
"* **Shaped and filtered** to ensure you have the data you need, in the form you need it\n",
"\n",
"**The OCS solutions for application-ready data are Data Views:**\n",
"\n",
"\n",
"\n",
"**Each Academic Hub datasets comes endowed with a set of asset-centric data views.** \n",
"\n",
"The goal of Academic Hub Python library is to provide a very generic and consistent way to access:\n",
"\n",
"* the list of existing datasets\n",
"* for a given dataset:\n",
" * the list of its assets\n",
" * the OCS namespace where the dataset is hosted\n",
"* for a given asset, the list of data views it belongs to\n",
"\n",
"\n",
"The rest of this notebook is a working example of the functionality listed above for the Wind Farms dataset\n",
"
\n"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00001-95c9d03b-be21-49f3-bd77-d810b012d652",
"deepnote_cell_type": "markdown"
},
"source": [
"## Install Academic Hub Python library "
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"cell_id": "00002-66950a56-8cfe-4c5e-9044-e7b80abd14c3",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 2785,
"execution_start": 1620772990164,
"source_hash": "5264110c",
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Requirement already satisfied: ocs-academic-hub==0.97.0 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (0.97.0)\n",
"Requirement already satisfied: pandas>=0.24.2 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from ocs-academic-hub==0.97.0) (1.1.4)\n",
"Requirement already satisfied: python-dateutil>=2.8.0 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from ocs-academic-hub==0.97.0) (2.8.1)\n",
"Requirement already satisfied: numpy in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from ocs-academic-hub==0.97.0) (1.19.4)\n",
"Requirement already satisfied: backoff in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from ocs-academic-hub==0.97.0) (1.10.0)\n",
"Requirement already satisfied: gql in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from ocs-academic-hub==0.97.0) (2.0.0)\n",
"Requirement already satisfied: typeguard>=2.4.1 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from ocs-academic-hub==0.97.0) (2.10.0)\n",
"Requirement already satisfied: ocs-sample-library-hub==0.1.18 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from ocs-academic-hub==0.97.0) (0.1.18)\n",
"Requirement already satisfied: pytz>=2017.2 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from pandas>=0.24.2->ocs-academic-hub==0.97.0) (2020.4)\n",
"Requirement already satisfied: six>=1.5 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from python-dateutil>=2.8.0->ocs-academic-hub==0.97.0) (1.15.0)\n",
"Requirement already satisfied: promise<3,>=2.3 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from gql->ocs-academic-hub==0.97.0) (2.3)\n",
"Requirement already satisfied: graphql-core<3,>=2.3.2 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from gql->ocs-academic-hub==0.97.0) (2.3.2)\n",
"Requirement already satisfied: requests<3,>=2.12 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from gql->ocs-academic-hub==0.97.0) (2.25.1)\n",
"Requirement already satisfied: rx<2,>=1.6 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from graphql-core<3,>=2.3.2->gql->ocs-academic-hub==0.97.0) (1.6.1)\n",
"Requirement already satisfied: certifi>=2017.4.17 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from requests<3,>=2.12->gql->ocs-academic-hub==0.97.0) (2020.11.8)\n",
"Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from requests<3,>=2.12->gql->ocs-academic-hub==0.97.0) (1.25.11)\n",
"Requirement already satisfied: chardet<5,>=3.0.2 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from requests<3,>=2.12->gql->ocs-academic-hub==0.97.0) (3.0.4)\n",
"Requirement already satisfied: idna<3,>=2.5 in c:\\users\\cfoisy\\anaconda3\\envs\\datapump\\lib\\site-packages (from requests<3,>=2.12->gql->ocs-academic-hub==0.97.0) (2.10)\n"
]
}
],
"source": [
"!pip install ocs-academic-hub==0.97.0"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00003-97d5b8a0-24aa-434b-a318-bc71f3aa98a4",
"deepnote_cell_type": "markdown"
},
"source": [
"## [Optional] Use the `pip uninstall` only in case of library issues"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"cell_id": "00004-0fe2654d-2708-4d0a-8b2c-1070b0718613",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 2,
"execution_start": 1620772992953,
"source_hash": "93345d6b",
"tags": []
},
"outputs": [],
"source": [
"# It's sometimes necessary to uninstall previous versions, uncomment and run the following line. \n",
"# Then restart kernel and reinstall with previous cell\n",
"# !pip uninstall -y ocs-academic-hub ocs-sample-library-preview"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00005-9db2e4b1-a323-4fcc-b61c-9ceb15717f5e",
"deepnote_cell_type": "markdown"
},
"source": [
"## Import HubClient, necessary to connect and interact with OCS"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {
"cell_id": "00006-9573ed9d-c2e7-4ba6-b14c-9688127142af",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 451,
"execution_start": 1620772992960,
"source_hash": "3e9edd1a"
},
"outputs": [],
"source": [
"from ocs_academic_hub import HubClient"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00007-6e6d1059-e493-4559-882b-91bd5cea010b",
"deepnote_cell_type": "markdown"
},
"source": [
"## Running the following cell initiate the login sequence\n",
"\n",
"**Warning:** a new brower tab will open offering the choice of identifying with Microsoft or Google. You should always pick Google:\n",
"
\n",
"\n",
"Return to this web page when done"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"cell_id": "00008-ba3deb68-cabb-4417-bc67-41ff9ca27aff",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 386,
"execution_start": 1620772993415,
"source_hash": "6437a418",
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Step 1: Get OAuth endpoint configuration...\n",
"Step 2: Set up server to process authorization response...\n",
"Step 3: Authorize the user...\n",
"Step 4: Set server to handle one request...\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"127.0.0.1 - - [11/May/2021 19:12:18] \"GET /callback.html?code=A09BB4059EF2838A36448D6888253383E39C213B90534CE2377A26297234C983&scope=openid%20ocsapi&session_state=nYKcABwOYHuOagIpY0PLBsmaf4rujWx9LeMlpfsNxrE.F226FA877176F741425BE4FD0A40B17D HTTP/1.1\" 200 -\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Step 5: Get a token using the authorization code...\n",
"Step 6: Access token read ok\n",
"Complete!\n",
"@ Hub data file: hub_datasets.json\n"
]
}
],
"source": [
"# remove env line before publication\n",
"# %env OCS_HUB_CONFIG=config.txt\n",
"hub = HubClient()"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00009-8b31a611-80e1-402f-882b-d2bd8c259ea1",
"deepnote_cell_type": "markdown"
},
"source": [
"## Refresh datasets information\n",
"\n",
"Over time existing datasets are updated and new ones are added. The cell below makes sure you have the latest version of the production datasets. \n",
"\n",
"Note: after execution of this method, a file named `hub_datasets.json` will be created in the same directory as this notebook. The data in this file supersedes the one built-in with the `ocs_academic_hub` module. To get back to the built-in datasets information, move/rename/delete `hub_datasets.json`. "
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"cell_id": "00010-0c8d6f40-0ba6-4e21-af97-8a65af41b828",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 4613,
"execution_start": 1620772993806,
"source_hash": "dd92b3c8",
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"@ Hub data file: hub_datasets.json\n",
"@ Current dataset: Brewery\n"
]
}
],
"source": [
"# remove experiment+additional_status options before publication\n",
"hub.refresh_datasets(experimental=True, additional_status=\"agl\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00011-38f6136e-9843-4995-885b-4f5f00eb127c",
"deepnote_cell_type": "markdown"
},
"source": [
"## Get list of published hub datasets\n"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {
"cell_id": "00012-becfb7c1-bf51-499f-a887-c5e680b5d0a9",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 42,
"execution_start": 1620772998420,
"source_hash": "83f8b25d"
},
"outputs": [
{
"data": {
"text/plain": [
"['Brewery', 'Campus_Energy', 'Pilot_Plant', 'Wind_Farms']"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"hub.datasets()"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00013-94f8ff34-a0a0-4771-a464-737db06ee1ec",
"deepnote_cell_type": "markdown"
},
"source": [
"## Display current active dataset\n",
"\n",
"The default dataset is Brewery. Only one dataset can be active. "
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"cell_id": "00014-45dbe114-ced2-4319-8e7d-87298b3e4407",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 41,
"execution_start": 1620772998427,
"source_hash": "5cd9c7fc"
},
"outputs": [
{
"data": {
"text/plain": [
"'Brewery'"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"hub.current_dataset()"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00015-ca2438cc-5073-4f80-a9fa-f2473f030941",
"deepnote_cell_type": "markdown"
},
"source": [
"## Set Wind Farms as the current dataset"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"cell_id": "00016-2d13986f-0227-4a36-af21-986354769172",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 0,
"execution_start": 1620772998439,
"source_hash": "796a3a8e"
},
"outputs": [],
"source": [
"hub.set_dataset(\"Wind_Farms\")"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00017-c7aecf19-0723-482c-b038-e6501c1f027b",
"deepnote_cell_type": "markdown"
},
"source": [
"## Verify that Wind Farms is active"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"cell_id": "00018-49f7c915-fcae-4c94-b387-d259bc7fba8f",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 7,
"execution_start": 1620772998480,
"source_hash": "5cd9c7fc"
},
"outputs": [
{
"data": {
"text/plain": [
"'Wind_Farms'"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"hub.current_dataset()"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00019-e29188ad-2dbc-4fd4-adee-42c0fa376d5f",
"deepnote_cell_type": "markdown"
},
"source": [
"## Get list of assets with Data Views\n",
"\n",
"Returned into the form of a pandas dataframe, with column `Asset_Id` and `Description`. Each asset has a unique `Asset_Id` as its identity. \n",
"\n",
"Note that the asset *cluster1.turb2* is having index 2 (first column). We'll use this information in a few cells. "
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"cell_id": "00020-2fa05fc3-7ef4-4c83-b75b-bc97954b2a3a",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 102,
"execution_start": 1620772998481,
"source_hash": "300c2fb8",
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Asset_Id | \n",
" Description | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" cluster1.turb1 | \n",
" Turbine | \n",
"
\n",
" \n",
" 1 | \n",
" cluster1.turb10 | \n",
" Turbine | \n",
"
\n",
" \n",
" 2 | \n",
" cluster1.turb2 | \n",
" Turbine | \n",
"
\n",
" \n",
" 3 | \n",
" cluster1.turb3 | \n",
" Turbine | \n",
"
\n",
" \n",
" 4 | \n",
" cluster1.turb4 | \n",
" Turbine | \n",
"
\n",
" \n",
" 5 | \n",
" cluster1.turb5 | \n",
" Turbine | \n",
"
\n",
" \n",
" 6 | \n",
" cluster1.turb6 | \n",
" Turbine | \n",
"
\n",
" \n",
" 7 | \n",
" cluster1.turb7 | \n",
" Turbine | \n",
"
\n",
" \n",
" 8 | \n",
" cluster1.turb8 | \n",
" Turbine | \n",
"
\n",
" \n",
" 9 | \n",
" cluster1.turb9 | \n",
" Turbine | \n",
"
\n",
" \n",
" 10 | \n",
" cluster2.turb1 | \n",
" Turbine | \n",
"
\n",
" \n",
" 11 | \n",
" cluster2.turb10 | \n",
" Turbine | \n",
"
\n",
" \n",
" 12 | \n",
" cluster2.turb2 | \n",
" Turbine | \n",
"
\n",
" \n",
" 13 | \n",
" cluster2.turb3 | \n",
" Turbine | \n",
"
\n",
" \n",
" 14 | \n",
" cluster2.turb4 | \n",
" Turbine | \n",
"
\n",
" \n",
" 15 | \n",
" cluster2.turb5 | \n",
" Turbine | \n",
"
\n",
" \n",
" 16 | \n",
" cluster2.turb6 | \n",
" Turbine | \n",
"
\n",
" \n",
" 17 | \n",
" cluster2.turb7 | \n",
" Turbine | \n",
"
\n",
" \n",
" 18 | \n",
" cluster2.turb8 | \n",
" Turbine | \n",
"
\n",
" \n",
" 19 | \n",
" cluster2.turb9 | \n",
" Turbine | \n",
"
\n",
" \n",
" 20 | \n",
" cluster3.turb1 | \n",
" Turbine | \n",
"
\n",
" \n",
" 21 | \n",
" cluster3.turb10 | \n",
" Turbine | \n",
"
\n",
" \n",
" 22 | \n",
" cluster3.turb2 | \n",
" Turbine | \n",
"
\n",
" \n",
" 23 | \n",
" cluster3.turb3 | \n",
" Turbine | \n",
"
\n",
" \n",
" 24 | \n",
" cluster3.turb4 | \n",
" Turbine | \n",
"
\n",
" \n",
" 25 | \n",
" cluster3.turb5 | \n",
" Turbine | \n",
"
\n",
" \n",
" 26 | \n",
" cluster3.turb6 | \n",
" Turbine | \n",
"
\n",
" \n",
" 27 | \n",
" cluster3.turb7 | \n",
" Turbine | \n",
"
\n",
" \n",
" 28 | \n",
" cluster3.turb8 | \n",
" Turbine | \n",
"
\n",
" \n",
" 29 | \n",
" cluster3.turb9 | \n",
" Turbine | \n",
"
\n",
" \n",
" 30 | \n",
" cluster4.turb1 | \n",
" Turbine | \n",
"
\n",
" \n",
" 31 | \n",
" cluster4.turb10 | \n",
" Turbine | \n",
"
\n",
" \n",
" 32 | \n",
" cluster4.turb2 | \n",
" Turbine | \n",
"
\n",
" \n",
" 33 | \n",
" cluster4.turb3 | \n",
" Turbine | \n",
"
\n",
" \n",
" 34 | \n",
" cluster4.turb4 | \n",
" Turbine | \n",
"
\n",
" \n",
" 35 | \n",
" cluster4.turb5 | \n",
" Turbine | \n",
"
\n",
" \n",
" 36 | \n",
" cluster4.turb6 | \n",
" Turbine | \n",
"
\n",
" \n",
" 37 | \n",
" cluster4.turb7 | \n",
" Turbine | \n",
"
\n",
" \n",
" 38 | \n",
" cluster4.turb8 | \n",
" Turbine | \n",
"
\n",
" \n",
" 39 | \n",
" cluster4.turb9 | \n",
" Turbine | \n",
"
\n",
" \n",
" 40 | \n",
" cluster5.turb1 | \n",
" Turbine | \n",
"
\n",
" \n",
" 41 | \n",
" cluster5.turb10 | \n",
" Turbine | \n",
"
\n",
" \n",
" 42 | \n",
" cluster5.turb2 | \n",
" Turbine | \n",
"
\n",
" \n",
" 43 | \n",
" cluster5.turb3 | \n",
" Turbine | \n",
"
\n",
" \n",
" 44 | \n",
" cluster5.turb4 | \n",
" Turbine | \n",
"
\n",
" \n",
" 45 | \n",
" cluster5.turb5 | \n",
" Turbine | \n",
"
\n",
" \n",
" 46 | \n",
" cluster5.turb6 | \n",
" Turbine | \n",
"
\n",
" \n",
" 47 | \n",
" cluster5.turb7 | \n",
" Turbine | \n",
"
\n",
" \n",
" 48 | \n",
" cluster5.turb8 | \n",
" Turbine | \n",
"
\n",
" \n",
" 49 | \n",
" cluster5.turb9 | \n",
" Turbine | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Asset_Id Description\n",
"0 cluster1.turb1 Turbine\n",
"1 cluster1.turb10 Turbine\n",
"2 cluster1.turb2 Turbine\n",
"3 cluster1.turb3 Turbine\n",
"4 cluster1.turb4 Turbine\n",
"5 cluster1.turb5 Turbine\n",
"6 cluster1.turb6 Turbine\n",
"7 cluster1.turb7 Turbine\n",
"8 cluster1.turb8 Turbine\n",
"9 cluster1.turb9 Turbine\n",
"10 cluster2.turb1 Turbine\n",
"11 cluster2.turb10 Turbine\n",
"12 cluster2.turb2 Turbine\n",
"13 cluster2.turb3 Turbine\n",
"14 cluster2.turb4 Turbine\n",
"15 cluster2.turb5 Turbine\n",
"16 cluster2.turb6 Turbine\n",
"17 cluster2.turb7 Turbine\n",
"18 cluster2.turb8 Turbine\n",
"19 cluster2.turb9 Turbine\n",
"20 cluster3.turb1 Turbine\n",
"21 cluster3.turb10 Turbine\n",
"22 cluster3.turb2 Turbine\n",
"23 cluster3.turb3 Turbine\n",
"24 cluster3.turb4 Turbine\n",
"25 cluster3.turb5 Turbine\n",
"26 cluster3.turb6 Turbine\n",
"27 cluster3.turb7 Turbine\n",
"28 cluster3.turb8 Turbine\n",
"29 cluster3.turb9 Turbine\n",
"30 cluster4.turb1 Turbine\n",
"31 cluster4.turb10 Turbine\n",
"32 cluster4.turb2 Turbine\n",
"33 cluster4.turb3 Turbine\n",
"34 cluster4.turb4 Turbine\n",
"35 cluster4.turb5 Turbine\n",
"36 cluster4.turb6 Turbine\n",
"37 cluster4.turb7 Turbine\n",
"38 cluster4.turb8 Turbine\n",
"39 cluster4.turb9 Turbine\n",
"40 cluster5.turb1 Turbine\n",
"41 cluster5.turb10 Turbine\n",
"42 cluster5.turb2 Turbine\n",
"43 cluster5.turb3 Turbine\n",
"44 cluster5.turb4 Turbine\n",
"45 cluster5.turb5 Turbine\n",
"46 cluster5.turb6 Turbine\n",
"47 cluster5.turb7 Turbine\n",
"48 cluster5.turb8 Turbine\n",
"49 cluster5.turb9 Turbine"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"from IPython.display import display, Markdown\n",
"turbines = hub.assets()\n",
"display(turbines)"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00021-e0724515-877b-456f-a678-6c881c4e0b1c",
"deepnote_cell_type": "markdown"
},
"source": [
"## List of all Data Views\n",
"\n",
"Those are all single-asset default (with all data available for the asset) Data Views"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"cell_id": "00022-d1d73201-29ce-4a3a-9968-d3aba13b1571",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 10,
"execution_start": 1620772998592,
"source_hash": "32433344"
},
"outputs": [
{
"data": {
"text/plain": [
"['wind.farms_cluster1.turb1',\n",
" 'wind.farms_cluster1.turb10',\n",
" 'wind.farms_cluster1.turb2',\n",
" 'wind.farms_cluster1.turb3',\n",
" 'wind.farms_cluster1.turb4',\n",
" 'wind.farms_cluster1.turb5',\n",
" 'wind.farms_cluster1.turb6',\n",
" 'wind.farms_cluster1.turb7',\n",
" 'wind.farms_cluster1.turb8',\n",
" 'wind.farms_cluster1.turb9',\n",
" 'wind.farms_cluster2.turb1',\n",
" 'wind.farms_cluster2.turb10',\n",
" 'wind.farms_cluster2.turb2',\n",
" 'wind.farms_cluster2.turb3',\n",
" 'wind.farms_cluster2.turb4',\n",
" 'wind.farms_cluster2.turb5',\n",
" 'wind.farms_cluster2.turb6',\n",
" 'wind.farms_cluster2.turb7',\n",
" 'wind.farms_cluster2.turb8',\n",
" 'wind.farms_cluster2.turb9',\n",
" 'wind.farms_cluster3.turb1',\n",
" 'wind.farms_cluster3.turb10',\n",
" 'wind.farms_cluster3.turb2',\n",
" 'wind.farms_cluster3.turb3',\n",
" 'wind.farms_cluster3.turb4',\n",
" 'wind.farms_cluster3.turb5',\n",
" 'wind.farms_cluster3.turb6',\n",
" 'wind.farms_cluster3.turb7',\n",
" 'wind.farms_cluster3.turb8',\n",
" 'wind.farms_cluster3.turb9',\n",
" 'wind.farms_cluster4.turb1',\n",
" 'wind.farms_cluster4.turb10',\n",
" 'wind.farms_cluster4.turb2',\n",
" 'wind.farms_cluster4.turb3',\n",
" 'wind.farms_cluster4.turb4',\n",
" 'wind.farms_cluster4.turb5',\n",
" 'wind.farms_cluster4.turb6',\n",
" 'wind.farms_cluster4.turb7',\n",
" 'wind.farms_cluster4.turb8',\n",
" 'wind.farms_cluster4.turb9',\n",
" 'wind.farms_cluster5.turb1',\n",
" 'wind.farms_cluster5.turb10',\n",
" 'wind.farms_cluster5.turb2',\n",
" 'wind.farms_cluster5.turb3',\n",
" 'wind.farms_cluster5.turb4',\n",
" 'wind.farms_cluster5.turb5',\n",
" 'wind.farms_cluster5.turb6',\n",
" 'wind.farms_cluster5.turb7',\n",
" 'wind.farms_cluster5.turb8',\n",
" 'wind.farms_cluster5.turb9']"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"hub.asset_dataviews()"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00023-24dac889-b8a9-4b4d-83a2-5fbdf864ae01",
"deepnote_cell_type": "markdown"
},
"source": [
"## List of Data Views exclusive to turbine `cluster3.turb2` \n",
"\n",
"Empty filter (`filter=\"\"`) allows to see all dataviews for the asset instead of simply the default one\n",
"\n",
"**NOTE: Turbines for `Wind_Farms` dataset have only the default data view**"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"cell_id": "00024-af050a48-6b13-4bb9-a717-a11b1a6ba224",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 9,
"execution_start": 1620772998593,
"source_hash": "7ef808dd"
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Turbine Id: cluster3.turb2\n"
]
},
{
"data": {
"text/plain": [
"['wind.farms_cluster3.turb2']"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"turbine_id = \"cluster3.turb2\"\n",
"print(\"Turbine Id:\", turbine_id)\n",
"dvs_turbine = hub.asset_dataviews(asset=turbine_id, filter=\"\")\n",
"dvs_turbine"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00025-af27835d-a8e9-4f6d-9df0-a9ff310121b6",
"deepnote_cell_type": "markdown"
},
"source": [
"## Get the OCS namespace associated to the dataset\n",
"\n",
"Each data set belongs to a namespace within the Academic Hub OCS account. Since dataset may move over time, the function below always return the active namespace for the given dataset. "
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"cell_id": "00026-f86fd16d-95ec-4fc6-a0fd-8e70f1edd207",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 9,
"execution_start": 1620772998595,
"source_hash": "7a29829c"
},
"outputs": [
{
"data": {
"text/plain": [
"'academic_hub_01'"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"dataset = hub.current_dataset()\n",
"namespace_id = hub.namespace_of(dataset)\n",
"namespace_id"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00027-dbe01042-1102-4da6-9198-34fee704074b",
"deepnote_cell_type": "markdown"
},
"source": [
"## Get Data View structure\n",
"\n",
"With Stream Name, the column name under which stream data appears, its value type and engineering units if available. We display below the structure of the default data view. "
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {
"cell_id": "00028-4159e120-6845-4410-86bc-d2bafecc1da1",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 566,
"execution_start": 1620772998598,
"source_hash": "e76d9d53",
"tags": []
},
"outputs": [
{
"data": {
"text/markdown": [
"**Structure of Data view ID** `wind.farms_cluster3.turb2` :"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Asset_Id | \n",
" Column_Name | \n",
" Stream_Type | \n",
" Stream_UOM | \n",
" OCS_Stream_Name | \n",
"
\n",
" \n",
" \n",
" \n",
" 4 | \n",
" cluster3.turb2 | \n",
" Ambient Temperature | \n",
" Float | \n",
" °C | \n",
" cluster3.turb2.temp_ambient | \n",
"
\n",
" \n",
" 5 | \n",
" cluster3.turb2 | \n",
" Drivetrain Gearbox Temp IMSDE | \n",
" Float | \n",
" °C | \n",
" cluster3.turb2.temp_drivetrain_gearbox_IMSDE | \n",
"
\n",
" \n",
" 6 | \n",
" cluster3.turb2 | \n",
" Drivetrain Gearbox Temp IMSNDE | \n",
" Float | \n",
" °C | \n",
" cluster3.turb2.temp_drivetrain_gearbox_IMSNDE | \n",
"
\n",
" \n",
" 7 | \n",
" cluster3.turb2 | \n",
" Drivetrain Mainbearing Temp | \n",
" Float | \n",
" °C | \n",
" cluster3.turb2.temp_drivetrain_mainbearing | \n",
"
\n",
" \n",
" 9 | \n",
" cluster3.turb2 | \n",
" Drivetrain vibration | \n",
" Float | \n",
" m/s² | \n",
" cluster3.turb2.vib_drive_train | \n",
"
\n",
" \n",
" 8 | \n",
" cluster3.turb2 | \n",
" Nacelle Temp | \n",
" Float | \n",
" °C | \n",
" cluster3.turb2.temp_nacelle | \n",
"
\n",
" \n",
" 1 | \n",
" cluster3.turb2 | \n",
" Pitch Angle | \n",
" Float | \n",
" degrees | \n",
" cluster3.turb2.pitch_angle | \n",
"
\n",
" \n",
" 2 | \n",
" cluster3.turb2 | \n",
" Power To Grid | \n",
" Float | \n",
" kW | \n",
" cluster3.turb2.power_to_grid | \n",
"
\n",
" \n",
" 10 | \n",
" cluster3.turb2 | \n",
" Relative Wind Direction | \n",
" Float | \n",
" degrees | \n",
" cluster3.turb2.wind_direction_relative | \n",
"
\n",
" \n",
" 3 | \n",
" cluster3.turb2 | \n",
" Rotor Speed | \n",
" Float | \n",
" RPM | \n",
" cluster3.turb2.rotor_rpm | \n",
"
\n",
" \n",
" 0 | \n",
" cluster3.turb2 | \n",
" State | \n",
" Category | \n",
" OK|TurbError | \n",
" cluster3.turb2.error_state | \n",
"
\n",
" \n",
" 11 | \n",
" cluster3.turb2 | \n",
" Wind Speed | \n",
" Float | \n",
" m/s | \n",
" cluster3.turb2.wind_speed | \n",
"
\n",
" \n",
" 12 | \n",
" cluster3.turb2 | \n",
" Yaw Angle | \n",
" Float | \n",
" degrees | \n",
" cluster3.turb2.yaw_angle | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Asset_Id Column_Name Stream_Type Stream_UOM \\\n",
"4 cluster3.turb2 Ambient Temperature Float °C \n",
"5 cluster3.turb2 Drivetrain Gearbox Temp IMSDE Float °C \n",
"6 cluster3.turb2 Drivetrain Gearbox Temp IMSNDE Float °C \n",
"7 cluster3.turb2 Drivetrain Mainbearing Temp Float °C \n",
"9 cluster3.turb2 Drivetrain vibration Float m/s² \n",
"8 cluster3.turb2 Nacelle Temp Float °C \n",
"1 cluster3.turb2 Pitch Angle Float degrees \n",
"2 cluster3.turb2 Power To Grid Float kW \n",
"10 cluster3.turb2 Relative Wind Direction Float degrees \n",
"3 cluster3.turb2 Rotor Speed Float RPM \n",
"0 cluster3.turb2 State Category OK|TurbError \n",
"11 cluster3.turb2 Wind Speed Float m/s \n",
"12 cluster3.turb2 Yaw Angle Float degrees \n",
"\n",
" OCS_Stream_Name \n",
"4 cluster3.turb2.temp_ambient \n",
"5 cluster3.turb2.temp_drivetrain_gearbox_IMSDE \n",
"6 cluster3.turb2.temp_drivetrain_gearbox_IMSNDE \n",
"7 cluster3.turb2.temp_drivetrain_mainbearing \n",
"9 cluster3.turb2.vib_drive_train \n",
"8 cluster3.turb2.temp_nacelle \n",
"1 cluster3.turb2.pitch_angle \n",
"2 cluster3.turb2.power_to_grid \n",
"10 cluster3.turb2.wind_direction_relative \n",
"3 cluster3.turb2.rotor_rpm \n",
"0 cluster3.turb2.error_state \n",
"11 cluster3.turb2.wind_speed \n",
"12 cluster3.turb2.yaw_angle "
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"dataview_id = hub.asset_dataviews(asset=turbine_id, filter=\"default\")[0]\n",
"display(Markdown(f\"**Structure of Data view ID** `{dataview_id}` :\"))\n",
"display(hub.dataview_definition(namespace_id, dataview_id))"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00029-e966fe2e-1def-4cd1-9cde-c8cc2b479152",
"deepnote_cell_type": "markdown"
},
"source": [
"## Getting data from a Data View\n",
"\n",
"Return interpolated data between a start and end date, with the requested interpolation interval (format is HH:MM:SS)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"cell_id": "00030-7ef01ad6-203a-4670-bdb7-bfd0f603d955",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 9816,
"execution_start": 1620772999168,
"source_hash": "8c64a218",
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"+++++++\n",
" ==> Finished 'dataview_interpolated_pd' in 10.9414 secs [ 4.08K rows/sec ]\n"
]
},
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Timestamp | \n",
" Asset_Id | \n",
" Pitch Angle | \n",
" Power To Grid | \n",
" Rotor Speed | \n",
" Ambient Temperature | \n",
" Drivetrain Gearbox Temp IMSDE | \n",
" Drivetrain Gearbox Temp IMSNDE | \n",
" Drivetrain Mainbearing Temp | \n",
" Nacelle Temp | \n",
" Drivetrain vibration | \n",
" Relative Wind Direction | \n",
" Wind Speed | \n",
" Yaw Angle | \n",
" State | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 2018-03-01 00:00:00 | \n",
" cluster3.turb2 | \n",
" 62.520000 | \n",
" -0.044151 | \n",
" 0.010746 | \n",
" -78.139858 | \n",
" 8.552331 | \n",
" 8.223319 | \n",
" 16.015611 | \n",
" 7.483289 | \n",
" -0.018923 | \n",
" -19.185056 | \n",
" 11.536718 | \n",
" 35.368730 | \n",
" TurbError | \n",
"
\n",
" \n",
" 1 | \n",
" 2018-03-01 00:01:00 | \n",
" cluster3.turb2 | \n",
" 62.520000 | \n",
" -0.051222 | \n",
" 0.011359 | \n",
" -89.076366 | \n",
" 8.072332 | \n",
" 7.761786 | \n",
" 16.566306 | \n",
" 7.063290 | \n",
" -0.018944 | \n",
" -14.928717 | \n",
" 10.635196 | \n",
" 35.337961 | \n",
" TurbError | \n",
"
\n",
" \n",
" 2 | \n",
" 2018-03-01 00:02:00 | \n",
" cluster3.turb2 | \n",
" 62.520000 | \n",
" -0.058293 | \n",
" 0.011973 | \n",
" -100.012874 | \n",
" 7.592333 | \n",
" 7.300253 | \n",
" 16.904651 | \n",
" 6.643291 | \n",
" -0.018965 | \n",
" -22.023941 | \n",
" 10.914551 | \n",
" 35.307192 | \n",
" TurbError | \n",
"
\n",
" \n",
" 3 | \n",
" 2018-03-01 00:03:00 | \n",
" cluster3.turb2 | \n",
" 62.520000 | \n",
" -0.065365 | \n",
" 0.012586 | \n",
" -110.949383 | \n",
" 7.112334 | \n",
" 6.838720 | \n",
" 16.632016 | \n",
" 6.223292 | \n",
" -0.018986 | \n",
" -14.941006 | \n",
" 10.854806 | \n",
" 35.276423 | \n",
" TurbError | \n",
"
\n",
" \n",
" 4 | \n",
" 2018-03-01 00:04:00 | \n",
" cluster3.turb2 | \n",
" 561.566741 | \n",
" -0.072436 | \n",
" 0.013200 | \n",
" -121.885891 | \n",
" 6.632335 | \n",
" 6.377187 | \n",
" 16.359382 | \n",
" 5.803294 | \n",
" -0.019007 | \n",
" -23.411304 | \n",
" 11.344060 | \n",
" 35.245654 | \n",
" TurbError | \n",
"
\n",
" \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" 44636 | \n",
" 2018-03-31 23:56:00 | \n",
" cluster3.turb2 | \n",
" 0.982178 | \n",
" 384.226232 | \n",
" 15.431257 | \n",
" 22.325451 | \n",
" 66.212909 | \n",
" 62.960102 | \n",
" 33.389045 | \n",
" 28.674203 | \n",
" 0.014219 | \n",
" -1.419621 | \n",
" 6.533780 | \n",
" 279.834269 | \n",
" OK | \n",
"
\n",
" \n",
" 44637 | \n",
" 2018-03-31 23:57:00 | \n",
" cluster3.turb2 | \n",
" 0.969463 | \n",
" 70.196262 | \n",
" 15.442907 | \n",
" 22.363668 | \n",
" 66.283498 | \n",
" 62.994784 | \n",
" 33.391544 | \n",
" 28.688801 | \n",
" 0.014051 | \n",
" 5.365956 | \n",
" 4.309831 | \n",
" 279.819859 | \n",
" OK | \n",
"
\n",
" \n",
" 44638 | \n",
" 2018-03-31 23:58:00 | \n",
" cluster3.turb2 | \n",
" 0.956749 | \n",
" 136.620888 | \n",
" 15.454558 | \n",
" 22.401884 | \n",
" 66.354086 | \n",
" 63.029466 | \n",
" 33.394043 | \n",
" 28.703400 | \n",
" 0.013883 | \n",
" 9.529120 | \n",
" 4.877480 | \n",
" 279.805448 | \n",
" OK | \n",
"
\n",
" \n",
" 44639 | \n",
" 2018-03-31 23:59:00 | \n",
" cluster3.turb2 | \n",
" 0.944034 | \n",
" 195.523662 | \n",
" 15.466209 | \n",
" 22.440100 | \n",
" 66.424675 | \n",
" 63.064148 | \n",
" 33.396542 | \n",
" 28.717998 | \n",
" 0.013715 | \n",
" 1.981950 | \n",
" 4.213840 | \n",
" 279.791038 | \n",
" OK | \n",
"
\n",
" \n",
" 44640 | \n",
" 2018-04-01 00:00:00 | \n",
" cluster3.turb2 | \n",
" 0.273318 | \n",
" 355.459865 | \n",
" 15.477859 | \n",
" 22.478317 | \n",
" 66.495263 | \n",
" 63.098831 | \n",
" 33.399040 | \n",
" 28.732597 | \n",
" 0.013548 | \n",
" -2.493316 | \n",
" 5.230510 | \n",
" 279.776627 | \n",
" OK | \n",
"
\n",
" \n",
"
\n",
"
44641 rows × 15 columns
\n",
"
"
],
"text/plain": [
" Timestamp Asset_Id Pitch Angle Power To Grid \\\n",
"0 2018-03-01 00:00:00 cluster3.turb2 62.520000 -0.044151 \n",
"1 2018-03-01 00:01:00 cluster3.turb2 62.520000 -0.051222 \n",
"2 2018-03-01 00:02:00 cluster3.turb2 62.520000 -0.058293 \n",
"3 2018-03-01 00:03:00 cluster3.turb2 62.520000 -0.065365 \n",
"4 2018-03-01 00:04:00 cluster3.turb2 561.566741 -0.072436 \n",
"... ... ... ... ... \n",
"44636 2018-03-31 23:56:00 cluster3.turb2 0.982178 384.226232 \n",
"44637 2018-03-31 23:57:00 cluster3.turb2 0.969463 70.196262 \n",
"44638 2018-03-31 23:58:00 cluster3.turb2 0.956749 136.620888 \n",
"44639 2018-03-31 23:59:00 cluster3.turb2 0.944034 195.523662 \n",
"44640 2018-04-01 00:00:00 cluster3.turb2 0.273318 355.459865 \n",
"\n",
" Rotor Speed Ambient Temperature Drivetrain Gearbox Temp IMSDE \\\n",
"0 0.010746 -78.139858 8.552331 \n",
"1 0.011359 -89.076366 8.072332 \n",
"2 0.011973 -100.012874 7.592333 \n",
"3 0.012586 -110.949383 7.112334 \n",
"4 0.013200 -121.885891 6.632335 \n",
"... ... ... ... \n",
"44636 15.431257 22.325451 66.212909 \n",
"44637 15.442907 22.363668 66.283498 \n",
"44638 15.454558 22.401884 66.354086 \n",
"44639 15.466209 22.440100 66.424675 \n",
"44640 15.477859 22.478317 66.495263 \n",
"\n",
" Drivetrain Gearbox Temp IMSNDE Drivetrain Mainbearing Temp \\\n",
"0 8.223319 16.015611 \n",
"1 7.761786 16.566306 \n",
"2 7.300253 16.904651 \n",
"3 6.838720 16.632016 \n",
"4 6.377187 16.359382 \n",
"... ... ... \n",
"44636 62.960102 33.389045 \n",
"44637 62.994784 33.391544 \n",
"44638 63.029466 33.394043 \n",
"44639 63.064148 33.396542 \n",
"44640 63.098831 33.399040 \n",
"\n",
" Nacelle Temp Drivetrain vibration Relative Wind Direction \\\n",
"0 7.483289 -0.018923 -19.185056 \n",
"1 7.063290 -0.018944 -14.928717 \n",
"2 6.643291 -0.018965 -22.023941 \n",
"3 6.223292 -0.018986 -14.941006 \n",
"4 5.803294 -0.019007 -23.411304 \n",
"... ... ... ... \n",
"44636 28.674203 0.014219 -1.419621 \n",
"44637 28.688801 0.014051 5.365956 \n",
"44638 28.703400 0.013883 9.529120 \n",
"44639 28.717998 0.013715 1.981950 \n",
"44640 28.732597 0.013548 -2.493316 \n",
"\n",
" Wind Speed Yaw Angle State \n",
"0 11.536718 35.368730 TurbError \n",
"1 10.635196 35.337961 TurbError \n",
"2 10.914551 35.307192 TurbError \n",
"3 10.854806 35.276423 TurbError \n",
"4 11.344060 35.245654 TurbError \n",
"... ... ... ... \n",
"44636 6.533780 279.834269 OK \n",
"44637 4.309831 279.819859 OK \n",
"44638 4.877480 279.805448 OK \n",
"44639 4.213840 279.791038 OK \n",
"44640 5.230510 279.776627 OK \n",
"\n",
"[44641 rows x 15 columns]"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# For a single month of data\n",
"df_acad = hub.dataview_interpolated_pd(\n",
" namespace_id, dataview_id, \"2018-03-01\", \"2018-04-01\", \"00:01:00\"\n",
")\n",
"df_acad"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"cell_id": "00031-5214913b-78b4-4fd9-8ef5-bbef730147e4",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 22,
"execution_start": 1620773008987,
"source_hash": "303862fd",
"tags": []
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"RangeIndex: 44641 entries, 0 to 44640\n",
"Data columns (total 15 columns):\n",
" # Column Non-Null Count Dtype \n",
"--- ------ -------------- ----- \n",
" 0 Timestamp 44641 non-null datetime64[ns]\n",
" 1 Asset_Id 44641 non-null object \n",
" 2 Pitch Angle 44641 non-null float64 \n",
" 3 Power To Grid 44641 non-null float64 \n",
" 4 Rotor Speed 44641 non-null float64 \n",
" 5 Ambient Temperature 44641 non-null float64 \n",
" 6 Drivetrain Gearbox Temp IMSDE 44641 non-null float64 \n",
" 7 Drivetrain Gearbox Temp IMSNDE 44641 non-null float64 \n",
" 8 Drivetrain Mainbearing Temp 44641 non-null float64 \n",
" 9 Nacelle Temp 44641 non-null float64 \n",
" 10 Drivetrain vibration 44641 non-null float64 \n",
" 11 Relative Wind Direction 44641 non-null float64 \n",
" 12 Wind Speed 44641 non-null float64 \n",
" 13 Yaw Angle 44641 non-null float64 \n",
" 14 State 44641 non-null object \n",
"dtypes: datetime64[ns](1), float64(12), object(2)\n",
"memory usage: 5.1+ MB\n"
]
}
],
"source": [
"# Information about the dataframe - this is a Pandas operation \n",
"df_acad.info()"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00032-90e60deb-4b42-41b6-b6dd-c638b00b03b6",
"deepnote_cell_type": "markdown"
},
"source": [
"## Asset metadata\n",
"\n",
"In some datasets like `Wind_Farms`, assets have metadata (static information) attached to them. This metadata comes in the form of a Python dictionary, i.e. a set of keys, each key with an associated value. The example below is representative of turbine metadata available with `Wind_Farms`. "
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"cell_id": "00033-0eb2c777-fcc7-4d4a-b9ad-8b24a09d02f9",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 10,
"execution_start": 1620773009001,
"source_hash": "96c94d39",
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"{'Cluster': 3,\n",
" 'ID': '2',\n",
" 'Latitude': -35.113458,\n",
" 'Longitude': 137.719395,\n",
" 'Manufacturer': '',\n",
" 'Model': '',\n",
" 'Asset_Id': 'cluster3.turb2'}"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"hub.asset_metadata(turbine_id)"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00034-077e86ae-35f2-4ac1-8de1-242841bd65fc",
"deepnote_cell_type": "markdown"
},
"source": [
"## Metadata for all assets\n",
"\n",
"It sometimes useful to get metadata of all assets into a single Pandas dataframe to select assets according to some criteria, for example Primary Usage. "
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"cell_id": "00035-ed5f48df-d02f-4b02-9d71-83b07c32efb4",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 30,
"execution_start": 1620773009019,
"source_hash": "fcb7082a"
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Cluster | \n",
" ID | \n",
" Latitude | \n",
" Longitude | \n",
" Manufacturer | \n",
" Model | \n",
" Asset_Id | \n",
"
\n",
" \n",
" \n",
" \n",
" 4 | \n",
" 1 | \n",
" 1 | \n",
" -38.016069 | \n",
" 142.139145 | \n",
" | \n",
" | \n",
" cluster1.turb1 | \n",
"
\n",
" \n",
" 7 | \n",
" 1 | \n",
" 10 | \n",
" -38.008225 | \n",
" 142.172404 | \n",
" | \n",
" | \n",
" cluster1.turb10 | \n",
"
\n",
" \n",
" 13 | \n",
" 1 | \n",
" 2 | \n",
" -38.018385 | \n",
" 142.143941 | \n",
" | \n",
" | \n",
" cluster1.turb2 | \n",
"
\n",
" \n",
" 15 | \n",
" 1 | \n",
" 3 | \n",
" -38.017802 | \n",
" 142.149638 | \n",
" | \n",
" | \n",
" cluster1.turb3 | \n",
"
\n",
" \n",
" 23 | \n",
" 1 | \n",
" 4 | \n",
" -38.021606 | \n",
" 142.153468 | \n",
" | \n",
" | \n",
" cluster1.turb4 | \n",
"
\n",
" \n",
" 26 | \n",
" 1 | \n",
" 5 | \n",
" -38.015985 | \n",
" 142.152867 | \n",
" | \n",
" | \n",
" cluster1.turb5 | \n",
"
\n",
" \n",
" 30 | \n",
" 1 | \n",
" 6 | \n",
" -38.013043 | \n",
" 142.156611 | \n",
" | \n",
" | \n",
" cluster1.turb6 | \n",
"
\n",
" \n",
" 35 | \n",
" 1 | \n",
" 7 | \n",
" -38.011429 | \n",
" 142.160753 | \n",
" | \n",
" | \n",
" cluster1.turb7 | \n",
"
\n",
" \n",
" 41 | \n",
" 1 | \n",
" 8 | \n",
" -38.008259 | \n",
" 142.162984 | \n",
" | \n",
" | \n",
" cluster1.turb8 | \n",
"
\n",
" \n",
" 46 | \n",
" 1 | \n",
" 9 | \n",
" -38.008250 | \n",
" 142.167297 | \n",
" | \n",
" | \n",
" cluster1.turb9 | \n",
"
\n",
" \n",
" 3 | \n",
" 2 | \n",
" 1 | \n",
" -37.691776 | \n",
" 142.515474 | \n",
" | \n",
" | \n",
" cluster2.turb1 | \n",
"
\n",
" \n",
" 9 | \n",
" 2 | \n",
" 10 | \n",
" -37.696055 | \n",
" 142.566875 | \n",
" | \n",
" | \n",
" cluster2.turb10 | \n",
"
\n",
" \n",
" 14 | \n",
" 2 | \n",
" 2 | \n",
" -37.694349 | \n",
" 142.519175 | \n",
" | \n",
" | \n",
" cluster2.turb2 | \n",
"
\n",
" \n",
" 18 | \n",
" 2 | \n",
" 3 | \n",
" -37.693415 | \n",
" 142.525033 | \n",
" | \n",
" | \n",
" cluster2.turb3 | \n",
"
\n",
" \n",
" 21 | \n",
" 2 | \n",
" 4 | \n",
" -37.691072 | \n",
" 142.528681 | \n",
" | \n",
" | \n",
" cluster2.turb4 | \n",
"
\n",
" \n",
" 27 | \n",
" 2 | \n",
" 5 | \n",
" -37.689841 | \n",
" 142.536266 | \n",
" | \n",
" | \n",
" cluster2.turb5 | \n",
"
\n",
" \n",
" 34 | \n",
" 2 | \n",
" 6 | \n",
" -37.688041 | \n",
" 142.540386 | \n",
" | \n",
" | \n",
" cluster2.turb6 | \n",
"
\n",
" \n",
" 37 | \n",
" 2 | \n",
" 7 | \n",
" -37.687931 | \n",
" 142.553743 | \n",
" | \n",
" | \n",
" cluster2.turb7 | \n",
"
\n",
" \n",
" 44 | \n",
" 2 | \n",
" 8 | \n",
" -37.695758 | \n",
" 142.540890 | \n",
" | \n",
" | \n",
" cluster2.turb8 | \n",
"
\n",
" \n",
" 45 | \n",
" 2 | \n",
" 9 | \n",
" -37.696420 | \n",
" 142.536513 | \n",
" | \n",
" | \n",
" cluster2.turb9 | \n",
"
\n",
" \n",
" 2 | \n",
" 3 | \n",
" 1 | \n",
" -35.111825 | \n",
" 137.722635 | \n",
" | \n",
" | \n",
" cluster3.turb1 | \n",
"
\n",
" \n",
" 5 | \n",
" 3 | \n",
" 10 | \n",
" -35.119118 | \n",
" 137.728172 | \n",
" | \n",
" | \n",
" cluster3.turb10 | \n",
"
\n",
" \n",
" 10 | \n",
" 3 | \n",
" 2 | \n",
" -35.113458 | \n",
" 137.719395 | \n",
" | \n",
" | \n",
" cluster3.turb2 | \n",
"
\n",
" \n",
" 17 | \n",
" 3 | \n",
" 3 | \n",
" -35.113800 | \n",
" 137.728665 | \n",
" | \n",
" | \n",
" cluster3.turb3 | \n",
"
\n",
" \n",
" 22 | \n",
" 3 | \n",
" 4 | \n",
" -35.115038 | \n",
" 137.716187 | \n",
" | \n",
" | \n",
" cluster3.turb4 | \n",
"
\n",
" \n",
" 28 | \n",
" 3 | \n",
" 5 | \n",
" -35.115503 | \n",
" 137.725382 | \n",
" | \n",
" | \n",
" cluster3.turb5 | \n",
"
\n",
" \n",
" 32 | \n",
" 3 | \n",
" 6 | \n",
" -35.116784 | \n",
" 137.712808 | \n",
" | \n",
" | \n",
" cluster3.turb6 | \n",
"
\n",
" \n",
" 38 | \n",
" 3 | \n",
" 7 | \n",
" -35.117091 | \n",
" 137.722088 | \n",
" | \n",
" | \n",
" cluster3.turb7 | \n",
"
\n",
" \n",
" 42 | \n",
" 3 | \n",
" 8 | \n",
" -35.117732 | \n",
" 137.730811 | \n",
" | \n",
" | \n",
" cluster3.turb8 | \n",
"
\n",
" \n",
" 48 | \n",
" 3 | \n",
" 9 | \n",
" -35.118680 | \n",
" 137.718945 | \n",
" | \n",
" | \n",
" cluster3.turb9 | \n",
"
\n",
" \n",
" 1 | \n",
" 4 | \n",
" 1 | \n",
" -33.294081 | \n",
" 138.731074 | \n",
" | \n",
" | \n",
" cluster4.turb1 | \n",
"
\n",
" \n",
" 6 | \n",
" 4 | \n",
" 10 | \n",
" -33.302959 | \n",
" 138.718843 | \n",
" | \n",
" | \n",
" cluster4.turb10 | \n",
"
\n",
" \n",
" 11 | \n",
" 4 | \n",
" 2 | \n",
" -33.297077 | \n",
" 138.728607 | \n",
" | \n",
" | \n",
" cluster4.turb2 | \n",
"
\n",
" \n",
" 19 | \n",
" 4 | \n",
" 3 | \n",
" -33.296198 | \n",
" 138.706698 | \n",
" | \n",
" | \n",
" cluster4.turb3 | \n",
"
\n",
" \n",
" 20 | \n",
" 4 | \n",
" 4 | \n",
" -33.295929 | \n",
" 138.712857 | \n",
" | \n",
" | \n",
" cluster4.turb4 | \n",
"
\n",
" \n",
" 25 | \n",
" 4 | \n",
" 5 | \n",
" -33.296198 | \n",
" 138.719079 | \n",
" | \n",
" | \n",
" cluster4.turb5 | \n",
"
\n",
" \n",
" 31 | \n",
" 4 | \n",
" 6 | \n",
" -33.298906 | \n",
" 138.723414 | \n",
" | \n",
" | \n",
" cluster4.turb6 | \n",
"
\n",
" \n",
" 39 | \n",
" 4 | \n",
" 7 | \n",
" -33.300430 | \n",
" 138.727212 | \n",
" | \n",
" | \n",
" cluster4.turb7 | \n",
"
\n",
" \n",
" 40 | \n",
" 4 | \n",
" 8 | \n",
" -33.301506 | \n",
" 138.707042 | \n",
" | \n",
" | \n",
" cluster4.turb8 | \n",
"
\n",
" \n",
" 47 | \n",
" 4 | \n",
" 9 | \n",
" -33.300915 | \n",
" 138.712792 | \n",
" | \n",
" | \n",
" cluster4.turb9 | \n",
"
\n",
" \n",
" 0 | \n",
" 5 | \n",
" 1 | \n",
" -31.835897 | \n",
" 141.235764 | \n",
" | \n",
" | \n",
" cluster5.turb1 | \n",
"
\n",
" \n",
" 8 | \n",
" 5 | \n",
" 10 | \n",
" -31.804245 | \n",
" 141.248103 | \n",
" | \n",
" | \n",
" cluster5.turb10 | \n",
"
\n",
" \n",
" 12 | \n",
" 5 | \n",
" 2 | \n",
" -31.829316 | \n",
" 141.239241 | \n",
" | \n",
" | \n",
" cluster5.turb2 | \n",
"
\n",
" \n",
" 16 | \n",
" 5 | \n",
" 3 | \n",
" -31.825159 | \n",
" 141.239176 | \n",
" | \n",
" | \n",
" cluster5.turb3 | \n",
"
\n",
" \n",
" 24 | \n",
" 5 | \n",
" 4 | \n",
" -31.821658 | \n",
" 141.240163 | \n",
" | \n",
" | \n",
" cluster5.turb4 | \n",
"
\n",
" \n",
" 29 | \n",
" 5 | \n",
" 5 | \n",
" -31.820765 | \n",
" 141.242545 | \n",
" | \n",
" | \n",
" cluster5.turb5 | \n",
"
\n",
" \n",
" 33 | \n",
" 5 | \n",
" 6 | \n",
" -31.820856 | \n",
" 141.246751 | \n",
" | \n",
" | \n",
" cluster5.turb6 | \n",
"
\n",
" \n",
" 36 | \n",
" 5 | \n",
" 7 | \n",
" -31.813891 | \n",
" 141.241086 | \n",
" | \n",
" | \n",
" cluster5.turb7 | \n",
"
\n",
" \n",
" 43 | \n",
" 5 | \n",
" 8 | \n",
" -31.811393 | \n",
" 141.242760 | \n",
" | \n",
" | \n",
" cluster5.turb8 | \n",
"
\n",
" \n",
" 49 | \n",
" 5 | \n",
" 9 | \n",
" -31.810335 | \n",
" 141.245206 | \n",
" | \n",
" | \n",
" cluster5.turb9 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Cluster ID Latitude Longitude Manufacturer Model Asset_Id\n",
"4 1 1 -38.016069 142.139145 cluster1.turb1\n",
"7 1 10 -38.008225 142.172404 cluster1.turb10\n",
"13 1 2 -38.018385 142.143941 cluster1.turb2\n",
"15 1 3 -38.017802 142.149638 cluster1.turb3\n",
"23 1 4 -38.021606 142.153468 cluster1.turb4\n",
"26 1 5 -38.015985 142.152867 cluster1.turb5\n",
"30 1 6 -38.013043 142.156611 cluster1.turb6\n",
"35 1 7 -38.011429 142.160753 cluster1.turb7\n",
"41 1 8 -38.008259 142.162984 cluster1.turb8\n",
"46 1 9 -38.008250 142.167297 cluster1.turb9\n",
"3 2 1 -37.691776 142.515474 cluster2.turb1\n",
"9 2 10 -37.696055 142.566875 cluster2.turb10\n",
"14 2 2 -37.694349 142.519175 cluster2.turb2\n",
"18 2 3 -37.693415 142.525033 cluster2.turb3\n",
"21 2 4 -37.691072 142.528681 cluster2.turb4\n",
"27 2 5 -37.689841 142.536266 cluster2.turb5\n",
"34 2 6 -37.688041 142.540386 cluster2.turb6\n",
"37 2 7 -37.687931 142.553743 cluster2.turb7\n",
"44 2 8 -37.695758 142.540890 cluster2.turb8\n",
"45 2 9 -37.696420 142.536513 cluster2.turb9\n",
"2 3 1 -35.111825 137.722635 cluster3.turb1\n",
"5 3 10 -35.119118 137.728172 cluster3.turb10\n",
"10 3 2 -35.113458 137.719395 cluster3.turb2\n",
"17 3 3 -35.113800 137.728665 cluster3.turb3\n",
"22 3 4 -35.115038 137.716187 cluster3.turb4\n",
"28 3 5 -35.115503 137.725382 cluster3.turb5\n",
"32 3 6 -35.116784 137.712808 cluster3.turb6\n",
"38 3 7 -35.117091 137.722088 cluster3.turb7\n",
"42 3 8 -35.117732 137.730811 cluster3.turb8\n",
"48 3 9 -35.118680 137.718945 cluster3.turb9\n",
"1 4 1 -33.294081 138.731074 cluster4.turb1\n",
"6 4 10 -33.302959 138.718843 cluster4.turb10\n",
"11 4 2 -33.297077 138.728607 cluster4.turb2\n",
"19 4 3 -33.296198 138.706698 cluster4.turb3\n",
"20 4 4 -33.295929 138.712857 cluster4.turb4\n",
"25 4 5 -33.296198 138.719079 cluster4.turb5\n",
"31 4 6 -33.298906 138.723414 cluster4.turb6\n",
"39 4 7 -33.300430 138.727212 cluster4.turb7\n",
"40 4 8 -33.301506 138.707042 cluster4.turb8\n",
"47 4 9 -33.300915 138.712792 cluster4.turb9\n",
"0 5 1 -31.835897 141.235764 cluster5.turb1\n",
"8 5 10 -31.804245 141.248103 cluster5.turb10\n",
"12 5 2 -31.829316 141.239241 cluster5.turb2\n",
"16 5 3 -31.825159 141.239176 cluster5.turb3\n",
"24 5 4 -31.821658 141.240163 cluster5.turb4\n",
"29 5 5 -31.820765 141.242545 cluster5.turb5\n",
"33 5 6 -31.820856 141.246751 cluster5.turb6\n",
"36 5 7 -31.813891 141.241086 cluster5.turb7\n",
"43 5 8 -31.811393 141.242760 cluster5.turb8\n",
"49 5 9 -31.810335 141.245206 cluster5.turb9"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df_metadata = hub.all_assets_metadata()\n",
"df_metadata"
]
},
{
"cell_type": "markdown",
"metadata": {
"cell_id": "00036-c1d3beb2-605b-4319-8e46-0be325b82136",
"deepnote_cell_type": "markdown",
"tags": []
},
"source": [
"## Map of Cluster 3 Wind Turbines\n",
"\n",
"NOTE: requires a [Mapbox](https://www.mapbox.com/) token to rerun. "
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {
"cell_id": "00036-e81097cd-88c9-428b-9b42-3d58ad3ba5a8",
"deepnote_cell_type": "code",
"deepnote_to_be_reexecuted": false,
"execution_millis": 1615,
"execution_start": 1620773009047,
"source_hash": "326c6999",
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
" \n",
" "
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.plotly.v1+json": {
"config": {
"plotlyServerURL": "https://plot.ly"
},
"data": [
{
"hovertemplate": "Asset_Id=%{text}
Latitude=%{lat}
Longitude=%{lon}",
"lat": [
-35.111825,
-35.119118,
-35.113458,
-35.1138,
-35.115038,
-35.115503,
-35.116784,
-35.117091,
-35.117732,
-35.11868
],
"legendgroup": "",
"lon": [
137.722635,
137.728172,
137.719395,
137.728665,
137.716187,
137.725382,
137.712808,
137.722088,
137.730811,
137.718945
],
"marker": {
"color": "blue"
},
"mode": "markers+text",
"name": "",
"showlegend": false,
"subplot": "mapbox",
"text": [
"cluster3.turb1",
"cluster3.turb10",
"cluster3.turb2",
"cluster3.turb3",
"cluster3.turb4",
"cluster3.turb5",
"cluster3.turb6",
"cluster3.turb7",
"cluster3.turb8",
"cluster3.turb9"
],
"type": "scattermapbox"
}
],
"layout": {
"legend": {
"tracegroupgap": 0
},
"mapbox": {
"accesstoken": "pk.eyJ1IjoiY2ZvaXN5IiwiYSI6ImNrNXBveGNyNTA4cm0zbXFvY2cyZ2tveDAifQ.7wf11z7BjtTgKjj8Z1TvMA",
"center": {
"lat": -35.115902899999995,
"lon": 137.72250879999999
},
"domain": {
"x": [
0,
1
],
"y": [
0,
1
]
},
"zoom": 12
},
"margin": {
"t": 60
},
"template": {
"data": {
"bar": [
{
"error_x": {
"color": "#2a3f5f"
},
"error_y": {
"color": "#2a3f5f"
},
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "bar"
}
],
"barpolar": [
{
"marker": {
"line": {
"color": "#E5ECF6",
"width": 0.5
}
},
"type": "barpolar"
}
],
"carpet": [
{
"aaxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"baxis": {
"endlinecolor": "#2a3f5f",
"gridcolor": "white",
"linecolor": "white",
"minorgridcolor": "white",
"startlinecolor": "#2a3f5f"
},
"type": "carpet"
}
],
"choropleth": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "choropleth"
}
],
"contour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "contour"
}
],
"contourcarpet": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "contourcarpet"
}
],
"heatmap": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmap"
}
],
"heatmapgl": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "heatmapgl"
}
],
"histogram": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "histogram"
}
],
"histogram2d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2d"
}
],
"histogram2dcontour": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "histogram2dcontour"
}
],
"mesh3d": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"type": "mesh3d"
}
],
"parcoords": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "parcoords"
}
],
"pie": [
{
"automargin": true,
"type": "pie"
}
],
"scatter": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter"
}
],
"scatter3d": [
{
"line": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatter3d"
}
],
"scattercarpet": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattercarpet"
}
],
"scattergeo": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergeo"
}
],
"scattergl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattergl"
}
],
"scattermapbox": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scattermapbox"
}
],
"scatterpolar": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolar"
}
],
"scatterpolargl": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterpolargl"
}
],
"scatterternary": [
{
"marker": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"type": "scatterternary"
}
],
"surface": [
{
"colorbar": {
"outlinewidth": 0,
"ticks": ""
},
"colorscale": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"type": "surface"
}
],
"table": [
{
"cells": {
"fill": {
"color": "#EBF0F8"
},
"line": {
"color": "white"
}
},
"header": {
"fill": {
"color": "#C8D4E3"
},
"line": {
"color": "white"
}
},
"type": "table"
}
]
},
"layout": {
"annotationdefaults": {
"arrowcolor": "#2a3f5f",
"arrowhead": 0,
"arrowwidth": 1
},
"coloraxis": {
"colorbar": {
"outlinewidth": 0,
"ticks": ""
}
},
"colorscale": {
"diverging": [
[
0,
"#8e0152"
],
[
0.1,
"#c51b7d"
],
[
0.2,
"#de77ae"
],
[
0.3,
"#f1b6da"
],
[
0.4,
"#fde0ef"
],
[
0.5,
"#f7f7f7"
],
[
0.6,
"#e6f5d0"
],
[
0.7,
"#b8e186"
],
[
0.8,
"#7fbc41"
],
[
0.9,
"#4d9221"
],
[
1,
"#276419"
]
],
"sequential": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
],
"sequentialminus": [
[
0,
"#0d0887"
],
[
0.1111111111111111,
"#46039f"
],
[
0.2222222222222222,
"#7201a8"
],
[
0.3333333333333333,
"#9c179e"
],
[
0.4444444444444444,
"#bd3786"
],
[
0.5555555555555556,
"#d8576b"
],
[
0.6666666666666666,
"#ed7953"
],
[
0.7777777777777778,
"#fb9f3a"
],
[
0.8888888888888888,
"#fdca26"
],
[
1,
"#f0f921"
]
]
},
"colorway": [
"#636efa",
"#EF553B",
"#00cc96",
"#ab63fa",
"#FFA15A",
"#19d3f3",
"#FF6692",
"#B6E880",
"#FF97FF",
"#FECB52"
],
"font": {
"color": "#2a3f5f"
},
"geo": {
"bgcolor": "white",
"lakecolor": "white",
"landcolor": "#E5ECF6",
"showlakes": true,
"showland": true,
"subunitcolor": "white"
},
"hoverlabel": {
"align": "left"
},
"hovermode": "closest",
"mapbox": {
"style": "light"
},
"paper_bgcolor": "white",
"plot_bgcolor": "#E5ECF6",
"polar": {
"angularaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"radialaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"scene": {
"xaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"yaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
},
"zaxis": {
"backgroundcolor": "#E5ECF6",
"gridcolor": "white",
"gridwidth": 2,
"linecolor": "white",
"showbackground": true,
"ticks": "",
"zerolinecolor": "white"
}
},
"shapedefaults": {
"line": {
"color": "#2a3f5f"
}
},
"ternary": {
"aaxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"baxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
},
"bgcolor": "#E5ECF6",
"caxis": {
"gridcolor": "white",
"linecolor": "white",
"ticks": ""
}
},
"title": {
"x": 0.05
},
"xaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
},
"yaxis": {
"automargin": true,
"gridcolor": "white",
"linecolor": "white",
"ticks": "",
"title": {
"standoff": 15
},
"zerolinecolor": "white",
"zerolinewidth": 2
}
}
}
}
},
"text/html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import plotly.express as px\n",
"\n",
"px.set_mapbox_access_token(open(\"mapbox_token.txt\").read())\n",
"fig = px.scatter_mapbox(\n",
" df_metadata[df_metadata[\"Cluster\"] == 3],\n",
" lat=\"Latitude\",\n",
" lon=\"Longitude\",\n",
" text=\"Asset_Id\",\n",
" color_discrete_sequence=[\"blue\", \"red\", \"yellow\", \"orange\", \"purple\"],\n",
" zoom=12,\n",
")\n",
"fig.show()"
]
},
{
"cell_type": "markdown",
"metadata": {
"created_in_deepnote_cell": true,
"deepnote_cell_type": "markdown",
"tags": []
},
"source": [
"\n",
"
\n",
"Created in Deepnote"
]
}
],
"metadata": {
"deepnote": {},
"deepnote_execution_queue": [],
"deepnote_notebook_id": "35620d82-d6c3-4f68-86de-a81e1df5c403",
"kernelspec": {
"display_name": "Python 3",
"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.7.9"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 4
}