diff --git a/How_to_guides/Machine_learning_with_ODC.ipynb b/How_to_guides/Machine_learning_with_ODC.ipynb index cd699548f..4be473721 100644 --- a/How_to_guides/Machine_learning_with_ODC.ipynb +++ b/How_to_guides/Machine_learning_with_ODC.ipynb @@ -64,6 +64,7 @@ "source": [ "%matplotlib inline\n", "\n", + "import os\n", "import subprocess as sp\n", "import shapely\n", "import xarray as xr\n", @@ -160,8 +161,11 @@ } ], "source": [ - "ncpus=round(get_cpu_quota())\n", - "print(ncpus)" + "if get_cpu_quota() is not None:\n", + " ncpus = round(get_cpu_quota())\n", + "else:\n", + " ncpus = os.cpu_count()\n", + "print(f\"ncpus = {ncpus}\")" ] }, { @@ -880,101 +884,7 @@ }, "widgets": { "application/vnd.jupyter.widget-state+json": { - "state": { - "1619aa7c0a0d41f892bc55d700874aba": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "1.5.0", - "model_name": "HTMLModel", - "state": { - "layout": "IPY_MODEL_ef7c7b47129f4bb7be210a31c9c6748c", - "style": "IPY_MODEL_6c45957fae8a4c9c90d0efa71fb7acd3", - "value": "100%" - } - }, - "1b9dd35d726a487c9e03b50cadec204e": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "1.2.0", - "model_name": "LayoutModel", - "state": {} - }, - "27c2edfba16545549cbc2446f65308f9": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "1.5.0", - "model_name": "ProgressStyleModel", - "state": { - "description_width": "" - } - }, - "43e325ac2f4b42659d9ae321464c5dd1": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "1.5.0", - "model_name": "FloatProgressModel", - "state": { - "bar_style": "success", - "layout": "IPY_MODEL_9b47cb4d6d96465b8a2446bc022c085d", - "max": 217, - "style": "IPY_MODEL_27c2edfba16545549cbc2446f65308f9", - "value": 217 - } - }, - "5ce2388f84c64f1eb830509fab75e200": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "1.5.0", - "model_name": "HBoxModel", - "state": { - "children": [ - "IPY_MODEL_1619aa7c0a0d41f892bc55d700874aba", - "IPY_MODEL_43e325ac2f4b42659d9ae321464c5dd1", - "IPY_MODEL_e6391b33874b4787837251849ceb2b1c" - ], - "layout": "IPY_MODEL_cc67c362ea5f4f80bfa29df7189ad3e6" - } - }, - "6c45957fae8a4c9c90d0efa71fb7acd3": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "1.5.0", - "model_name": "DescriptionStyleModel", - "state": { - "description_width": "" - } - }, - "91df15d5486440d6a2125e74e9befe48": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "1.5.0", - "model_name": "DescriptionStyleModel", - "state": { - "description_width": "" - } - }, - "9b47cb4d6d96465b8a2446bc022c085d": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "1.2.0", - "model_name": "LayoutModel", - "state": {} - }, - "cc67c362ea5f4f80bfa29df7189ad3e6": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "1.2.0", - "model_name": "LayoutModel", - "state": {} - }, - "e6391b33874b4787837251849ceb2b1c": { - "model_module": "@jupyter-widgets/controls", - "model_module_version": "1.5.0", - "model_name": "HTMLModel", - "state": { - "layout": "IPY_MODEL_1b9dd35d726a487c9e03b50cadec204e", - "style": "IPY_MODEL_91df15d5486440d6a2125e74e9befe48", - "value": " 217/217 [01:53<00:00, 2.18it/s]" - } - }, - "ef7c7b47129f4bb7be210a31c9c6748c": { - "model_module": "@jupyter-widgets/base", - "model_module_version": "1.2.0", - "model_name": "LayoutModel", - "state": {} - } - }, + "state": {}, "version_major": 2, "version_minor": 0 } diff --git a/Real_world_examples/Scalable_machine_learning/1_Extract_training_data.ipynb b/Real_world_examples/Scalable_machine_learning/1_Extract_training_data.ipynb index e7c968381..348f3e3ab 100644 --- a/Real_world_examples/Scalable_machine_learning/1_Extract_training_data.ipynb +++ b/Real_world_examples/Scalable_machine_learning/1_Extract_training_data.ipynb @@ -62,7 +62,9 @@ { "cell_type": "code", "execution_count": 1, - "metadata": {}, + "metadata": { + "tags": [] + }, "outputs": [], "source": [ "%matplotlib inline\n", @@ -98,7 +100,9 @@ { "cell_type": "code", "execution_count": 2, - "metadata": {}, + "metadata": { + "tags": [] + }, "outputs": [], "source": [ "path = 'data/crop_training_WA.geojson' \n", @@ -115,7 +119,9 @@ { "cell_type": "code", "execution_count": 3, - "metadata": {}, + "metadata": { + "tags": [] + }, "outputs": [ { "name": "stdout", @@ -126,13 +132,18 @@ } ], "source": [ - "ncpus = round(get_cpu_quota())\n", - "print('ncpus = ' + str(ncpus))" + "if get_cpu_quota() is not None:\n", + " ncpus = round(get_cpu_quota())\n", + "else:\n", + " ncpus = os.cpu_count()\n", + "print(f\"ncpus = {ncpus}\")" ] }, { "cell_type": "markdown", - "metadata": {}, + "metadata": { + "tags": [] + }, "source": [ "## Preview input data\n", "\n", @@ -144,7 +155,9 @@ { "cell_type": "code", "execution_count": 4, - "metadata": {}, + "metadata": { + "tags": [] + }, "outputs": [ { "data": { @@ -226,15 +239,240 @@ { "cell_type": "code", "execution_count": 5, - "metadata": {}, + "metadata": { + "tags": [] + }, "outputs": [ { "data": { "text/html": [ - "
Make this Notebook Trusted to load map: File -> Trust Notebook
" + "
Make this Notebook Trusted to load map: File -> Trust Notebook
" ], "text/plain": [ - "" + "" ] }, "execution_count": 5, @@ -267,7 +505,9 @@ { "cell_type": "code", "execution_count": 6, - "metadata": {}, + "metadata": { + "tags": [] + }, "outputs": [], "source": [ "# Set up our inputs to collect_training_data\n", @@ -282,7 +522,9 @@ { "cell_type": "code", "execution_count": 7, - "metadata": {}, + "metadata": { + "tags": [] + }, "outputs": [], "source": [ "# Generate a new datacube query object\n", @@ -315,7 +557,9 @@ { "cell_type": "code", "execution_count": 8, - "metadata": {}, + "metadata": { + "tags": [] + }, "outputs": [], "source": [ "def feature_layers(query):\n", @@ -356,9 +600,44 @@ }, { "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], + "execution_count": 9, + "metadata": { + "tags": [] + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting training data in parallel mode\n" + ] + }, + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "75d1233ecac64003b88f3140473014d4", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + " 0%| | 0/430 [00:00