Skip to content

Commit

Permalink
Update basic.ipynb to ensure GeoTIFF outputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
owenlittlejohns committed Oct 30, 2023
1 parent 1c894a0 commit 031689d
Showing 1 changed file with 32 additions and 25 deletions.
57 changes: 32 additions & 25 deletions examples/basic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@
"\n",
"request = Request(\n",
" collection=collection,\n",
" spatial=BBox(-165, 52, -140, 77)\n",
" spatial=BBox(-165, 52, -140, 77),\n",
" format='image/tiff'\n",
")"
]
},
Expand Down Expand Up @@ -167,15 +168,17 @@
"metadata": {},
"outputs": [],
"source": [
"print(f'\\n{job1_id}')\n",
"print(f'\\nHarmony job ID: {job1_id}')\n",
"\n",
"print('\\nWaiting for the job to finish')\n",
"results = harmony_client.result_json(job1_id, show_progress=True)\n",
"\n",
"print('\\nDownloading results:')\n",
"futures = harmony_client.download_all(job1_id)\n",
"\n",
"for f in futures:\n",
" print(f.result()) # f.result() is a filename, in this case\n",
"\n",
"print('\\nDone downloading.')"
]
},
Expand All @@ -194,9 +197,9 @@
"metadata": {},
"outputs": [],
"source": [
"\n",
"futures = harmony_client.download_all(job1_id, overwrite=False)\n",
"filenames = [f.result() for f in futures]\n",
"\n",
"for filename in filenames:\n",
" helper.show_result(filename)"
]
Expand All @@ -221,7 +224,9 @@
" temporal={\n",
" 'start': dt.datetime(2020, 6, 1),\n",
" 'stop': dt.datetime(2020, 6, 30)\n",
" })\n",
" },\n",
" format='image/tiff'\n",
")\n",
"\n",
"job2_id = harmony_client.submit(request)"
]
Expand Down Expand Up @@ -268,7 +273,9 @@
" temporal={\n",
" 'start': dt.datetime(2010, 1, 1),\n",
" 'stop': dt.datetime(2020, 12, 30)\n",
" })\n",
" },\n",
" format='image/tiff'\n",
")\n",
"\n",
"job3_id = harmony_client.submit(request)"
]
Expand Down Expand Up @@ -339,12 +346,14 @@
"\n",
"request = Request(\n",
" collection=collection,\n",
" spatial=BBox(-183, 40, 10, 30)\n",
" spatial=BBox(-183, 40, 10, 30),\n",
" format='image/tiff'\n",
")\n",
"\n",
"print(f\"Request valid? {request.is_valid()}\")\n",
"print(f'Request valid? {request.is_valid()}')\n",
"\n",
"for m in request.error_messages():\n",
" print(\" * \" + m)"
" print(f' * {m}')"
]
},
{
Expand All @@ -369,12 +378,14 @@
" temporal={\n",
" 'start': dt.datetime(2020, 12, 30),\n",
" 'stop': dt.datetime(2010, 1, 1)\n",
" }\n",
" },\n",
" format='image/tiff'\n",
")\n",
"\n",
"print(f\"Request valid? {request.is_valid()}\")\n",
"print(f'Request valid? {request.is_valid()}')\n",
"\n",
"for m in request.error_messages():\n",
" print(\" * \" + m)"
" print(f' * {m}')"
]
},
{
Expand All @@ -400,12 +411,14 @@
" temporal={\n",
" 'start': dt.datetime(2020, 12, 30),\n",
" 'stop': dt.datetime(2010, 1, 1)\n",
" }\n",
" },\n",
" format='image/tiff'\n",
")\n",
"\n",
"print(f\"Request valid? {request.is_valid()}\")\n",
"print(f'Request valid? {request.is_valid()}')\n",
"\n",
"for m in request.error_messages():\n",
" print(\" * \" + m)"
" print(f' * {m}')"
]
},
{
Expand All @@ -426,7 +439,7 @@
"try:\n",
" harmony_client.submit(request)\n",
"except Exception as e:\n",
" print(\"Harmony Py raised an exception:\\n\")\n",
" print('Harmony Py raised an exception:\\n')\n",
" print(e)"
]
},
Expand Down Expand Up @@ -456,7 +469,8 @@
" 'start': dt.datetime(2021, 1, 1),\n",
" 'stop': dt.datetime(2021, 1, 10)\n",
" },\n",
" max_results=2\n",
" max_results=2,\n",
" format='image/tiff'\n",
")\n",
"request.is_valid()"
]
Expand Down Expand Up @@ -498,6 +512,7 @@
"outputs": [],
"source": [
"job_id = harmony_client.submit(request)\n",
"\n",
"for filename in [f.result() for f in harmony_client.download_all(job_id)]:\n",
" helper.show_result(filename)"
]
Expand Down Expand Up @@ -630,14 +645,6 @@
"for filename in [f.result() for f in harmony_client.download_all(job_id)]:\n",
" helper.show_result(filename)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cd883298-4642-4128-baff-e4291fb4d00d",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -656,7 +663,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
"version": "3.10.13"
},
"vscode": {
"interpreter": {
Expand Down

0 comments on commit 031689d

Please sign in to comment.