From 031689dd4dfee38faf57a54f4357a0b94ac7909b Mon Sep 17 00:00:00 2001 From: Owen Littlejohns Date: Mon, 30 Oct 2023 18:30:13 -0400 Subject: [PATCH] Update basic.ipynb to ensure GeoTIFF outputs. --- examples/basic.ipynb | 57 +++++++++++++++++++++++++------------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/examples/basic.ipynb b/examples/basic.ipynb index 6a2d0d2..cec8e9f 100644 --- a/examples/basic.ipynb +++ b/examples/basic.ipynb @@ -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", ")" ] }, @@ -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.')" ] }, @@ -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)" ] @@ -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)" ] @@ -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)" ] @@ -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}')" ] }, { @@ -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}')" ] }, { @@ -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}')" ] }, { @@ -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)" ] }, @@ -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()" ] @@ -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)" ] @@ -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": { @@ -656,7 +663,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.2" + "version": "3.10.13" }, "vscode": { "interpreter": {