Skip to content

Commit

Permalink
Add Stats3D example WPS process
Browse files Browse the repository at this point in the history
Add TERN APIKey Auth flow to each of the WPS examples
  • Loading branch information
ashleysommer committed Aug 3, 2023
1 parent e0392db commit e83051c
Show file tree
Hide file tree
Showing 5 changed files with 786 additions and 165 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
env
certs
/tds-examples/python/shell
/venv/
/.venv/
myfile.tif
50 changes: 35 additions & 15 deletions wps-examples/DrillPoint.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,36 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 1,
"id": "4deb3017-3d62-49b8-b964-c0eaaa668c78",
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2023-08-03T03:37:44.613721181Z",
"start_time": "2023-08-03T03:37:44.347553956Z"
}
},
"outputs": [],
"source": [
"from owslib.wps import WebProcessingService, ComplexDataInput, monitorExecution\n",
"from owslib import wps\n",
"import matplotlib\n",
"from owslib.wps import WebProcessingService, ComplexDataInput, Authentication\n",
"import json\n",
"import pandas as pd\n",
"import logging\n",
"import sys\n",
"import io\n",
"import time\n",
"from ipyleaflet import Map, GeoJSON, basemaps"
]
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 2,
"id": "88d27dbf-3f88-4adb-bda9-ebdea49ec364",
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2023-08-03T03:47:12.587917467Z",
"start_time": "2023-08-03T03:47:12.543037220Z"
}
},
"outputs": [],
"source": [
"# Set up owslib logging, to set relevant output\n",
Expand All @@ -62,9 +71,14 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 3,
"id": "5ee54f12-04e0-4d8e-b1ff-02fb4426a14a",
"metadata": {},
"metadata": {
"ExecuteTime": {
"end_time": "2023-08-03T03:47:13.908522654Z",
"start_time": "2023-08-03T03:47:13.904448134Z"
}
},
"outputs": [],
"source": [
"ENDPOINT=\"https://funcwps.ternlandscapes.org.au/wps/\"\n",
Expand All @@ -91,7 +105,9 @@
"metadata": {},
"outputs": [],
"source": [
"server = WebProcessingService(ENDPOINT, verbose=False)"
"TERN_APIKEY = \"N045_example_U0RySC5DDEF_replace_me_JOVpQVkdXezZMeC5ZWwlaNHxwDDQtDHsu\"\n",
"AUTH = Authentication(\"apikey\", password=TERN_APIKEY, shared=True)\n",
"server = WebProcessingService(ENDPOINT, auth=AUTH)"
]
},
{
Expand Down Expand Up @@ -261,10 +277,14 @@
}
],
"source": [
"while not resp.isComplete():\n",
" print(\"Waiting for process...\")\n",
" resp.checkStatus(sleepSecs=2)\n",
"print(\"Done.\")"
"print(\"Waiting for process to complete...\")\n",
"while True:\n",
" resp.checkStatus(sleepSecs=0)\n",
" print(f\"Progress: {resp.percentCompleted}, {resp.statusMessage}\")\n",
" if resp.isComplete():\n",
" break\n",
" time.sleep(2)\n",
"print(\"Done\")"
]
},
{
Expand Down Expand Up @@ -434,7 +454,7 @@
}
],
"source": [
"df.plot.line(x=\"date\", y=LAYER)"
"df.plot.line(x=\"date\", y=LAYER, ylim=0)"
]
},
{
Expand Down
Loading

0 comments on commit e83051c

Please sign in to comment.