From eecb84cfe94751c7213efcdad31ef5758f1dad07 Mon Sep 17 00:00:00 2001 From: anders-albert Date: Sat, 16 Nov 2024 19:36:20 +0100 Subject: [PATCH] docs: ingestion finished --- docs/quickstart/ingestion.ipynb | 817 ++++++-------------------------- 1 file changed, 132 insertions(+), 685 deletions(-) diff --git a/docs/quickstart/ingestion.ipynb b/docs/quickstart/ingestion.ipynb index 57fb9bb5e..fdb35a481 100644 --- a/docs/quickstart/ingestion.ipynb +++ b/docs/quickstart/ingestion.ipynb @@ -20,7 +20,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "metadata": { "editable": true, "slideshow": { @@ -57,15 +57,8 @@ ] }, { - "attachments": {}, "cell_type": "markdown", - "metadata": { - "editable": true, - "slideshow": { - "slide_type": "" - }, - "tags": [] - }, + "metadata": {}, "source": [ "`pygen` can be used to ingest data into an existing data model. It is well suited when the source data is nested and comes in a format such as `JSON`.\n", "\n", @@ -89,7 +82,7 @@ "\n", "The model is illustrated in Cognite Data Fusions interface below:\n", "\n", - "" + "" ] }, { @@ -107,7 +100,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "metadata": { "editable": true, "slideshow": { @@ -117,7 +110,16 @@ }, "outputs": [], "source": [ - "from tests.constants import WindMillFiles" + "from tests.constants import JSON_DIR" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "source_filepath = JSON_DIR / \"turbine.json\"" ] }, { @@ -135,30 +137,31 @@ "name": "stdout", "output_type": "stream", "text": [ - "[\n", - " {\n", - "\n", - " \"name\": \"hornsea_1_mill_3\",\n", - " \"windfarm\": \"Hornsea 1\",\n", - " \"capacity\": 7.0,\n", - " \"rotor\": {\n", - "\n", - " \"rotor_speed_controller\": \"V52-WindTurbine.ROT\",\n", - " \"rpm_low_speed_shaft\": \"V52-WindTurbine.cnt0\"\n", - " },\n", - " \"nacelle\": {\n", - "\n", - " \"gearbox\": {\n", - "\n", - " \"displacement_x\": \"V52-WindTurbine.Gear_D_X\",\n", - " \"displacement_y\": \"V52-WindTurbine.Gear_D_Y\",\n", - " \"displacement_z\": \"V52-WindTurbine.Gear_D_Z\"\n", - " },\n" + "[{\n", + "\t\"capacity\": 7.0,\n", + "\t\"name\": \"Doctrino Turbine 11\",\n", + " \"windfarm\": \"Oslo B2\",\n", + "\t\"blades\": [\n", + "\t\t{\n", + "\t\t\t\"is_damaged\": false,\n", + "\t\t\t\"name\": \"Blade A\"\n", + "\t\t},\n", + "\t\t{\n", + " \"is_damaged\": false,\n", + "\t\t\t\"name\": \"Blade B\"\n", + "\t\t},\n", + "\t\t{\n", + "\t\t\t\"is_damaged\": true,\n", + "\t\t\t\"name\": \"Blade C\"\n", + "\t\t}\n", + " ]\n", + "}]\n", + "\n" ] } ], "source": [ - "print(WindMillFiles.Data.wind_mill_json.read_text()[:500])" + "print(source_filepath.read_text())" ] }, { @@ -171,7 +174,7 @@ "tags": [] }, "source": [ - "As we see in the snippet above this is nested data, which is well suited for `pygen` supported ingestion" + "As we see above, this is nested data, which is well suited for `pygen` supported ingestion" ] }, { @@ -201,14 +204,14 @@ }, "outputs": [], "source": [ - "from windmill.data_classes import DomainModelWrite\n", + "from wind_turbine import data_classes as data_cls\n", "\n", - "from cognite.pygen.utils.external_id_factories import create_external_id_factory, incremental_factory, uuid_factory" + "from cognite.pygen.utils.external_id_factories import ExternalIdFactory" ] }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "metadata": { "editable": true, "slideshow": { @@ -218,7 +221,7 @@ }, "outputs": [], "source": [ - "DomainModelWrite.external_id_factory = uuid_factory" + "data_cls.DomainModelWrite.external_id_factory = ExternalIdFactory.create_external_id_factory()" ] }, { @@ -238,7 +241,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "metadata": { "editable": true, "slideshow": { @@ -248,21 +251,23 @@ }, "outputs": [], "source": [ - "from windmill.data_classes import WindmillWrite\n", + "from wind_turbine import data_classes as data_cls\n", "\n", - "fallback_factory = create_external_id_factory(suffix_ext_id_factory=incremental_factory)\n", + "fallback_factory = ExternalIdFactory.incremental_factory()\n", "\n", "\n", - "def windmill_factory(domain_cls: type, data: dict) -> str:\n", - " if domain_cls is WindmillWrite:\n", - " return data[\"name\"]\n", + "def my_factory(domain_cls: type, data: dict) -> str:\n", + " if domain_cls is data_cls.WindTurbineWrite:\n", + " return data[\"name\"].replace(\" \", \"_\")\n", " else:\n", " # Fallback to incremental\n", " return fallback_factory(domain_cls, data)\n", "\n", "\n", "# Finally, we set the new factory\n", - "DomainModelWrite.external_id_factory = windmill_factory" + "data_cls.DomainModelWrite.external_id_factory = ExternalIdFactory.create_external_id_factory(\n", + " separator=\"-\", suffix_ext_id_factory=my_factory\n", + ")" ] }, { @@ -279,12 +284,12 @@ "\n", "After we have set the `external_id_factory` we are all good to go. `pygen` is generating `pydantic` data classes which means we can use the built in support for json validation in `pydantic`\n", "\n", - "We not that we had a list of windmills, in `pydantic` we use a `TypeAdapter` to parse a list of objects" + "We not that we had a list of wind turbines, in `pydantic` we use a `TypeAdapter` to parse a list of objects" ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "metadata": {}, "outputs": [], "source": [ @@ -293,41 +298,7 @@ }, { "cell_type": "code", - "execution_count": 10, - "metadata": { - "editable": true, - "slideshow": { - "slide_type": "" - }, - "tags": [] - }, - "outputs": [], - "source": [ - "windmills = TypeAdapter(list[WindmillWrite]).validate_json(WindMillFiles.Data.wind_mill_json.read_text())" - ] - }, - { - "cell_type": "markdown", - "metadata": { - "editable": true, - "slideshow": { - "slide_type": "" - }, - "tags": [] - }, - "source": [ - "`pygen` also support `pydantic` v1. The same line above for v1 is\n", - "\n", - "```python\n", - "from pydantic import parse_as_obj\n", - "\n", - "windmills = parse_as_obj(list[WindmillWrite], WindMillFiles.Data.wind_mill_json.read_text())\n", - "```" - ] - }, - { - "cell_type": "code", - "execution_count": 11, + "execution_count": 9, "metadata": { "editable": true, "slideshow": { @@ -337,12 +308,12 @@ }, "outputs": [], "source": [ - "from windmill.data_classes import WindmillWriteList" + "turbines = TypeAdapter(list[data_cls.WindTurbineWrite]).validate_json(source_filepath.read_text())" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -368,86 +339,22 @@ " \n", " space\n", " external_id\n", - " blades\n", " capacity\n", - " metmast\n", - " nacelle\n", " name\n", - " rotor\n", + " blades\n", " windfarm\n", - " node_type\n", " data_record\n", " \n", " \n", " \n", " \n", " 0\n", - " windmill-instances\n", - " hornsea_1_mill_3\n", - " [{'space': 'windmill-instances', 'external_id'...\n", - " 7.0\n", - " []\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " hornsea_1_mill_3\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " Hornsea 1\n", - " None\n", - " {'existing_version': None}\n", - " \n", - " \n", - " 1\n", - " windmill-instances\n", - " hornsea_1_mill_2\n", - " [{'space': 'windmill-instances', 'external_id'...\n", - " 7.0\n", - " []\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " hornsea_1_mill_2\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " Hornsea 1\n", - " None\n", - " {'existing_version': None}\n", - " \n", - " \n", - " 2\n", - " windmill-instances\n", - " hornsea_1_mill_1\n", - " [{'space': 'windmill-instances', 'external_id'...\n", + " sp_wind\n", + " windturbine-Doctrino_Turbine_11\n", " 7.0\n", - " []\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " hornsea_1_mill_1\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " Hornsea 1\n", - " None\n", - " {'existing_version': None}\n", - " \n", - " \n", - " 3\n", - " windmill-instances\n", - " hornsea_1_mill_4\n", - " [{'space': 'windmill-instances', 'external_id'...\n", - " 7.0\n", - " []\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " hornsea_1_mill_4\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " Hornsea 1\n", - " None\n", - " {'existing_version': None}\n", - " \n", - " \n", - " 4\n", - " windmill-instances\n", - " hornsea_1_mill_5\n", - " [{'space': 'windmill-instances', 'external_id'...\n", - " 7.0\n", - " []\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " hornsea_1_mill_5\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " Hornsea 1\n", - " None\n", + " Doctrino Turbine 11\n", + " [{'space': 'sp_wind', 'external_id': 'blade-1'...\n", + " Oslo B2\n", " {'existing_version': None}\n", " \n", " \n", @@ -455,22 +362,18 @@ "" ], "text/plain": [ - "WindmillWriteList([WindmillWrite(space='windmill-instances', external_id='hornsea_1_mill_3', data_record=DataRecordWrite(existing_version=None), node_type=None, capacity=7.0, name='hornsea_1_mill_3', windfarm='Hornsea 1'),\n", - " WindmillWrite(space='windmill-instances', external_id='hornsea_1_mill_2', data_record=DataRecordWrite(existing_version=None), node_type=None, capacity=7.0, name='hornsea_1_mill_2', windfarm='Hornsea 1'),\n", - " WindmillWrite(space='windmill-instances', external_id='hornsea_1_mill_1', data_record=DataRecordWrite(existing_version=None), node_type=None, capacity=7.0, name='hornsea_1_mill_1', windfarm='Hornsea 1'),\n", - " WindmillWrite(space='windmill-instances', external_id='hornsea_1_mill_4', data_record=DataRecordWrite(existing_version=None), node_type=None, capacity=7.0, name='hornsea_1_mill_4', windfarm='Hornsea 1'),\n", - " WindmillWrite(space='windmill-instances', external_id='hornsea_1_mill_5', data_record=DataRecordWrite(existing_version=None), node_type=None, capacity=7.0, name='hornsea_1_mill_5', windfarm='Hornsea 1')])" + "WindTurbineWriteList([WindTurbineWrite(space='sp_wind', external_id='windturbine-Doctrino_Turbine_11', data_record=DataRecordWrite(existing_version=None), node_type=None, capacity=7.0, description=None, name='Doctrino Turbine 11', power_curve=None, windfarm='Oslo B2')])" ] }, - "execution_count": 12, + "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "# The WindmillWriteList has a few helper methods and nicer display than a regular list\n", - "windmills = WindmillWriteList(windmills)\n", - "windmills" + "turbines = data_cls.WindTurbineWriteList(turbines)\n", + "turbines" ] }, { @@ -483,12 +386,12 @@ "tags": [] }, "source": [ - "We note that the `external_id` field is set to the `name` for the windmill. If we check the other objects we see these gets an `external_id` = `class_name.lower():counter`" + "We note that the `external_id` field is set to the `name` for the turbine. If we check the other objects we see these gets an `external_id` = `class_name.lower()-counter`" ] }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 11, "metadata": { "editable": true, "slideshow": { @@ -524,11 +427,11 @@ " \n", " \n", " space\n", - " windmill-instances\n", + " sp_wind\n", " \n", " \n", " external_id\n", - " nacellewrite:1\n", + " blade-1\n", " \n", " \n", " data_record\n", @@ -539,60 +442,28 @@ " None\n", " \n", " \n", - " acc_from_back_side_x\n", - " V52-WindTurbine.Acc1N\n", + " is_damaged\n", + " False\n", " \n", " \n", - " acc_from_back_side_y\n", - " V52-WindTurbine.Acc2N\n", - " \n", - " \n", - " acc_from_back_side_z\n", - " V52-WindTurbine.Acc3N\n", - " \n", - " \n", - " gearbox\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " generator\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " high_speed_shaft\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " main_shaft\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " power_inverter\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " yaw_direction\n", - " V52-WindTurbine.yaw\n", - " \n", - " \n", - " yaw_error\n", - " V52-WindTurbine.YawErr\n", + " name\n", + " Blade A\n", " \n", " \n", "\n", "" ], "text/plain": [ - "NacelleWrite(space='windmill-instances', external_id='nacellewrite:1', data_record=DataRecordWrite(existing_version=None), node_type=None, acc_from_back_side_x='V52-WindTurbine.Acc1N', acc_from_back_side_y='V52-WindTurbine.Acc2N', acc_from_back_side_z='V52-WindTurbine.Acc3N', yaw_direction='V52-WindTurbine.yaw', yaw_error='V52-WindTurbine.YawErr')" + "BladeWrite(space='sp_wind', external_id='blade-1', data_record=DataRecordWrite(existing_version=None), node_type=None, is_damaged=False, name='Blade A')" ] }, - "execution_count": 13, + "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "windmills[0].nacelle" + "turbines[0].blades[0]" ] }, { @@ -605,12 +476,12 @@ "tags": [] }, "source": [ - "We can now upload this data by creating a domain client and call the `windmill.upsert` method. " + "We can now upload this data by creating a domain client and call the `pygen.upsert` method. " ] }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 12, "metadata": { "editable": true, "slideshow": { @@ -620,12 +491,12 @@ }, "outputs": [], "source": [ - "from windmill import WindmillClient" + "from wind_turbine import WindTurbineClient" ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 13, "metadata": { "editable": true, "slideshow": { @@ -635,12 +506,12 @@ }, "outputs": [], "source": [ - "wind = WindmillClient.from_toml(\"config.toml\")" + "pygen = WindTurbineClient.from_toml(\"config.toml\")" ] }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 14, "metadata": { "editable": true, "slideshow": { @@ -653,12 +524,12 @@ "name": "stdout", "output_type": "stream", "text": [ - "145 nodes and 105 uploaded\n" + "4 nodes and 0 uploaded\n" ] } ], "source": [ - "result = wind.upsert(windmills)\n", + "result = pygen.upsert(turbines)\n", "print(f\"{len(result.nodes)} nodes and {len(result.edges)} uploaded\")" ] }, @@ -674,14 +545,12 @@ "source": [ "Note that `pygen` have the method `.to_instances_write()` you can use to check which `nodes`and `edges` were created.\n", "\n", - "We note that `pygen` created in total 145 nodes and 105 edges between these nodes.\n", - "\n", - "The edges were of 2 different types, and then nodes were ingested into 10 different views" + "We note that `pygen` created in total 4 nodes and 0 edges." ] }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 15, "metadata": { "editable": true, "slideshow": { @@ -691,12 +560,12 @@ }, "outputs": [], "source": [ - "instances = windmills.to_instances_write()" + "instances = turbines.to_instances_write()" ] }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 16, "metadata": { "editable": true, "slideshow": { @@ -708,10 +577,10 @@ { "data": { "text/plain": [ - "(145, 105)" + "(4, 0)" ] }, - "execution_count": 20, + "execution_count": 16, "metadata": {}, "output_type": "execute_result" } @@ -722,34 +591,7 @@ }, { "cell_type": "code", - "execution_count": 21, - "metadata": { - "editable": true, - "slideshow": { - "slide_type": "" - }, - "tags": [] - }, - "outputs": [ - { - "data": { - "text/plain": [ - "(2, {'Blade.sensor_positions', 'Windmill.blades'})" - ] - }, - "execution_count": 21, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "unique = set(edge.type.external_id for edge in instances.edges)\n", - "len(unique), unique" - ] - }, - { - "cell_type": "code", - "execution_count": 22, + "execution_count": 17, "metadata": { "editable": true, "slideshow": { @@ -761,20 +603,12 @@ { "data": { "text/plain": [ - "(10,\n", - " {ViewId(space='power-models', external_id='Blade', version='1'),\n", - " ViewId(space='power-models', external_id='Gearbox', version='1'),\n", - " ViewId(space='power-models', external_id='Generator', version='1'),\n", - " ViewId(space='power-models', external_id='HighSpeedShaft', version='1'),\n", - " ViewId(space='power-models', external_id='MainShaft', version='1'),\n", - " ViewId(space='power-models', external_id='Nacelle', version='1'),\n", - " ViewId(space='power-models', external_id='PowerInverter', version='1'),\n", - " ViewId(space='power-models', external_id='Rotor', version='1'),\n", - " ViewId(space='power-models', external_id='SensorPosition', version='1'),\n", - " ViewId(space='power-models', external_id='Windmill', version='1')})" + "(2,\n", + " {ViewId(space='sp_pygen_power', external_id='Blade', version='1'),\n", + " ViewId(space='sp_pygen_power', external_id='WindTurbine', version='1')})" ] }, - "execution_count": 22, + "execution_count": 17, "metadata": {}, "output_type": "execute_result" } @@ -786,7 +620,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 18, "metadata": { "editable": true, "slideshow": { @@ -817,243 +651,52 @@ " \n", " \n", " space\n", - " instance_type\n", " external_id\n", + " instance_type\n", " sources\n", " \n", " \n", " \n", " \n", " 0\n", - " windmill-instances\n", + " sp_wind\n", + " windturbine-Doctrino_Turbine_11\n", " node\n", - " hornsea_1_mill_3\n", - " [{'properties': {'capacity': 7.0, 'nacelle': {...\n", + " [{'properties': {'blades': [{'space': 'sp_wind...\n", " \n", " \n", " 1\n", - " windmill-instances\n", + " sp_wind\n", + " blade-1\n", " node\n", - " bladewrite:1\n", " [{'properties': {'is_damaged': False, 'name': ...\n", " \n", " \n", " 2\n", - " windmill-instances\n", + " sp_wind\n", + " blade-2\n", " node\n", - " sensorpositionwrite:1\n", - " [{'properties': {'flapwise_bend_mom': 'V52-Win...\n", + " [{'properties': {'is_damaged': False, 'name': ...\n", " \n", " \n", " 3\n", - " windmill-instances\n", - " node\n", - " sensorpositionwrite:2\n", - " [{'properties': {'edgewise_bend_mom_offset': '...\n", - " \n", - " \n", - " 4\n", - " windmill-instances\n", + " sp_wind\n", + " blade-3\n", " node\n", - " sensorpositionwrite:3\n", - " [{'properties': {'edgewise_bend_mom_crosstalk_...\n", - " \n", - " \n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " \n", - " \n", - " 140\n", - " windmill-instances\n", - " node\n", - " generatorwrite:5\n", - " [{'properties': {'generator_speed_controller':...\n", - " \n", - " \n", - " 141\n", - " windmill-instances\n", - " node\n", - " highspeedshaftwrite:5\n", - " [{'properties': {'bending_moment_y': 'V52-Wind...\n", - " \n", - " \n", - " 142\n", - " windmill-instances\n", - " node\n", - " mainshaftwrite:5\n", - " [{'properties': {'bending_x': 'V52-WindTurbine...\n", - " \n", - " \n", - " 143\n", - " windmill-instances\n", - " node\n", - " powerinverterwrite:5\n", - " [{'properties': {'active_power_total': 'V52-Wi...\n", - " \n", - " \n", - " 144\n", - " windmill-instances\n", - " node\n", - " rotorwrite:5\n", - " [{'properties': {'rotor_speed_controller': 'V5...\n", + " [{'properties': {'is_damaged': True, 'name': '...\n", " \n", " \n", "\n", - "

145 rows × 4 columns

\n", "" ], "text/plain": [ - "NodeApplyList([,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ])" + "NodeApplyList([,\n", + " ,\n", + " ,\n", + " ])" ] }, - "execution_count": 23, + "execution_count": 18, "metadata": {}, "output_type": "execute_result" } @@ -1064,7 +707,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 19, "metadata": { "editable": true, "slideshow": { @@ -1094,228 +737,18 @@ " \n", " \n", " \n", - " space\n", - " instance_type\n", - " external_id\n", - " type\n", - " start_node\n", - " end_node\n", " \n", " \n", " \n", - " \n", - " 0\n", - " windmill-instances\n", - " edge\n", - " hornsea_1_mill_3:bladewrite:1\n", - " {'space': 'power-models', 'external_id': 'Wind...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " 1\n", - " windmill-instances\n", - " edge\n", - " bladewrite:1:sensorpositionwrite:1\n", - " {'space': 'power-models', 'external_id': 'Blad...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " 2\n", - " windmill-instances\n", - " edge\n", - " bladewrite:1:sensorpositionwrite:2\n", - " {'space': 'power-models', 'external_id': 'Blad...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " 3\n", - " windmill-instances\n", - " edge\n", - " bladewrite:1:sensorpositionwrite:3\n", - " {'space': 'power-models', 'external_id': 'Blad...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " 4\n", - " windmill-instances\n", - " edge\n", - " bladewrite:1:sensorpositionwrite:4\n", - " {'space': 'power-models', 'external_id': 'Blad...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " ...\n", - " \n", - " \n", - " 100\n", - " windmill-instances\n", - " edge\n", - " bladewrite:15:sensorpositionwrite:86\n", - " {'space': 'power-models', 'external_id': 'Blad...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " 101\n", - " windmill-instances\n", - " edge\n", - " bladewrite:15:sensorpositionwrite:87\n", - " {'space': 'power-models', 'external_id': 'Blad...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " 102\n", - " windmill-instances\n", - " edge\n", - " bladewrite:15:sensorpositionwrite:88\n", - " {'space': 'power-models', 'external_id': 'Blad...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " 103\n", - " windmill-instances\n", - " edge\n", - " bladewrite:15:sensorpositionwrite:89\n", - " {'space': 'power-models', 'external_id': 'Blad...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", - " \n", - " 104\n", - " windmill-instances\n", - " edge\n", - " bladewrite:15:sensorpositionwrite:90\n", - " {'space': 'power-models', 'external_id': 'Blad...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " {'space': 'windmill-instances', 'external_id':...\n", - " \n", " \n", "\n", - "

105 rows × 6 columns

\n", "" ], "text/plain": [ - "EdgeApplyList([,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ,\n", - " ])" + "EdgeApplyList([])" ] }, - "execution_count": 24, + "execution_count": 19, "metadata": {}, "output_type": "execute_result" } @@ -1326,7 +759,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 20, "metadata": { "editable": true, "slideshow": { @@ -1334,8 +767,22 @@ }, "tags": [] }, - "outputs": [], - "source": [] + "outputs": [ + { + "data": { + "text/plain": [ + "InstancesDeleteResult(nodes=[NodeId(space='sp_wind', external_id='windturbine-Doctrino_Turbine_11'), NodeId(space='sp_wind', external_id='blade-1'), NodeId(space='sp_wind', external_id='blade-2'), NodeId(space='sp_wind', external_id='blade-3')], edges=[])" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# Cleanup\n", + "pygen.delete(turbines)" + ] }, { "cell_type": "code",