Skip to content

Commit f685edc

Browse files
authored
Merge pull request #20 from unity-sds/feature/list-data-file
Updated data notebook to list .nc data instead of .cas metadata files.
2 parents e4a7d78 + 4dc1c21 commit f685edc

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

jupyter-notebooks/tutorials/2_working_with_data.ipynb

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,22 +191,24 @@
191191
"url = env['url'] + \"am-uds-dapa/collections/\"+data_set+\"/items\"\n",
192192
"\n",
193193
"params = []\n",
194-
"params.append((\"limit\", 20))\n",
194+
"#params.append((\"limit\", 20))\n",
195195
"\n",
196196
"response = requests.get(url, headers={\"Authorization\": \"Bearer \" + token}, params=params)\n",
197197
"\n",
198+
"print(f\"Endpoint: \"+url)\n",
198199
"print(f\"Total number of files: {response.json()['numberMatched']}\")\n",
199200
"print(\"File IDs, titles, and hrefs in Collection \" + data_set + \"\\n\")\n",
200201
"\n",
201202
"features = response.json()['features']\n",
202203
"\n",
203204
"for data_file in features: {\n",
204-
" print(data_file['id']),\n",
205-
" print(data_file['assets']['metadata__data']['title']),\n",
206-
" print(data_file['assets']['metadata__data']['href']),\n",
205+
" print(\"For \"+ data_file['id']),\n",
206+
" print(\"File:\\t\\t\"+data_file['assets']['data']['href']),\n",
207+
" print(\"Metadata:\\t\"+data_file['assets']['metadata__data']['href']),\n",
207208
" print(\"\")\n",
208209
"}\n",
209210
"\n",
211+
"\n",
210212
"print(\"Full JSON response object:\")\n",
211213
"JSON(response.json())\n"
212214
]
@@ -240,7 +242,7 @@
240242
"params.append((\"datetime\", \"2000-11-01T00:00:00Z/2022-11-01T02:31:12Z\"))\n",
241243
"\n",
242244
"# limit - how many results to return in a single request\n",
243-
"params.append((\"limit\", 10))\n",
245+
"#params.append((\"limit\", 10))\n",
244246
"\n",
245247
"response = requests.get(url, headers={\"Authorization\": \"Bearer \" + token}, params=params)\n",
246248
"\n",
@@ -253,6 +255,7 @@
253255
" print(data_file['id']),\n",
254256
" print(data_file['properties']['created']),\n",
255257
" print(data_file['assets']['metadata__data']['href']),\n",
258+
" print(data_file['assets']['data']['href']),\n",
256259
" print(\"\")\n",
257260
" }\n",
258261
" # Get the next page of results\n",
@@ -433,6 +436,7 @@
433436
"import xarray as xr\n",
434437
"ds = xr.open_dataset('test_file11.nc')\n",
435438
"ds"
439+
436440
]
437441
},
438442
{

0 commit comments

Comments
 (0)