From 79e0c1b688f2988842a10e47d54a261746553f8f Mon Sep 17 00:00:00 2001 From: Aimee Barciauskas Date: Wed, 4 Dec 2024 19:18:14 -0800 Subject: [PATCH] Updated notebook --- noaa-cdr-sst.ipynb | 100 +++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 66 deletions(-) diff --git a/noaa-cdr-sst.ipynb b/noaa-cdr-sst.ipynb index 937969bf..a94bfcba 100644 --- a/noaa-cdr-sst.ipynb +++ b/noaa-cdr-sst.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "d09bbff3-4e96-4490-b837-14b78b64df35", "metadata": {}, "outputs": [], @@ -14,7 +14,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "3055eff4-9e22-4a95-a7fd-96933f381183", "metadata": {}, "outputs": [ @@ -41,7 +41,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "id": "2f69f0bb-316b-452c-b1ba-4d7ef4afcf67", "metadata": {}, "outputs": [], @@ -59,7 +59,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "id": "1532c33b-804f-49fa-9fa9-0eb42ea87e26", "metadata": {}, "outputs": [], @@ -75,7 +75,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 5, "id": "06bbec92-3974-4859-8bda-353afc7800b9", "metadata": {}, "outputs": [], @@ -90,7 +90,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "id": "77fb94c8-870f-4c9e-8421-ac9c17402122", "metadata": {}, "outputs": [], @@ -106,7 +106,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 7, "id": "abefd6fa-386a-4e07-a7c8-219d3730eeeb", "metadata": {}, "outputs": [], @@ -116,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 8, "id": "79a4228a-0e17-4b07-9144-f24fe06db832", "metadata": {}, "outputs": [], @@ -129,50 +129,33 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 9, "id": "5fd0c082-8d5e-46a8-a994-fee80baa4ecc", "metadata": {}, "outputs": [], "source": [ - "store = await IcechunkStore.create(\n", + "store = IcechunkStore.create(\n", " storage=storage_config, config=virtual_ref_store_config, read_only=False\n", ")" ] }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 10, "id": "55ebbc5f-add2-4de8-81f6-5aaf64d9e2b6", "metadata": {}, "outputs": [ { - "name": "stderr", - "output_type": "stream", - "text": [ - "/Users/aimeebarciauskas/github/virtualizarr/virtualizarr/writers/icechunk.py:272: RuntimeWarning: coroutine 'IcechunkStore.set_virtual_ref' was never awaited\n", - " store.set_virtual_ref(\n", - "RuntimeWarning: Enable tracemalloc to get the object allocation traceback\n", - "/Users/aimeebarciauskas/github/virtualizarr/virtualizarr/writers/icechunk.py:272: RuntimeWarning: coroutine 'IcechunkStore.set_virtual_ref' was never awaited\n", - " store.set_virtual_ref(\n", - "RuntimeWarning: Enable tracemalloc to get the object allocation traceback\n", - "/Users/aimeebarciauskas/github/virtualizarr/virtualizarr/writers/icechunk.py:272: RuntimeWarning: coroutine 'IcechunkStore.set_virtual_ref' was never awaited\n", - " store.set_virtual_ref(\n", - "RuntimeWarning: Enable tracemalloc to get the object allocation traceback\n", - "/Users/aimeebarciauskas/github/virtualizarr/virtualizarr/writers/icechunk.py:272: RuntimeWarning: coroutine 'IcechunkStore.set_virtual_ref' was never awaited\n", - " store.set_virtual_ref(\n", - "RuntimeWarning: Enable tracemalloc to get the object allocation traceback\n", - "/Users/aimeebarciauskas/github/virtualizarr/virtualizarr/writers/icechunk.py:272: RuntimeWarning: coroutine 'IcechunkStore.set_virtual_ref' was never awaited\n", - " store.set_virtual_ref(\n", - "RuntimeWarning: Enable tracemalloc to get the object allocation traceback\n", - "/Users/aimeebarciauskas/github/virtualizarr/virtualizarr/writers/icechunk.py:272: RuntimeWarning: coroutine 'IcechunkStore.set_virtual_ref' was never awaited\n", - " store.set_virtual_ref(\n", - "RuntimeWarning: Enable tracemalloc to get the object allocation traceback\n", - "/Users/aimeebarciauskas/github/virtualizarr/virtualizarr/writers/icechunk.py:272: RuntimeWarning: coroutine 'IcechunkStore.set_virtual_ref' was never awaited\n", - " store.set_virtual_ref(\n", - "RuntimeWarning: Enable tracemalloc to get the object allocation traceback\n", - "/Users/aimeebarciauskas/github/virtualizarr/virtualizarr/writers/icechunk.py:272: RuntimeWarning: coroutine 'IcechunkStore.set_virtual_ref' was never awaited\n", - " store.set_virtual_ref(\n", - "RuntimeWarning: Enable tracemalloc to get the object allocation traceback\n" + "ename": "TypeError", + "evalue": "expected type IcechunkStore, but got type ", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[10], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mvirtual_ds\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvirtualize\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mto_icechunk\u001b[49m\u001b[43m(\u001b[49m\u001b[43mstore\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/github/virtualizarr/virtualizarr/accessor.py:58\u001b[0m, in \u001b[0;36mVirtualiZarrDatasetAccessor.to_icechunk\u001b[0;34m(self, store, append_dim)\u001b[0m\n\u001b[1;32m 44\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 45\u001b[0m \u001b[38;5;124;03mWrite an xarray dataset to an Icechunk store.\u001b[39;00m\n\u001b[1;32m 46\u001b[0m \n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[38;5;124;03mappend_dim: str, optional\u001b[39;00m\n\u001b[1;32m 55\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 56\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mvirtualizarr\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mwriters\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01micechunk\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m dataset_to_icechunk\n\u001b[0;32m---> 58\u001b[0m \u001b[43mdataset_to_icechunk\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mds\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstore\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mappend_dim\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mappend_dim\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/github/virtualizarr/virtualizarr/writers/icechunk.py:47\u001b[0m, in \u001b[0;36mdataset_to_icechunk\u001b[0;34m(ds, store, append_dim)\u001b[0m\n\u001b[1;32m 42\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mImportError\u001b[39;00m(\n\u001b[1;32m 43\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mThe \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124micechunk\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m and \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mzarr\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m version 3 libraries are required to use this function\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 44\u001b[0m )\n\u001b[1;32m 46\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(store, IcechunkStore):\n\u001b[0;32m---> 47\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mTypeError\u001b[39;00m(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mexpected type IcechunkStore, but got type \u001b[39m\u001b[38;5;132;01m{\u001b[39;00m\u001b[38;5;28mtype\u001b[39m(store)\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m\"\u001b[39m)\n\u001b[1;32m 49\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m store\u001b[38;5;241m.\u001b[39msupports_writes:\n\u001b[1;32m 50\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msupplied store does not support writes\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", + "\u001b[0;31mTypeError\u001b[0m: expected type IcechunkStore, but got type " ] } ], @@ -182,43 +165,20 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "id": "cae7e34f-d6dd-42aa-9e7a-f0d5420ba0b9", "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "'PZMXKYCPJQRRFXV33Q7G'" - ] - }, - "execution_count": 16, - "metadata": {}, - "output_type": "execute_result" - } - ], + "outputs": [], "source": [ - "await store.commit(\"first 2 days of 202408 data\")" + "store.commit(\"first 2 days of 202408 data\")" ] }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "id": "9387e1ff-46c1-45fd-9796-0457538209a7", "metadata": {}, - "outputs": [ - { - "ename": "KeyNotFound", - "evalue": "time/c/0", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mKeyNotFound\u001b[0m Traceback (most recent call last)", - "Cell \u001b[0;32mIn[17], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[38;5;28;01mawait\u001b[39;00m store\u001b[38;5;241m.\u001b[39m_store\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtime/c/0\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n", - "\u001b[0;31mKeyNotFound\u001b[0m: time/c/0" - ] - } - ], + "outputs": [], "source": [ "await store._store.get(\"time/c/0\")" ] @@ -357,6 +317,14 @@ "ds = xr.open_zarr(read_store, consolidated=False, zarr_format=3)\n", "ds" ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "41808f96", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": {