{ "cells": [ { "cell_type": "markdown", "id": "b1679638", "metadata": {}, "source": [ "# Solar Dynamics Observatory\n", "\n", "Single timeseries of EUV data\n", "\n", "### CASE 1: one chunk per file, timeseries sorted into filter bands. Doesn't need FITS." ] }, { "cell_type": "code", "execution_count": null, "id": "9bad6590", "metadata": {}, "outputs": [], "source": [ "import intake\n", "import hvplot.xarray" ] }, { "cell_type": "code", "execution_count": null, "id": "25b832d8", "metadata": {}, "outputs": [], "source": [ "cat = intake.open_catalog(\"https://github.com/fsspec/kerchunk/raw/main/\"\n", " \"examples/intake_catalog.yml\")" ] }, { "cell_type": "code", "execution_count": null, "id": "d9e804ab", "metadata": {}, "outputs": [], "source": [ "ds = cat.SDO.to_dask()\n", "ds" ] }, { "cell_type": "code", "execution_count": null, "id": "3111b1eb", "metadata": {}, "outputs": [], "source": [ "ds.nbytes / 2**30 # GB" ] }, { "cell_type": "markdown", "id": "8e2b74ee", "metadata": {}, "source": [ "### What just happened?\n", "\n", "Let's look into the detail a little.\n", "\n", "First, where are the files we want:" ] }, { "cell_type": "code", "execution_count": null, "id": "8044b8e3", "metadata": {}, "outputs": [], "source": [ "import fsspec\n", "gcs = fsspec.filesystem(\"gcs\")\n", "gcs.ls(\"pangeo-data/SDO_AIA_Images/\")" ] }, { "cell_type": "code", "execution_count": null, "id": "dc8fd986", "metadata": {}, "outputs": [], "source": [ "gcs.ls(\"pangeo-data/SDO_AIA_Images/094\")[:5]" ] }, { "cell_type": "markdown", "id": "fe14433a", "metadata": {}, "source": [ "Now we create a \"reference\" filesystem:" ] }, { "cell_type": "code", "execution_count": null, "id": "3b62679a", "metadata": {}, "outputs": [], "source": [ "fs = fsspec.filesystem(\n", " \"reference\",\n", " fo=\"gcs://mdtemp/SDO_no_coords.json\",\n", " remote_options={\"token\": \"anon\"},\n", " remote_protocol=\"gcs\",\n", " target_options={\"token\": \"anon\"}\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "19b1c9e9", "metadata": {}, "outputs": [], "source": [ "fs.ls(\"\", False)" ] }, { "cell_type": "code", "execution_count": null, "id": "ce63dfe6", "metadata": {}, "outputs": [], "source": [ "fs.ls(\"094\", False)[:5]" ] }, { "cell_type": "code", "execution_count": null, "id": "9c9a510d", "metadata": {}, "outputs": [], "source": [ "print(fs.cat(\"094/.zarray\").decode())" ] }, { "cell_type": "code", "execution_count": null, "id": "cf1110b1", "metadata": {}, "outputs": [], "source": [ "fs.references[\"094/0.0.0\"]" ] }, { "cell_type": "markdown", "id": "0bff3d30", "metadata": {}, "source": [ "### Viz\n", "\n", "So let's see it in action!" ] }, { "cell_type": "code", "execution_count": null, "id": "b796814e", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "ds = ds.assign_coords(x=np.arange(4096), y=np.arange(4096))" ] }, { "cell_type": "code", "execution_count": null, "id": "1a826fb8", "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "ds[\"094\"].hvplot.image(\n", " 'x', 'y', colormap=\"fire\", xaxis=False, yaxis=False, \n", " height=500, width=500, colorbar=False, clim=(0, 50)\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "db43273d", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.8" } }, "nbformat": 4, "nbformat_minor": 5 }