{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Building an observation network" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import netsse" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "PlatformHGABV\n" ] } ], "source": [ "vessel1 = netsse.base.Platform('Containership1')\n", "vessel2 = netsse.base.Platform('RoRo1')\n", "vessel3 = netsse.base.Platform()\n", "print(vessel3.name)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[('Containership1', 'undefined'), ('RoRo1', 'undefined')]\n" ] } ], "source": [ "network = netsse.base.Network(name='TestNetwork',nature='test',platforms=[vessel1,vessel2])\n", "print([(platform.name,platform.owner) for platform in network.platforms])" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Platform 'PlatformHGABV' was added to the network.\n", "[('Containership1', 'undefined'), ('RoRo1', 'undefined'), ('PlatformHGABV', 'undefined')]\n" ] } ], "source": [ "network.add_platform(vessel3)\n", "print([(platform.name,platform.owner) for platform in network.platforms])" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Platform 'RoRo1' was updated with new information.\n", "[('Containership1', 'undefined'), ('RoRo1', 'SomeCompany'), ('PlatformHGABV', 'undefined')]\n" ] } ], "source": [ "vessel2.owner = 'SomeCompany'\n", "network.add_platform(vessel2)\n", "print([(platform.name,platform.owner) for platform in network.platforms])" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Platform 'PlatformHGABV' was removed from the network.\n", "Platform 'Containership1' was removed from the network.\n", "[('RoRo1', 'SomeCompany')]\n" ] } ], "source": [ "network.remove_platform(vessel3,'Containership1','NonExistentShip')\n", "print([(platform.name,platform.owner) for platform in network.platforms])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "jupyter_env", "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.12.4" } }, "nbformat": 4, "nbformat_minor": 2 }