diff --git a/talks/FrevaFutures/FuturesExample.ipynb b/talks/FrevaFutures/FuturesExample.ipynb new file mode 100644 index 0000000..ad80f5e --- /dev/null +++ b/talks/FrevaFutures/FuturesExample.ipynb @@ -0,0 +1,1668 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "b40ac9f0-a931-4b6c-af0f-4e3c6015043f", + "metadata": { + "slideshow": { + "slide_type": "slide" + }, + "tags": [] + }, + "source": [ + "# Registering a dataset that will exist in the future" + ] + }, + { + "cell_type": "markdown", + "id": "d6f47b6c", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "## Here we use a freva plugin run that has been applied" + ] + }, + { + "cell_type": "code", + "execution_count": 24, + "id": "0606ba9c-dc40-4cc7-bc24-b7ab7b5d1b73", + "metadata": { + "slideshow": { + "slide_type": "-" + }, + "tags": [] + }, + "outputs": [], + "source": [ + "import freva\n", + "import xarray as xr\n", + "from freva._futures import Futures\n", + "hist_id = 3085 # We can get this ID using the freva.history command\n", + "_ = Futures.register_future_from_history_id(hist_id)" + ] + }, + { + "cell_type": "markdown", + "id": "fda38f35-b941-4bf4-a023-931be0171e00", + "metadata": { + "slideshow": { + "slide_type": "slide" + }, + "tags": [] + }, + "source": [ + "## Let's search for the data" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "id": "da20b295-f6f9-4196-99fd-3de69fc5249e", + "metadata": { + "slideshow": { + "slide_type": "-" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "text/plain": [ + "['future:///scratch/b/b380001/futures/6def5135a687932d27f419a3e993b5bd68aa03425ff0378cfb7745c0aef497a5/cmip5/output1/mpi-m/mpi-esm-lr/historical/yr/atmos/1day/r1i1p1/tx90pETCCDI/tx90pETCCDI_1day_mpi-esm-lr_historical_r1i1p1_199007020000-199207011200']" + ] + }, + "execution_count": 23, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "list(freva.databrowser(variable=\"tx90petccdi\"))" + ] + }, + { + "cell_type": "markdown", + "id": "b0de5e6c-417f-4cf0-98e4-78ad308e2ae6", + "metadata": { + "slideshow": { + "slide_type": "slide" + } + }, + "source": [ + "## The data doesn't exist yet, but can be created on demand:" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "id": "5f74b885-023b-4b64-8dc7-115946b60443", + "metadata": { + "slideshow": { + "slide_type": "-" + }, + "tags": [] + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "2286aa25721f441b8f22cbdcce4c6bab", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Output()" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "
\n" + ], + "text/plain": [] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "text/html": [ + "<xarray.Dataset>\n", + "Dimensions: (time: 3, bnds: 2, lon: 192, lat: 96)\n", + "Coordinates:\n", + " * time (time) datetime64[ns] 1990-07-02 1991-07-02 1992-07-01T12:00:00\n", + " * lon (lon) float64 -179.1 -177.2 -175.3 -173.4 ... 175.3 177.2 179.1\n", + " * lat (lat) float64 -89.06 -87.19 -85.31 -83.44 ... 85.31 87.19 89.06\n", + " height float64 ...\n", + "Dimensions without coordinates: bnds\n", + "Data variables:\n", + " time_bnds (time, bnds) datetime64[ns] dask.array<chunksize=(3, 2), meta=np.ndarray>\n", + " tx90pETCCDI (time, lat, lon) float32 dask.array<chunksize=(3, 96, 192), meta=np.ndarray>\n", + "Attributes: (12/36)\n", + " CDI: Climate Data Interface version 2.0.5 (https://m...\n", + " Conventions: CF-1.4\n", + " source: MPI-ESM-LR 2011; URL: http://svn.zmaw.de/svn/co...\n", + " institution: Max Planck Institute for Meteorology\n", + " institute_id: MPI-M\n", + " experiment_id: historical\n", + " ... ...\n", + " ETCCDI_software: climdex.pcic\n", + " ETCCDI_software_version: 1.1.11\n", + " frequency: yr\n", + " creation_date: 2023-09-11T19:57:50Z\n", + " title: ETCCDI indices computed on MPI-ESM-LR model out...\n", + " CDO: Climate Data Operators version 2.0.5 (https://m...
<xarray.Dataset>\n", + "Dimensions: (time: 3, bnds: 2, lon: 192, lat: 96)\n", + "Coordinates:\n", + " * time (time) datetime64[ns] 1990-07-02 1991-07-02 1992-07-01T12:00:00\n", + " * lon (lon) float64 -179.1 -177.2 -175.3 -173.4 ... 175.3 177.2 179.1\n", + " * lat (lat) float64 -89.06 -87.19 -85.31 -83.44 ... 85.31 87.19 89.06\n", + " height float64 ...\n", + "Dimensions without coordinates: bnds\n", + "Data variables:\n", + " time_bnds (time, bnds) datetime64[ns] dask.array<chunksize=(3, 2), meta=np.ndarray>\n", + " tx90pETCCDI (time, lat, lon) float32 dask.array<chunksize=(3, 96, 192), meta=np.ndarray>\n", + "Attributes: (12/36)\n", + " CDI: Climate Data Interface version 2.0.5 (https://m...\n", + " Conventions: CF-1.4\n", + " source: MPI-ESM-LR 2011; URL: http://svn.zmaw.de/svn/co...\n", + " institution: Max Planck Institute for Meteorology\n", + " institute_id: MPI-M\n", + " experiment_id: historical\n", + " ... ...\n", + " ETCCDI_software: climdex.pcic\n", + " ETCCDI_software_version: 1.1.11\n", + " frequency: yr\n", + " creation_date: 2023-09-11T20:05:11Z\n", + " title: ETCCDI indices computed on MPI-ESM-LR model out...\n", + " CDO: Climate Data Operators version 2.0.5 (https://m...
⛈ Executing futures ...\n\n", + "text/plain": "⛈ Executing futures ...\n" + }, + "metadata": {}, + "output_type": "display_data" + } + ] + } + }, + "61acf91180514d5e803f091435c1612e": { + "model_module": "@jupyter-widgets/output", + "model_module_version": "1.0.0", + "model_name": "OutputModel", + "state": { + "layout": "IPY_MODEL_9c18d70ab886442f9112929e378411d7", + "outputs": [ + { + "data": { + "text/html": "
⛈ Executing futures ...\n\n", + "text/plain": "⛈ Executing futures ...\n" + }, + "metadata": {}, + "output_type": "display_data" + } + ] + } + }, + "9c18d70ab886442f9112929e378411d7": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": {} + }, + "c7825b1332ed4b48a784b88ef87270fd": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": {} + }, + "dd49267695d047eab2d5432fa1ed7041": { + "model_module": "@jupyter-widgets/output", + "model_module_version": "1.0.0", + "model_name": "OutputModel", + "state": { + "layout": "IPY_MODEL_c7825b1332ed4b48a784b88ef87270fd", + "outputs": [ + { + "data": { + "text/html": "
🌧 Executing futures ...\n\n", + "text/plain": "🌧 Executing futures ...\n" + }, + "metadata": {}, + "output_type": "display_data" + } + ] + } + }, + "fb04cb54a3204412a958a0055e186784": { + "model_module": "@jupyter-widgets/base", + "model_module_version": "2.0.0", + "model_name": "LayoutModel", + "state": {} + } + }, + "version_major": 2, + "version_minor": 0 + } + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/talks/FrevaFutures/FuturesExample.md b/talks/FrevaFutures/FuturesExample.md new file mode 100644 index 0000000..f1bcc7f --- /dev/null +++ b/talks/FrevaFutures/FuturesExample.md @@ -0,0 +1,1305 @@ +# Registering a dataset that will exist in the future + +## Here we use a freva plugin run that has been applied + + +```python +import freva +import xarray as xr +from freva._futures import Futures +hist_id = 3085 # We can get this ID using the freva.history command +_ = Futures.register_future_from_history_id(hist_id) +``` + +## Let's search for the data + + +```python +list(freva.databrowser(variable="tx90petccdi")) +``` + + + + + ['future:///scratch/b/b380001/futures/6def5135a687932d27f419a3e993b5bd68aa03425ff0378cfb7745c0aef497a5/cmip5/output1/mpi-m/mpi-esm-lr/historical/yr/atmos/1day/r1i1p1/tx90pETCCDI/tx90pETCCDI_1day_mpi-esm-lr_historical_r1i1p1_199007020000-199207011200'] + + + +## The data doesn't exist yet, but can be created on demand: + + +```python +dset = xr.open_mfdataset( + freva.databrowser(variable="tx90petccdi", + execute_future=True + ) +) +dset +``` + + + Output() + + + + + + + + + + +
<xarray.Dataset> +Dimensions: (time: 3, bnds: 2, lon: 192, lat: 96) +Coordinates: + * time (time) datetime64[ns] 1990-07-02 1991-07-02 1992-07-01T12:00:00 + * lon (lon) float64 -179.1 -177.2 -175.3 -173.4 ... 175.3 177.2 179.1 + * lat (lat) float64 -89.06 -87.19 -85.31 -83.44 ... 85.31 87.19 89.06 + height float64 ... +Dimensions without coordinates: bnds +Data variables: + time_bnds (time, bnds) datetime64[ns] dask.array<chunksize=(3, 2), meta=np.ndarray> + tx90pETCCDI (time, lat, lon) float32 dask.array<chunksize=(3, 96, 192), meta=np.ndarray> +Attributes: (12/36) + CDI: Climate Data Interface version 2.0.5 (https://m... + Conventions: CF-1.4 + source: MPI-ESM-LR 2011; URL: http://svn.zmaw.de/svn/co... + institution: Max Planck Institute for Meteorology + institute_id: MPI-M + experiment_id: historical + ... ... + ETCCDI_software: climdex.pcic + ETCCDI_software_version: 1.1.11 + frequency: yr + creation_date: 2023-09-11T19:57:50Z + title: ETCCDI indices computed on MPI-ESM-LR model out... + CDO: Climate Data Operators version 2.0.5 (https://m...
<xarray.Dataset> +Dimensions: (time: 3, bnds: 2, lon: 192, lat: 96) +Coordinates: + * time (time) datetime64[ns] 1990-07-02 1991-07-02 1992-07-01T12:00:00 + * lon (lon) float64 -179.1 -177.2 -175.3 -173.4 ... 175.3 177.2 179.1 + * lat (lat) float64 -89.06 -87.19 -85.31 -83.44 ... 85.31 87.19 89.06 + height float64 ... +Dimensions without coordinates: bnds +Data variables: + time_bnds (time, bnds) datetime64[ns] dask.array<chunksize=(3, 2), meta=np.ndarray> + tx90pETCCDI (time, lat, lon) float32 dask.array<chunksize=(3, 96, 192), meta=np.ndarray> +Attributes: (12/36) + CDI: Climate Data Interface version 2.0.5 (https://m... + Conventions: CF-1.4 + source: MPI-ESM-LR 2011; URL: http://svn.zmaw.de/svn/co... + institution: Max Planck Institute for Meteorology + institute_id: MPI-M + experiment_id: historical + ... ... + ETCCDI_software: climdex.pcic + ETCCDI_software_version: 1.1.11 + frequency: yr + creation_date: 2023-09-11T20:05:11Z + title: ETCCDI indices computed on MPI-ESM-LR model out... + CDO: Climate Data Operators version 2.0.5 (https://m...