Skip to content

Commit e16b6db

Browse files
committed
fix: variable names and lint
Not complete b/c some of the queries don't return
1 parent ac5d8de commit e16b6db

8 files changed

+289
-121
lines changed

datasets/met-office/met-office-global-deterministic-height.ipynb

Lines changed: 50 additions & 15 deletions
Large diffs are not rendered by default.

datasets/met-office/met-office-global-deterministic-near-surface.ipynb

Lines changed: 46 additions & 17 deletions
Large diffs are not rendered by default.

datasets/met-office/met-office-global-deterministic-pressure.ipynb

Lines changed: 53 additions & 18 deletions
Large diffs are not rendered by default.

datasets/met-office/met-office-global-deterministic-whole-atmosphere.ipynb

Lines changed: 46 additions & 17 deletions
Large diffs are not rendered by default.

datasets/met-office/met-office-uk-deterministic-height.ipynb

Lines changed: 50 additions & 17 deletions
Large diffs are not rendered by default.

datasets/met-office/met-office-uk-deterministic-near-surface.ipynb

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
},
1919
{
2020
"cell_type": "code",
21-
"execution_count": null,
21+
"execution_count": 1,
2222
"id": "4bafd899",
2323
"metadata": {},
2424
"outputs": [],
@@ -49,18 +49,18 @@
4949
"source": [
5050
"collections = [\"met-office-uk-deterministic-near-surface\"]\n",
5151
"asset_id = \"temperature_at_surface\"\n",
52-
"datacube_extension_filters = {\n",
52+
"forecast_extension_filters = {\n",
5353
" \"op\": \"and\",\n",
5454
" \"args\": [\n",
5555
" {\n",
5656
" \"op\": \"=\",\n",
57-
" \"args\": [ { \"property\": \"forecast:reference_datetime\" }, \"2025-12-05T18:00:00Z\" ]\n",
57+
" \"args\": [\n",
58+
" {\"property\": \"forecast:reference_datetime\"},\n",
59+
" \"2026-01-21T09:00:00Z\",\n",
60+
" ],\n",
5861
" },\n",
59-
" {\n",
60-
" \"op\": \"=\",\n",
61-
" \"args\": [ { \"property\": \"forecast:horizon\" }, \"PT0001H00M\" ]\n",
62-
" }\n",
63-
" ]\n",
62+
" {\"op\": \"=\", \"args\": [{\"property\": \"forecast:horizon\"}, \"PT0054H00M\"]},\n",
63+
" ],\n",
6464
"}"
6565
]
6666
},
@@ -77,16 +77,27 @@
7777
"execution_count": null,
7878
"id": "edb71afa",
7979
"metadata": {},
80-
"outputs": [],
80+
"outputs": [
81+
{
82+
"ename": "StopIteration",
83+
"evalue": "",
84+
"output_type": "error",
85+
"traceback": [
86+
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
87+
"\u001b[31mStopIteration\u001b[39m Traceback (most recent call last)",
88+
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[19]\u001b[39m\u001b[32m, line 6\u001b[39m\n\u001b[32m 1\u001b[39m search = catalog.search(\n\u001b[32m 2\u001b[39m collections=collections,\n\u001b[32m 3\u001b[39m datetime=\u001b[33m\"\u001b[39m\u001b[33m2026-01-21T09:00:00Z\u001b[39m\u001b[33m\"\u001b[39m,\n\u001b[32m 4\u001b[39m )\n\u001b[32m----> \u001b[39m\u001b[32m6\u001b[39m asset_url = \u001b[38;5;28;43mnext\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43mitem\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mfor\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mitem\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;129;43;01min\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43msearch\u001b[49m\u001b[43m.\u001b[49m\u001b[43mitems\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43;01mif\u001b[39;49;00m\u001b[43m \u001b[49m\u001b[43mitem\u001b[49m\u001b[43m.\u001b[49m\u001b[43mproperties\u001b[49m\u001b[43m[\u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mforecast:horizon\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m \u001b[49m\u001b[43m==\u001b[49m\u001b[43m \u001b[49m\u001b[33;43m\"\u001b[39;49m\u001b[33;43mPT0054H00M\u001b[39;49m\u001b[33;43m\"\u001b[39;49m\u001b[43m)\u001b[49m.assets[asset_id].href\n",
89+
"\u001b[31mStopIteration\u001b[39m: "
90+
]
91+
}
92+
],
8193
"source": [
8294
"search = catalog.search(\n",
8395
" collections=collections,\n",
84-
" filter_lang= \"cql2-json\",\n",
85-
" filter=datacube_extension_filters\n",
96+
" filter_lang=\"cql2-json\",\n",
97+
" filter=forecast_extension_filters,\n",
8698
")\n",
8799
"\n",
88-
"items = search.item_collection()\n",
89-
"asset_url = items.items[0].assets[asset_id].href"
100+
"asset_url = next(search.items()).assets[asset_id].href"
90101
]
91102
},
92103
{
@@ -116,7 +127,7 @@
116127
],
117128
"metadata": {
118129
"kernelspec": {
119-
"display_name": ".venv",
130+
"display_name": "PlanetaryComputerExamples",
120131
"language": "python",
121132
"name": "python3"
122133
},
@@ -130,7 +141,7 @@
130141
"name": "python",
131142
"nbconvert_exporter": "python",
132143
"pygments_lexer": "ipython3",
133-
"version": "3.13.11"
144+
"version": "3.13.2"
134145
}
135146
},
136147
"nbformat": 4,

datasets/met-office/met-office-uk-deterministic-pressure.ipynb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@
4949
"source": [
5050
"collections = [\"met-office-uk-deterministic-pressure\"]\n",
5151
"asset_id = \"wet_bulb_potential_temperature_on_pressure_levels\"\n",
52-
"datacube_extension_filters = {\n",
52+
"forecast_extension_filters = {\n",
5353
" \"op\": \"and\",\n",
5454
" \"args\": [\n",
5555
" {\n",
5656
" \"op\": \"=\",\n",
57-
" \"args\": [ { \"property\": \"forecast:reference_datetime\" }, \"2026-01-14T12:00:00Z\" ]\n",
57+
" \"args\": [\n",
58+
" {\"property\": \"forecast:reference_datetime\"},\n",
59+
" \"2026-01-14T12:00:00Z\",\n",
60+
" ],\n",
5861
" },\n",
59-
" {\n",
60-
" \"op\": \"=\",\n",
61-
" \"args\": [ { \"property\": \"forecast:horizon\" }, \"PT0052H00M\" ]\n",
62-
" }\n",
63-
" ]\n",
62+
" {\"op\": \"=\", \"args\": [{\"property\": \"forecast:horizon\"}, \"PT0052H00M\"]},\n",
63+
" ],\n",
6464
"}"
6565
]
6666
},
@@ -80,9 +80,7 @@
8080
"outputs": [],
8181
"source": [
8282
"search = catalog.search(\n",
83-
" collections=collections,\n",
84-
" filter_lang= \"cql2-json\",\n",
85-
" filter=datacube_extension_filters\n",
83+
" collections=collections, filter_lang=\"cql2-json\", filter=forecast_extension_filters\n",
8684
")\n",
8785
"\n",
8886
"items = search.item_collection()\n",
@@ -135,4 +133,4 @@
135133
},
136134
"nbformat": 4,
137135
"nbformat_minor": 5
138-
}
136+
}

datasets/met-office/met-office-uk-deterministic-whole-atmosphere.ipynb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@
4949
"source": [
5050
"collections = [\"met-office-uk-deterministic-whole-atmosphere\"]\n",
5151
"asset_id = \"lightning_flash_accumulation-PT01H\"\n",
52-
"datacube_extension_filters = {\n",
52+
"forecast_extension_filters = {\n",
5353
" \"op\": \"and\",\n",
5454
" \"args\": [\n",
5555
" {\n",
5656
" \"op\": \"=\",\n",
57-
" \"args\": [ { \"property\": \"forecast:reference_datetime\" }, \"2025-12-05T18:00:00Z\" ]\n",
57+
" \"args\": [\n",
58+
" {\"property\": \"forecast:reference_datetime\"},\n",
59+
" \"2025-12-05T18:00:00Z\",\n",
60+
" ],\n",
5861
" },\n",
59-
" {\n",
60-
" \"op\": \"=\",\n",
61-
" \"args\": [ { \"property\": \"forecast:horizon\" }, \"PT0037H00M\" ]\n",
62-
" }\n",
63-
" ]\n",
62+
" {\"op\": \"=\", \"args\": [{\"property\": \"forecast:horizon\"}, \"PT0037H00M\"]},\n",
63+
" ],\n",
6464
"}"
6565
]
6666
},
@@ -80,9 +80,7 @@
8080
"outputs": [],
8181
"source": [
8282
"search = catalog.search(\n",
83-
" collections=collections,\n",
84-
" filter_lang= \"cql2-json\",\n",
85-
" filter=datacube_extension_filters\n",
83+
" collections=collections, filter_lang=\"cql2-json\", filter=forecast_extension_filters\n",
8684
")\n",
8785
"\n",
8886
"items = search.item_collection()\n",
@@ -136,4 +134,4 @@
136134
},
137135
"nbformat": 4,
138136
"nbformat_minor": 5
139-
}
137+
}

0 commit comments

Comments
 (0)