From 9e57da3332709e356e39aad02093e4ac59731e82 Mon Sep 17 00:00:00 2001 From: Patrick Date: Fri, 20 Dec 2024 16:09:55 +0100 Subject: [PATCH] update tools/do_shapefile_polygon.ipynb --- tools/do_shapefile_polygon.ipynb | 39 +++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/tools/do_shapefile_polygon.ipynb b/tools/do_shapefile_polygon.ipynb index 710f090..95df25d 100644 --- a/tools/do_shapefile_polygon.ipynb +++ b/tools/do_shapefile_polygon.ipynb @@ -2,10 +2,18 @@ "cells": [ { "cell_type": "code", - "execution_count": 2, + "execution_count": 1, "id": "2b6df08b", "metadata": {}, "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "/albedo/home/pscholz/tripyview/tripyview/sub_data.py:8: UserWarning: The seawater library is deprecated! Please use gsw instead.\n", + " import seawater as sw\n" + ] + }, { "name": "stdout", "output_type": "stream", @@ -40,7 +48,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 2, "id": "fe7b8b50", "metadata": { "scrolled": false @@ -106,7 +114,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 3, "id": "efccc7f1", "metadata": { "scrolled": false @@ -309,6 +317,15 @@ " }\n", "\n", " this.resizeObserverInstance = new this.ResizeObserver(function (entries) {\n", + " // There's no need to resize if the WebSocket is not connected:\n", + " // - If it is still connecting, then we will get an initial resize from\n", + " // Python once it connects.\n", + " // - If it has disconnected, then resizing will clear the canvas and\n", + " // never get anything back to refill it, so better to not resize and\n", + " // keep something visible.\n", + " if (fig.ws.readyState != 1) {\n", + " return;\n", + " }\n", " var nentries = entries.length;\n", " for (var i = 0; i < nentries; i++) {\n", " var entry = entries[i];\n", @@ -356,7 +373,7 @@ " // And update the size in Python. We ignore the initial 0/0 size\n", " // that occurs as the element is placed into the DOM, which should\n", " // otherwise not happen due to the minimum size styling.\n", - " if (fig.ws.readyState == 1 && width != 0 && height != 0) {\n", + " if (width != 0 && height != 0) {\n", " fig.request_resize(width, height);\n", " }\n", " }\n", @@ -1100,7 +1117,7 @@ { "data": { "text/html": [ - "" + "" ], "text/plain": [ "" @@ -1118,17 +1135,17 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 4, "id": "0a5871d6", "metadata": {}, "outputs": [ { "data": { "image/svg+xml": [ - "" + "" ], "text/plain": [ - "" + "" ] }, "metadata": {}, @@ -1150,7 +1167,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 5, "id": "355b9eef", "metadata": {}, "outputs": [], @@ -1160,7 +1177,7 @@ "sdname='~/tripyview/tripyview/shapefiles/moc_basins/'\n", "\n", "# save filename \n", - "sfname='MY_MOC.shp'\n", + "sfname='Atlantic_34.8S_MOC.shp'\n", "\n", "# name of polygon\n", "str_moc ='amoc' \n", @@ -1193,7 +1210,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.9.19" + "version": "3.9.20" }, "latex_envs": { "LaTeX_envs_menu_present": true,