From e787c36be8e1675d3cea9953800517adfee3295f Mon Sep 17 00:00:00 2001 From: Tina Odaka <46813815+tinaok@users.noreply.github.com> Date: Tue, 8 Oct 2024 16:08:30 +0200 Subject: [PATCH 01/17] Create readme.md --- visualisation/readme.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 visualisation/readme.md diff --git a/visualisation/readme.md b/visualisation/readme.md new file mode 100644 index 0000000..8d1c8b6 --- /dev/null +++ b/visualisation/readme.md @@ -0,0 +1 @@ + From e35b22353f9dc8beb6978376a584341a185a0f19 Mon Sep 17 00:00:00 2001 From: Tina Odaka <46813815+tinaok@users.noreply.github.com> Date: Tue, 8 Oct 2024 16:16:59 +0200 Subject: [PATCH 02/17] Add files via upload --- visualisation/xdggs-explore-demo.ipynb | 5932 ++++++++++++++++++++++++ 1 file changed, 5932 insertions(+) create mode 100644 visualisation/xdggs-explore-demo.ipynb diff --git a/visualisation/xdggs-explore-demo.ipynb b/visualisation/xdggs-explore-demo.ipynb new file mode 100644 index 0000000..682bd2d --- /dev/null +++ b/visualisation/xdggs-explore-demo.ipynb @@ -0,0 +1,5932 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "822fe868-4eca-4f7a-bf02-8badcb88ddb7", + "metadata": {}, + "source": [ + "# plotting healpix data with xdggs and lonboard" + ] + }, + { + "cell_type": "markdown", + "id": "d340a5ff-db29-4c13-8d7f-f02870e6ad17", + "metadata": {}, + "source": [ + "For this to work, we need:\n", + "- `xarray`\n", + "- `numpy`\n", + "- `xdggs`\n", + "- `lonboard`\n", + "- `arro3-core`\n", + "- `matplotlib`\n", + "\n", + "All of these can be installed using the `explore` extra:" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "81daf142-11e0-486b-ac52-9234abf44ce2", + "metadata": { + "collapsed": true, + "jupyter": { + "outputs_hidden": true + } + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Collecting xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard (from xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard)\n", + " Cloning https://github.com/keewis/xdggs.git to /tmp/pip-install-ly7q_fzp/xdggs_298a07348ea54afd8df1bd6107f14d8e\n", + " Running command git clone --filter=blob:none --quiet https://github.com/keewis/xdggs.git /tmp/pip-install-ly7q_fzp/xdggs_298a07348ea54afd8df1bd6107f14d8e\n", + " Resolved https://github.com/keewis/xdggs.git to commit 775c76be55c661cc8ceb5914fedefda0db5edb89\n", + " Installing build dependencies ... \u001b[?25ldone\n", + "\u001b[?25h Getting requirements to build wheel ... \u001b[?25ldone\n", + "\u001b[?25h Preparing metadata (pyproject.toml) ... \u001b[?25ldone\n", + "\u001b[?25hRequirement already satisfied: xarray in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2024.7.0)\n", + "Collecting healpy (from xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard)\n", + " Downloading healpy-1.17.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (8.9 kB)\n", + "Collecting h3ronpy (from xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard)\n", + " Downloading h3ronpy-0.21.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.0 kB)\n", + "Requirement already satisfied: typing-extensions in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (4.12.2)\n", + "\u001b[33mWARNING: xdggs 0.1.dev53+g775c76b does not provide the extra 'explore'\u001b[0m\u001b[33m\n", + "\u001b[0mRequirement already satisfied: numpy<2 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from h3ronpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (1.26.4)\n", + "Requirement already satisfied: pyarrow>=10.0 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from h3ronpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (17.0.0)\n", + "Requirement already satisfied: Shapely>=1.7 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from h3ronpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2.0.5)\n", + "Requirement already satisfied: astropy in /srv/conda/envs/notebook/lib/python3.12/site-packages (from healpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (6.1.2)\n", + "Requirement already satisfied: packaging>=23.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xarray->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (24.1)\n", + "Requirement already satisfied: pandas>=2.0 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xarray->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2.2.2)\n", + "Requirement already satisfied: python-dateutil>=2.8.2 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from pandas>=2.0->xarray->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2.8.2)\n", + "Requirement already satisfied: pytz>=2020.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from pandas>=2.0->xarray->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2024.1)\n", + "Requirement already satisfied: tzdata>=2022.7 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from pandas>=2.0->xarray->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2024.1)\n", + "Requirement already satisfied: pyerfa>=2.0.1.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from astropy->healpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2.0.1.4)\n", + "Requirement already satisfied: astropy-iers-data>=0.2024.7.1.0.34.3 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from astropy->healpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (0.2024.8.5.0.32.23)\n", + "Requirement already satisfied: PyYAML>=3.13 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from astropy->healpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (6.0.2)\n", + "Requirement already satisfied: six>=1.5 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from python-dateutil>=2.8.2->pandas>=2.0->xarray->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (1.16.0)\n", + "Downloading h3ronpy-0.21.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.0/2.0 MB\u001b[0m \u001b[31m40.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hDownloading healpy-1.17.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.5 MB)\n", + "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m8.5/8.5 MB\u001b[0m \u001b[31m53.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", + "\u001b[?25hBuilding wheels for collected packages: xdggs\n", + " Building wheel for xdggs (pyproject.toml) ... \u001b[?25ldone\n", + "\u001b[?25h Created wheel for xdggs: filename=xdggs-0.1.dev53+g775c76b-py3-none-any.whl size=23214 sha256=21f98f3d1d2336b67f7713b979d5c33f63b274568277dc2298ebcace3c570431\n", + " Stored in directory: /tmp/pip-ephem-wheel-cache-pulnu04g/wheels/11/dd/6e/9fa09ae5bad1a9382b041ca100a1fcec2819ecccbd89598f51\n", + "Successfully built xdggs\n", + "Installing collected packages: h3ronpy, healpy, xdggs\n", + "Successfully installed h3ronpy-0.21.1 healpy-1.17.3 xdggs-0.1.dev53+g775c76b\n" + ] + } + ], + "source": [ + "#!pip install \"xdggs[explore] @ git+https://github.com/keewis/xdggs.git#branch=lonboard\"\n", + "\n", + "!pip install \"xdggs[explore] @ git+https://github.com/keewis/xdggs.git@lonboard\"" + ] + }, + { + "cell_type": "markdown", + "id": "4252ed44-5767-4f7f-a5f2-4724c96be7e4", + "metadata": {}, + "source": [ + "imports" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "36cf9310-b950-4ff2-96ac-8b654b411947", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import xarray as xr\n", + "\n", + "import xdggs" + ] + }, + { + "cell_type": "markdown", + "id": "68c364ab-3db3-42c9-9872-83b83b599ae5", + "metadata": {}, + "source": [ + "generate the test dataset" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "e9066875-192b-4993-90eb-b309a7512d37", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
<xarray.Dataset> Size: 25MB\n",
+       "Dimensions:    (cells: 786432)\n",
+       "Coordinates:\n",
+       "  * cell_ids   (cells) int64 6MB 0 1 2 3 4 ... 786428 786429 786430 786431\n",
+       "    latitude   (cells) float64 6MB 0.1492 0.2984 0.2984 ... -0.2984 -0.1492\n",
+       "    longitude  (cells) float64 6MB 45.0 45.18 44.82 45.0 ... 315.2 314.8 315.0\n",
+       "Dimensions without coordinates: cells\n",
+       "Data variables:\n",
+       "    data       (cells) float64 6MB -0.9999 -0.9993 -0.9993 ... 0.9993 0.9999\n",
+       "Indexes:\n",
+       "    cell_ids  HealpixIndex(nside=8, indexing_scheme=nested, rotation=[0.0, 0.0])
" + ], + "text/plain": [ + " Size: 25MB\n", + "Dimensions: (cells: 786432)\n", + "Coordinates:\n", + " * cell_ids (cells) int64 6MB 0 1 2 3 4 ... 786428 786429 786430 786431\n", + " latitude (cells) float64 6MB 0.1492 0.2984 0.2984 ... -0.2984 -0.1492\n", + " longitude (cells) float64 6MB 45.0 45.18 44.82 45.0 ... 315.2 314.8 315.0\n", + "Dimensions without coordinates: cells\n", + "Data variables:\n", + " data (cells) float64 6MB -0.9999 -0.9993 -0.9993 ... 0.9993 0.9999\n", + "Indexes:\n", + " cell_ids HealpixIndex(nside=8, indexing_scheme=nested, rotation=[0.0, 0.0])" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "level = 8\n", + "cell_ids = np.arange(12 * 4**level)\n", + "grid_info = {\"grid_name\": \"healpix\", \"level\": level, \"indexing_scheme\": \"nested\"}\n", + "\n", + "ds = (\n", + " xr.Dataset(coords={\"cell_ids\": (\"cells\", cell_ids, grid_info)})\n", + " .pipe(xdggs.decode)\n", + " .pipe(lambda ds: ds.merge(ds.dggs.cell_centers()))\n", + " .assign(data=lambda ds: np.cos(6 * np.radians(ds[\"latitude\"])) * np.sin(6 * np.radians(ds[\"longitude\"])))\n", + ")\n", + "ds" + ] + }, + { + "cell_type": "markdown", + "id": "ecd4aff4-3373-4aca-8eaf-d641c38aa942", + "metadata": {}, + "source": [ + "create the map and visualize" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "id": "373b7b1f-fff6-4b26-aa3c-80651199129d", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "bfaaf914629843359bbfcd6307d70df1", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "Map(layers=[SolidPolygonLayer(filled=True, get_fill_color=\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
<xarray.Dataset> Size: 383TB\n",
+       "Dimensions:  (time: 262537, value: 3145728)\n",
+       "Coordinates:\n",
+       "    lat      (value) float64 25MB dask.array<chunksize=(3145728,), meta=np.ndarray>\n",
+       "    lon      (value) float64 25MB dask.array<chunksize=(3145728,), meta=np.ndarray>\n",
+       "  * time     (time) datetime64[ns] 2MB 2020-01-20 ... 2050-01-01\n",
+       "Dimensions without coordinates: value\n",
+       "Data variables: (12/58)\n",
+       "    10si     (time, value) float64 7TB dask.array<chunksize=(3, 3145728), meta=np.ndarray>\n",
+       "    10u      (time, value) float64 7TB dask.array<chunksize=(3, 3145728), meta=np.ndarray>\n",
+       "    10v      (time, value) float64 7TB dask.array<chunksize=(3, 3145728), meta=np.ndarray>\n",
+       "    2d       (time, value) float64 7TB dask.array<chunksize=(3, 3145728), meta=np.ndarray>\n",
+       "    2t       (time, value) float64 7TB dask.array<chunksize=(3, 3145728), meta=np.ndarray>\n",
+       "    blh      (time, value) float64 7TB dask.array<chunksize=(3, 3145728), meta=np.ndarray>\n",
+       "    ...       ...\n",
+       "    tp       (time, value) float64 7TB dask.array<chunksize=(3, 3145728), meta=np.ndarray>\n",
+       "    tprate   (time, value) float64 7TB dask.array<chunksize=(3, 3145728), meta=np.ndarray>\n",
+       "    tsr      (time, value) float64 7TB dask.array<chunksize=(3, 3145728), meta=np.ndarray>\n",
+       "    tsrc     (time, value) float64 7TB dask.array<chunksize=(3, 3145728), meta=np.ndarray>\n",
+       "    ttr      (time, value) float64 7TB dask.array<chunksize=(3, 3145728), meta=np.ndarray>\n",
+       "    ttrc     (time, value) float64 7TB dask.array<chunksize=(3, 3145728), meta=np.ndarray>\n",
+       "Attributes: (12/13)\n",
+       "    edition:            2\n",
+       "    centre:             ecmf\n",
+       "    centreDescription:  European Centre for Medium-Range Weather Forecasts\n",
+       "    subCentre:          1003\n",
+       "    history:            🪄🧙‍♂️🔮 magic dataset assembly provided by gribscan.IF...\n",
+       "    title:              nextgems.IFS_9-FESOM_5-production.2D_hourly_healpix512\n",
+       "    ...                 ...\n",
+       "    time_min:           2020-01-20T00:00:00.000000000\n",
+       "    time_max:           2050-01-01T00:00:00.000000000\n",
+       "    creation_date:      2024-10-08T06:15:02Z\n",
+       "    authors:            Wieners, Karl-Hermann (MPIMet), Aguridan, Razvan (ECM...\n",
+       "    contact:            Wieners, Karl-Hermann (MPIMet), Rackow, Thomas (ECMWF)\n",
+       "    license:            Creative Commons Attribution 4.0 International (CC BY...
" + ], + "text/plain": [ + " Size: 383TB\n", + "Dimensions: (time: 262537, value: 3145728)\n", + "Coordinates:\n", + " lat (value) float64 25MB dask.array\n", + " lon (value) float64 25MB dask.array\n", + " * time (time) datetime64[ns] 2MB 2020-01-20 ... 2050-01-01\n", + "Dimensions without coordinates: value\n", + "Data variables: (12/58)\n", + " 10si (time, value) float64 7TB dask.array\n", + " 10u (time, value) float64 7TB dask.array\n", + " 10v (time, value) float64 7TB dask.array\n", + " 2d (time, value) float64 7TB dask.array\n", + " 2t (time, value) float64 7TB dask.array\n", + " blh (time, value) float64 7TB dask.array\n", + " ... ...\n", + " tp (time, value) float64 7TB dask.array\n", + " tprate (time, value) float64 7TB dask.array\n", + " tsr (time, value) float64 7TB dask.array\n", + " tsrc (time, value) float64 7TB dask.array\n", + " ttr (time, value) float64 7TB dask.array\n", + " ttrc (time, value) float64 7TB dask.array\n", + "Attributes: (12/13)\n", + " edition: 2\n", + " centre: ecmf\n", + " centreDescription: European Centre for Medium-Range Weather Forecasts\n", + " subCentre: 1003\n", + " history: 🪄🧙‍♂️🔮 magic dataset assembly provided by gribscan.IF...\n", + " title: nextgems.IFS_9-FESOM_5-production.2D_hourly_healpix512\n", + " ... ...\n", + " time_min: 2020-01-20T00:00:00.000000000\n", + " time_max: 2050-01-01T00:00:00.000000000\n", + " creation_date: 2024-10-08T06:15:02Z\n", + " authors: Wieners, Karl-Hermann (MPIMet), Aguridan, Razvan (ECM...\n", + " contact: Wieners, Karl-Hermann (MPIMet), Rackow, Thomas (ECMWF)\n", + " license: Creative Commons Attribution 4.0 International (CC BY..." + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "import xarray as xr\n", + "\n", + "ds = xr.open_dataset(\n", + " \"https://eerie.cloud.dkrz.de/datasets/nextgems.IFS_9-FESOM_5-production.2D_hourly_healpix512/zarr\",\n", + " engine=\"zarr\",\n", + " chunks={},\n", + " consolidated=True,\n", + ")\n", + "ds" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "27e4ebce-6612-42d9-902b-079d2c69d291", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
<xarray.DataArray 'msl' (value: 3145728)> Size: 25MB\n",
+       "array([100984.51660156, 100988.79394531, 100979.44824219, ...,\n",
+       "       101204.87207031, 101202.56152344, 101200.22753906])\n",
+       "Coordinates:\n",
+       "    lat       (value) float64 25MB 0.0746 0.1492 0.1492 ... -0.1492 -0.0746\n",
+       "    lon       (value) float64 25MB 45.0 45.09 44.91 45.0 ... 315.1 314.9 315.0\n",
+       "    time      datetime64[ns] 8B 2020-03-01T16:00:00\n",
+       "  * cell_ids  (value) int64 25MB 0 1 2 3 4 ... 3145724 3145725 3145726 3145727\n",
+       "Dimensions without coordinates: value\n",
+       "Indexes:\n",
+       "    cell_ids  HealpixIndex(nside=9, indexing_scheme=nested, rotation=[0.0, 0.0])\n",
+       "Attributes: (12/15)\n",
+       "    paramId:                    151\n",
+       "    dataType:                   fc\n",
+       "    numberOfPoints:             3145728\n",
+       "    typeOfLevel:                meanSea\n",
+       "    stepUnits:                  1\n",
+       "    stepType:                   instant\n",
+       "    ...                         ...\n",
+       "    name:                       Mean sea level pressure\n",
+       "    cfName:                     air_pressure_at_mean_sea_level\n",
+       "    cfVarName:                  msl\n",
+       "    missingValue:               9999\n",
+       "    NV:                         0\n",
+       "    gridDefinitionDescription:  150
" + ], + "text/plain": [ + " Size: 25MB\n", + "array([100984.51660156, 100988.79394531, 100979.44824219, ...,\n", + " 101204.87207031, 101202.56152344, 101200.22753906])\n", + "Coordinates:\n", + " lat (value) float64 25MB 0.0746 0.1492 0.1492 ... -0.1492 -0.0746\n", + " lon (value) float64 25MB 45.0 45.09 44.91 45.0 ... 315.1 314.9 315.0\n", + " time datetime64[ns] 8B 2020-03-01T16:00:00\n", + " * cell_ids (value) int64 25MB 0 1 2 3 4 ... 3145724 3145725 3145726 3145727\n", + "Dimensions without coordinates: value\n", + "Indexes:\n", + " cell_ids HealpixIndex(nside=9, indexing_scheme=nested, rotation=[0.0, 0.0])\n", + "Attributes: (12/15)\n", + " paramId: 151\n", + " dataType: fc\n", + " numberOfPoints: 3145728\n", + " typeOfLevel: meanSea\n", + " stepUnits: 1\n", + " stepType: instant\n", + " ... ...\n", + " name: Mean sea level pressure\n", + " cfName: air_pressure_at_mean_sea_level\n", + " cfVarName: msl\n", + " missingValue: 9999\n", + " NV: 0\n", + " gridDefinitionDescription: 150" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data=ds[\"msl\"].isel(time=1000).compute().assign_coords(cell_ids=('value', np.arange(12*4**9 ), {\"grid_name\":\"healpix\",\"level\": 9, \"indexing_scheme\": \"nested\"})).pipe(xdggs.decode)\n", + "data" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "id": "9b244f12-0600-48f2-890e-948df076353d", + "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "863b2d35851f4fadafc76570b08b3be5", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "Map(layers=[SolidPolygonLayer(filled=True, get_fill_color= Date: Sun, 13 Oct 2024 07:36:10 +0000 Subject: [PATCH 03/17] updating data sources --- visualisation/xdggs-explore-demo.ipynb | 2330 +++++++++++++++++++++--- 1 file changed, 2119 insertions(+), 211 deletions(-) diff --git a/visualisation/xdggs-explore-demo.ipynb b/visualisation/xdggs-explore-demo.ipynb index 682bd2d..589fe9b 100644 --- a/visualisation/xdggs-explore-demo.ipynb +++ b/visualisation/xdggs-explore-demo.ipynb @@ -13,7 +13,19 @@ "id": "d340a5ff-db29-4c13-8d7f-f02870e6ad17", "metadata": {}, "source": [ - "For this to work, we need:\n", + "We will show in this notebook, several example of plotting healpix data. \n", + "This notebook is made for a poster presentation of 3rd Destination Earth User eXchange\n", + "October 15 - October 16 2024 held in darmstadt rese 3rd Destination EArth https://destination-earth.eu/event/3rd-destination-earth-user-exchange/ \n", + "\n", + "Link to the Poster in zenodo here\n", + "\n", + "\n", + "\n", + "For this to work, we need to install xdggs exist in lonboard branch at https://github.com/keewis/xdggs.git@lonboard\n", + "Please use `explore` extra using following command\n", + "`pip install \"xdggs[explore] @ git+https://github.com/keewis/xdggs.git@lonboard\"`\n", + "\n", + "It will install all requried libraries such as \n", "- `xarray`\n", "- `numpy`\n", "- `xdggs`\n", @@ -21,104 +33,1819 @@ "- `arro3-core`\n", "- `matplotlib`\n", "\n", - "All of these can be installed using the `explore` extra:" + "## Why in xdggs we use lonboard for plotting ?\n", + "Lonboard use GPU-based rendering, specifically leveraging WebGL through deck.gl, because it allows the efficient handling of large datasets. By rendering on the GPU, it enables the fast, interactive visualization of geospatial data directly in a browser, which is crucial when dealing with large-scale datasets that would otherwise slow down performance or crash typical plotting libraries.\n", + "\n", + "The core of Lonboard's performance comes from its use of binary data formats like GeoArrow and GeoParquet, which minimize data transfer and processing overhead. Unlike traditional libraries that use text formats such as GeoJSON, Lonboard operates in a binary format throughout the entire pipeline. This binary handling reduces the number of copies made and avoids costly conversions between formats, resulting in faster data transfers and more efficient rendering\n", + "\n", + "\n", + "\n" ] }, { "cell_type": "code", "execution_count": 1, - "id": "81daf142-11e0-486b-ac52-9234abf44ce2", - "metadata": { - "collapsed": true, - "jupyter": { - "outputs_hidden": true - } - }, + "id": "8302fb2f-c439-4287-83fa-708ade5a29df", + "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Collecting xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard (from xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard)\n", - " Cloning https://github.com/keewis/xdggs.git to /tmp/pip-install-ly7q_fzp/xdggs_298a07348ea54afd8df1bd6107f14d8e\n", - " Running command git clone --filter=blob:none --quiet https://github.com/keewis/xdggs.git /tmp/pip-install-ly7q_fzp/xdggs_298a07348ea54afd8df1bd6107f14d8e\n", - " Resolved https://github.com/keewis/xdggs.git to commit 775c76be55c661cc8ceb5914fedefda0db5edb89\n", + "Collecting xdggs@ git+https://github.com/keewis/xdggs.git@lonboard (from xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard)\n", + " Cloning https://github.com/keewis/xdggs.git (to revision lonboard) to /tmp/pip-install-qf0bkvzn/xdggs_1dc7d439d2d547c58ee1b55be858c4d9\n", + " Running command git clone --filter=blob:none --quiet https://github.com/keewis/xdggs.git /tmp/pip-install-qf0bkvzn/xdggs_1dc7d439d2d547c58ee1b55be858c4d9\n", + " Running command git checkout -b lonboard --track origin/lonboard\n", + " Switched to a new branch 'lonboard'\n", + " Branch 'lonboard' set up to track remote branch 'lonboard' from 'origin'.\n", + " Resolved https://github.com/keewis/xdggs.git to commit 6d9b78aeb68b03a2a196e4a14b99a73b8dc6538c\n", " Installing build dependencies ... \u001b[?25ldone\n", "\u001b[?25h Getting requirements to build wheel ... \u001b[?25ldone\n", "\u001b[?25h Preparing metadata (pyproject.toml) ... \u001b[?25ldone\n", - "\u001b[?25hRequirement already satisfied: xarray in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2024.7.0)\n", - "Collecting healpy (from xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard)\n", - " Downloading healpy-1.17.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (8.9 kB)\n", - "Collecting h3ronpy (from xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard)\n", - " Downloading h3ronpy-0.21.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.0 kB)\n", - "Requirement already satisfied: typing-extensions in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (4.12.2)\n", - "\u001b[33mWARNING: xdggs 0.1.dev53+g775c76b does not provide the extra 'explore'\u001b[0m\u001b[33m\n", - "\u001b[0mRequirement already satisfied: numpy<2 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from h3ronpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (1.26.4)\n", - "Requirement already satisfied: pyarrow>=10.0 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from h3ronpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (17.0.0)\n", - "Requirement already satisfied: Shapely>=1.7 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from h3ronpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2.0.5)\n", - "Requirement already satisfied: astropy in /srv/conda/envs/notebook/lib/python3.12/site-packages (from healpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (6.1.2)\n", - "Requirement already satisfied: packaging>=23.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xarray->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (24.1)\n", - "Requirement already satisfied: pandas>=2.0 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xarray->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2.2.2)\n", - "Requirement already satisfied: python-dateutil>=2.8.2 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from pandas>=2.0->xarray->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2.8.2)\n", - "Requirement already satisfied: pytz>=2020.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from pandas>=2.0->xarray->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2024.1)\n", - "Requirement already satisfied: tzdata>=2022.7 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from pandas>=2.0->xarray->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2024.1)\n", - "Requirement already satisfied: pyerfa>=2.0.1.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from astropy->healpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (2.0.1.4)\n", - "Requirement already satisfied: astropy-iers-data>=0.2024.7.1.0.34.3 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from astropy->healpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (0.2024.8.5.0.32.23)\n", - "Requirement already satisfied: PyYAML>=3.13 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from astropy->healpy->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (6.0.2)\n", - "Requirement already satisfied: six>=1.5 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from python-dateutil>=2.8.2->pandas>=2.0->xarray->xdggs@ git+https://github.com/keewis/xdggs.git#branch=lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git#branch=lonboard) (1.16.0)\n", - "Downloading h3ronpy-0.21.1-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.0 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.0/2.0 MB\u001b[0m \u001b[31m40.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hDownloading healpy-1.17.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.5 MB)\n", - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m8.5/8.5 MB\u001b[0m \u001b[31m53.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", - "\u001b[?25hBuilding wheels for collected packages: xdggs\n", - " Building wheel for xdggs (pyproject.toml) ... \u001b[?25ldone\n", - "\u001b[?25h Created wheel for xdggs: filename=xdggs-0.1.dev53+g775c76b-py3-none-any.whl size=23214 sha256=21f98f3d1d2336b67f7713b979d5c33f63b274568277dc2298ebcace3c570431\n", - " Stored in directory: /tmp/pip-ephem-wheel-cache-pulnu04g/wheels/11/dd/6e/9fa09ae5bad1a9382b041ca100a1fcec2819ecccbd89598f51\n", - "Successfully built xdggs\n", - "Installing collected packages: h3ronpy, healpy, xdggs\n", - "Successfully installed h3ronpy-0.21.1 healpy-1.17.3 xdggs-0.1.dev53+g775c76b\n" + "\u001b[?25hRequirement already satisfied: xarray in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (2024.7.0)\n", + "Requirement already satisfied: healpy in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (1.17.3)\n", + "Requirement already satisfied: h3ronpy in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.21.1)\n", + "Requirement already satisfied: typing-extensions in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (4.12.2)\n", + "Requirement already satisfied: lonboard>=0.9.3 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.9.3)\n", + "Requirement already satisfied: pyproj>=3.3 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (3.6.1)\n", + "Requirement already satisfied: matplotlib in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (3.9.2)\n", + "Requirement already satisfied: arro3-core>=0.4.0 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.4.1)\n", + "Requirement already satisfied: anywidget<0.10.0,>=0.9.0 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.9.13)\n", + "Requirement already satisfied: geopandas>=0.13 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (1.0.1)\n", + "Requirement already satisfied: palettable<4.0.0,>=3.3.3 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (3.3.3)\n", + "Requirement already satisfied: pandas<3,>=2 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (2.2.2)\n", + "Requirement already satisfied: pyarrow>=14.0.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (17.0.0)\n", + "Requirement already satisfied: shapely<3,>=2 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (2.0.5)\n", + "Requirement already satisfied: contourpy>=1.0.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from matplotlib->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (1.2.1)\n", + "Requirement already satisfied: cycler>=0.10 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from matplotlib->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.12.1)\n", + "Requirement already satisfied: fonttools>=4.22.0 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from matplotlib->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (4.53.1)\n", + "Requirement already satisfied: kiwisolver>=1.3.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from matplotlib->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (1.4.5)\n", + "Requirement already satisfied: numpy>=1.23 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from matplotlib->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (1.26.4)\n", + "Requirement already satisfied: packaging>=20.0 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from matplotlib->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (24.1)\n", + "Requirement already satisfied: pillow>=8 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from matplotlib->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (10.4.0)\n", + "Requirement already satisfied: pyparsing>=2.3.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from matplotlib->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (3.1.2)\n", + "Requirement already satisfied: python-dateutil>=2.7 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from matplotlib->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (2.8.2)\n", + "Requirement already satisfied: certifi in /srv/conda/envs/notebook/lib/python3.12/site-packages (from pyproj>=3.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (2024.7.4)\n", + "Requirement already satisfied: astropy in /srv/conda/envs/notebook/lib/python3.12/site-packages (from healpy->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (6.1.2)\n", + "Requirement already satisfied: ipywidgets>=7.6.0 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (8.1.3)\n", + "Requirement already satisfied: psygnal>=0.8.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.11.1)\n", + "Requirement already satisfied: pyogrio>=0.7.2 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from geopandas>=0.13->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.9.0)\n", + "Requirement already satisfied: pytz>=2020.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from pandas<3,>=2->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (2024.1)\n", + "Requirement already satisfied: tzdata>=2022.7 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from pandas<3,>=2->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (2024.1)\n", + "Requirement already satisfied: six>=1.5 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from python-dateutil>=2.7->matplotlib->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (1.16.0)\n", + "Requirement already satisfied: pyerfa>=2.0.1.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from astropy->healpy->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (2.0.1.4)\n", + "Requirement already satisfied: astropy-iers-data>=0.2024.7.1.0.34.3 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from astropy->healpy->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.2024.8.5.0.32.23)\n", + "Requirement already satisfied: PyYAML>=3.13 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from astropy->healpy->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (6.0.2)\n", + "Requirement already satisfied: comm>=0.1.3 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.2.2)\n", + "Requirement already satisfied: ipython>=6.1.0 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (8.17.2)\n", + "Requirement already satisfied: traitlets>=4.3.1 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (5.14.3)\n", + "Requirement already satisfied: widgetsnbextension~=4.0.11 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (4.0.11)\n", + "Requirement already satisfied: jupyterlab-widgets~=3.0.11 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (3.0.11)\n", + "Requirement already satisfied: decorator in /srv/conda/envs/notebook/lib/python3.12/site-packages (from ipython>=6.1.0->ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (5.1.1)\n", + "Requirement already satisfied: jedi>=0.16 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from ipython>=6.1.0->ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.19.1)\n", + "Requirement already satisfied: matplotlib-inline in /srv/conda/envs/notebook/lib/python3.12/site-packages (from ipython>=6.1.0->ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.1.7)\n", + "Requirement already satisfied: prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from ipython>=6.1.0->ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (3.0.38)\n", + "Requirement already satisfied: pygments>=2.4.0 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from ipython>=6.1.0->ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (2.18.0)\n", + "Requirement already satisfied: stack-data in /srv/conda/envs/notebook/lib/python3.12/site-packages (from ipython>=6.1.0->ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.6.2)\n", + "Requirement already satisfied: pexpect>4.3 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from ipython>=6.1.0->ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (4.9.0)\n", + "Requirement already satisfied: parso<0.9.0,>=0.8.3 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from jedi>=0.16->ipython>=6.1.0->ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.8.4)\n", + "Requirement already satisfied: ptyprocess>=0.5 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from pexpect>4.3->ipython>=6.1.0->ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.7.0)\n", + "Requirement already satisfied: wcwidth in /srv/conda/envs/notebook/lib/python3.12/site-packages (from prompt-toolkit!=3.0.37,<3.1.0,>=3.0.30->ipython>=6.1.0->ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.2.13)\n", + "Requirement already satisfied: executing>=1.2.0 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from stack-data->ipython>=6.1.0->ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (2.0.1)\n", + "Requirement already satisfied: asttokens>=2.1.0 in /srv/conda/envs/notebook/lib/python3.12/site-packages (from stack-data->ipython>=6.1.0->ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (2.4.1)\n", + "Requirement already satisfied: pure-eval in /srv/conda/envs/notebook/lib/python3.12/site-packages (from stack-data->ipython>=6.1.0->ipywidgets>=7.6.0->anywidget<0.10.0,>=0.9.0->lonboard>=0.9.3->xdggs@ git+https://github.com/keewis/xdggs.git@lonboard->xdggs[explore]@ git+https://github.com/keewis/xdggs.git@lonboard) (0.2.3)\n" ] } ], "source": [ - "#!pip install \"xdggs[explore] @ git+https://github.com/keewis/xdggs.git#branch=lonboard\"\n", - "\n", - "!pip install \"xdggs[explore] @ git+https://github.com/keewis/xdggs.git@lonboard\"" - ] - }, - { - "cell_type": "markdown", - "id": "4252ed44-5767-4f7f-a5f2-4724c96be7e4", - "metadata": {}, - "source": [ - "imports" + "#Lets install our latest xdggs package with plotting functionality\n", + "!pip install \"xdggs[explore] @ git+https://github.com/keewis/xdggs.git@lonboard\"" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "36cf9310-b950-4ff2-96ac-8b654b411947", + "metadata": {}, + "outputs": [], + "source": [ + "import numpy as np\n", + "import xarray as xr\n", + "import xdggs" + ] + }, + { + "cell_type": "markdown", + "id": "68c364ab-3db3-42c9-9872-83b83b599ae5", + "metadata": {}, + "source": [ + "## Plotting generated test dataset\n", + "\n", + "Following code with generate a test dateset. " + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "e9066875-192b-4993-90eb-b309a7512d37", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
<xarray.Dataset> Size: 25MB\n",
+       "Dimensions:    (cells: 786432)\n",
+       "Coordinates:\n",
+       "  * cell_ids   (cells) int64 6MB 0 1 2 3 4 ... 786428 786429 786430 786431\n",
+       "    latitude   (cells) float64 6MB 0.1492 0.2984 0.2984 ... -0.2984 -0.1492\n",
+       "    longitude  (cells) float64 6MB 45.0 45.18 44.82 45.0 ... 315.2 314.8 315.0\n",
+       "Dimensions without coordinates: cells\n",
+       "Data variables:\n",
+       "    data       (cells) float64 6MB -0.9999 -0.9993 -0.9993 ... 0.9993 0.9999\n",
+       "Indexes:\n",
+       "    cell_ids  HealpixIndex(nside=8, indexing_scheme=nested, rotation=[0.0, 0.0])
" + ], + "text/plain": [ + " Size: 25MB\n", + "Dimensions: (cells: 786432)\n", + "Coordinates:\n", + " * cell_ids (cells) int64 6MB 0 1 2 3 4 ... 786428 786429 786430 786431\n", + " latitude (cells) float64 6MB 0.1492 0.2984 0.2984 ... -0.2984 -0.1492\n", + " longitude (cells) float64 6MB 45.0 45.18 44.82 45.0 ... 315.2 314.8 315.0\n", + "Dimensions without coordinates: cells\n", + "Data variables:\n", + " data (cells) float64 6MB -0.9999 -0.9993 -0.9993 ... 0.9993 0.9999\n", + "Indexes:\n", + " cell_ids HealpixIndex(nside=8, indexing_scheme=nested, rotation=[0.0, 0.0])" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "level = 8\n", + "cell_ids = np.arange(12 * 4**level)\n", + "grid_info = {\"grid_name\": \"healpix\", \"level\": level, \"indexing_scheme\": \"nested\"}\n", + "\n", + "ds = (\n", + " xr.Dataset(coords={\"cell_ids\": (\"cells\", cell_ids, grid_info)})\n", + " .pipe(xdggs.decode)\n", + " .pipe(lambda ds: ds.merge(ds.dggs.cell_centers()))\n", + " .assign(data=lambda ds: np.cos(6 * np.radians(ds[\"latitude\"])) * np.sin(6 * np.radians(ds[\"longitude\"])))\n", + ")\n", + "ds" + ] + }, + { + "cell_type": "markdown", + "id": "ecd4aff4-3373-4aca-8eaf-d641c38aa942", + "metadata": {}, + "source": [ + "### Plotting with xdggs is very simple, just use 'explore' function" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "373b7b1f-fff6-4b26-aa3c-80651199129d", + "metadata": { + "scrolled": true + }, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "d1942e3361ba4516a509a4713c170403", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "Map(layers=[SolidPolygonLayer(filled=True, get_fill_color=\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
<xarray.Dataset> Size: 4GB\n",
+       "Dimensions:          (oceanModelLayer: 75, cells: 12582912)\n",
+       "Coordinates:\n",
+       "    cell_ids         (cells) int64 101MB dask.array<chunksize=(100000,), meta=np.ndarray>\n",
+       "    latitude         (cells) float64 101MB dask.array<chunksize=(100000,), meta=np.ndarray>\n",
+       "    longitude        (cells) float64 101MB dask.array<chunksize=(100000,), meta=np.ndarray>\n",
+       "  * oceanModelLayer  (oceanModelLayer) float64 600B 1.0 2.0 3.0 ... 74.0 75.0\n",
+       "    step             timedelta64[ns] 8B ...\n",
+       "    time             datetime64[ns] 8B ...\n",
+       "    valid_time       datetime64[ns] 8B ...\n",
+       "Dimensions without coordinates: cells\n",
+       "Data variables:\n",
+       "    avg_thetao       (oceanModelLayer, cells) float32 4GB dask.array<chunksize=(10, 100000), meta=np.ndarray>\n",
+       "Attributes:\n",
+       "    Conventions:             CF-1.7\n",
+       "    GRIB_centre:             ecmf\n",
+       "    GRIB_centreDescription:  European Centre for Medium-Range Weather Forecasts\n",
+       "    GRIB_edition:            2\n",
+       "    GRIB_subCentre:          1003\n",
+       "    history:                 2024-06-03T13:52 GRIB to CDM+CF via cfgrib-0.9.1...\n",
+       "    institution:             European Centre for Medium-Range Weather Forecasts
" + ], + "text/plain": [ + " Size: 4GB\n", + "Dimensions: (oceanModelLayer: 75, cells: 12582912)\n", + "Coordinates:\n", + " cell_ids (cells) int64 101MB dask.array\n", + " latitude (cells) float64 101MB dask.array\n", + " longitude (cells) float64 101MB dask.array\n", + " * oceanModelLayer (oceanModelLayer) float64 600B 1.0 2.0 3.0 ... 74.0 75.0\n", + " step timedelta64[ns] 8B ...\n", + " time datetime64[ns] 8B ...\n", + " valid_time datetime64[ns] 8B ...\n", + "Dimensions without coordinates: cells\n", + "Data variables:\n", + " avg_thetao (oceanModelLayer, cells) float32 4GB dask.array\n", + "Attributes:\n", + " Conventions: CF-1.7\n", + " GRIB_centre: ecmf\n", + " GRIB_centreDescription: European Centre for Medium-Range Weather Forecasts\n", + " GRIB_edition: 2\n", + " GRIB_subCentre: 1003\n", + " history: 2024-06-03T13:52 GRIB to CDM+CF via cfgrib-0.9.1...\n", + " institution: European Centre for Medium-Range Weather Forecasts" + ] + }, + "execution_count": 5, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "ds = xr.open_dataset(\n", + " \"https://data-taos.ifremer.fr/DestinE/average_surface_temperature.zarr\",\n", + " engine=\"zarr\",\n", + " chunks={},\n", + " consolidated=True,\n", + ")\n", + "ds" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "fd0b72c2-a0d0-4929-a817-c439f508b4ea", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "
<xarray.DataArray 'avg_thetao' (cells: 12582912)> Size: 50MB\n",
+       "array([300.53537, 300.54025, 300.50998, ..., 301.4836 , 301.5012 ,\n",
+       "       301.49338], dtype=float32)\n",
+       "Coordinates:\n",
+       "  * cell_ids         (cells) int64 101MB 0 1 2 3 ... 12582909 12582910 12582911\n",
+       "    latitude         (cells) float64 101MB 0.0373 0.0746 ... -0.0746 -0.0373\n",
+       "    longitude        (cells) float64 101MB 45.0 45.04 44.96 ... 315.0 315.0\n",
+       "    oceanModelLayer  float64 8B 2.0\n",
+       "    step             timedelta64[ns] 8B 1 days\n",
+       "    time             datetime64[ns] 8B 2023-01-01\n",
+       "    valid_time       datetime64[ns] 8B 2023-01-02\n",
+       "Dimensions without coordinates: cells\n",
+       "Indexes:\n",
+       "    cell_ids  HealpixIndex(nside=10, indexing_scheme=nested, rotation=[0.0, 0.0])\n",
+       "Attributes: (12/18)\n",
+       "    GRIB_NV:                         0\n",
+       "    GRIB_cfName:                     unknown\n",
+       "    GRIB_cfVarName:                  avg_thetao\n",
+       "    GRIB_dataType:                   fc\n",
+       "    GRIB_gridDefinitionDescription:  150\n",
+       "    GRIB_gridType:                   healpix\n",
+       "    ...                              ...\n",
+       "    GRIB_stepUnits:                  1\n",
+       "    GRIB_typeOfLevel:                oceanModelLayer\n",
+       "    GRIB_units:                      K\n",
+       "    long_name:                       Time-mean sea water potential temperature\n",
+       "    standard_name:                   unknown\n",
+       "    units:                           K
" + ], + "text/plain": [ + " Size: 50MB\n", + "array([300.53537, 300.54025, 300.50998, ..., 301.4836 , 301.5012 ,\n", + " 301.49338], dtype=float32)\n", + "Coordinates:\n", + " * cell_ids (cells) int64 101MB 0 1 2 3 ... 12582909 12582910 12582911\n", + " latitude (cells) float64 101MB 0.0373 0.0746 ... -0.0746 -0.0373\n", + " longitude (cells) float64 101MB 45.0 45.04 44.96 ... 315.0 315.0\n", + " oceanModelLayer float64 8B 2.0\n", + " step timedelta64[ns] 8B 1 days\n", + " time datetime64[ns] 8B 2023-01-01\n", + " valid_time datetime64[ns] 8B 2023-01-02\n", + "Dimensions without coordinates: cells\n", + "Indexes:\n", + " cell_ids HealpixIndex(nside=10, indexing_scheme=nested, rotation=[0.0, 0.0])\n", + "Attributes: (12/18)\n", + " GRIB_NV: 0\n", + " GRIB_cfName: unknown\n", + " GRIB_cfVarName: avg_thetao\n", + " GRIB_dataType: fc\n", + " GRIB_gridDefinitionDescription: 150\n", + " GRIB_gridType: healpix\n", + " ... ...\n", + " GRIB_stepUnits: 1\n", + " GRIB_typeOfLevel: oceanModelLayer\n", + " GRIB_units: K\n", + " long_name: Time-mean sea water potential temperature\n", + " standard_name: unknown\n", + " units: K" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "data=(\n", + " ds[\"avg_thetao\"]\n", + " .isel(oceanModelLayer=1)\n", + " .compute()\n", + " .pipe(xdggs.decode)\n", + ")\n", + "data" ] }, { "cell_type": "code", - "execution_count": 1, - "id": "36cf9310-b950-4ff2-96ac-8b654b411947", - "metadata": {}, - "outputs": [], - "source": [ - "import numpy as np\n", - "import xarray as xr\n", - "\n", - "import xdggs" - ] - }, - { - "cell_type": "markdown", - "id": "68c364ab-3db3-42c9-9872-83b83b599ae5", + "execution_count": 7, + "id": "7d621fc6-8424-47d2-bf7a-70e9dc79413c", "metadata": {}, + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "e3626d4e478849e89bcd74c57e4d8b83", + "version_major": 2, + "version_minor": 1 + }, + "text/plain": [ + "Map(layers=[SolidPolygonLayer(filled=True, get_fill_color=
<xarray.Dataset> Size: 25MB\n",
-       "Dimensions:    (cells: 786432)\n",
+       "
<xarray.DataArray 'avg_thetao' (cells: 12582912)> Size: 50MB\n",
+       "array([27.385376, 27.390259, 27.359985, ..., 28.333618, 28.351196,\n",
+       "       28.343384], dtype=float32)\n",
        "Coordinates:\n",
-       "  * cell_ids   (cells) int64 6MB 0 1 2 3 4 ... 786428 786429 786430 786431\n",
-       "    latitude   (cells) float64 6MB 0.1492 0.2984 0.2984 ... -0.2984 -0.1492\n",
-       "    longitude  (cells) float64 6MB 45.0 45.18 44.82 45.0 ... 315.2 314.8 315.0\n",
+       "    cell_ids         (cells) int64 101MB 0 1 2 3 ... 12582909 12582910 12582911\n",
+       "    latitude         (cells) float64 101MB 0.0373 0.0746 ... -0.0746 -0.0373\n",
+       "    longitude        (cells) float64 101MB 45.0 45.04 44.96 ... 315.0 315.0\n",
+       "    oceanModelLayer  float64 8B 2.0\n",
+       "    step             timedelta64[ns] 8B 1 days\n",
+       "    time             datetime64[ns] 8B 2023-01-01\n",
+       "    valid_time       datetime64[ns] 8B 2023-01-02\n",
        "Dimensions without coordinates: cells\n",
-       "Data variables:\n",
-       "    data       (cells) float64 6MB -0.9999 -0.9993 -0.9993 ... 0.9993 0.9999\n",
-       "Indexes:\n",
-       "    cell_ids  HealpixIndex(nside=8, indexing_scheme=nested, rotation=[0.0, 0.0])
" + "Attributes: (12/18)\n", + " GRIB_NV: 0\n", + " GRIB_cfName: unknown\n", + " GRIB_cfVarName: avg_thetao\n", + " GRIB_dataType: fc\n", + " GRIB_gridDefinitionDescription: 150\n", + " GRIB_gridType: healpix\n", + " ... ...\n", + " GRIB_stepUnits: 1\n", + " GRIB_typeOfLevel: oceanModelLayer\n", + " GRIB_units: K\n", + " long_name: Time-mean sea water potential temperature\n", + " standard_name: unknown\n", + " units: degree_Celsius
" ], "text/plain": [ - " Size: 25MB\n", - "Dimensions: (cells: 786432)\n", + " Size: 50MB\n", + "array([27.385376, 27.390259, 27.359985, ..., 28.333618, 28.351196,\n", + " 28.343384], dtype=float32)\n", "Coordinates:\n", - " * cell_ids (cells) int64 6MB 0 1 2 3 4 ... 786428 786429 786430 786431\n", - " latitude (cells) float64 6MB 0.1492 0.2984 0.2984 ... -0.2984 -0.1492\n", - " longitude (cells) float64 6MB 45.0 45.18 44.82 45.0 ... 315.2 314.8 315.0\n", + " cell_ids (cells) int64 101MB 0 1 2 3 ... 12582909 12582910 12582911\n", + " latitude (cells) float64 101MB 0.0373 0.0746 ... -0.0746 -0.0373\n", + " longitude (cells) float64 101MB 45.0 45.04 44.96 ... 315.0 315.0\n", + " oceanModelLayer float64 8B 2.0\n", + " step timedelta64[ns] 8B 1 days\n", + " time datetime64[ns] 8B 2023-01-01\n", + " valid_time datetime64[ns] 8B 2023-01-02\n", "Dimensions without coordinates: cells\n", - "Data variables:\n", - " data (cells) float64 6MB -0.9999 -0.9993 -0.9993 ... 0.9993 0.9999\n", - "Indexes:\n", - " cell_ids HealpixIndex(nside=8, indexing_scheme=nested, rotation=[0.0, 0.0])" + "Attributes: (12/18)\n", + " GRIB_NV: 0\n", + " GRIB_cfName: unknown\n", + " GRIB_cfVarName: avg_thetao\n", + " GRIB_dataType: fc\n", + " GRIB_gridDefinitionDescription: 150\n", + " GRIB_gridType: healpix\n", + " ... ...\n", + " GRIB_stepUnits: 1\n", + " GRIB_typeOfLevel: oceanModelLayer\n", + " GRIB_units: K\n", + " long_name: Time-mean sea water potential temperature\n", + " standard_name: unknown\n", + " units: degree_Celsius" ] }, - "execution_count": 5, + "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ - "level = 8\n", - "cell_ids = np.arange(12 * 4**level)\n", - "grid_info = {\"grid_name\": \"healpix\", \"level\": level, \"indexing_scheme\": \"nested\"}\n", - "\n", - "ds = (\n", - " xr.Dataset(coords={\"cell_ids\": (\"cells\", cell_ids, grid_info)})\n", - " .pipe(xdggs.decode)\n", - " .pipe(lambda ds: ds.merge(ds.dggs.cell_centers()))\n", - " .assign(data=lambda ds: np.cos(6 * np.radians(ds[\"latitude\"])) * np.sin(6 * np.radians(ds[\"longitude\"])))\n", + "import pint_xarray\n", + "import cf_xarray.units\n", + "data = (\n", + " data\n", + " .pint.quantify()\n", + " .pint.to({\"avg_thetao\": \"degC\"})\n", + " .pint.dequantify()\n", ")\n", - "ds" - ] - }, - { - "cell_type": "markdown", - "id": "ecd4aff4-3373-4aca-8eaf-d641c38aa942", - "metadata": {}, - "source": [ - "create the map and visualize" + "data\n" ] }, { "cell_type": "code", - "execution_count": 8, - "id": "373b7b1f-fff6-4b26-aa3c-80651199129d", + "execution_count": 9, + "id": "fad2c94e-f5a6-445e-9d64-9c5cd993f6d7", "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "bfaaf914629843359bbfcd6307d70df1", + "model_id": "a22a68a92bdc469986382f63dbfca45c", "version_major": 2, "version_minor": 1 }, "text/plain": [ - "Map(layers=[SolidPolygonLayer(filled=True, get_fill_color=