{ "cells": [ { "cell_type": "markdown", "id": "a7a87436-7cd6-4a71-9c6a-07f959813f43", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "## Using GeoTIFF data" ] }, { "cell_type": "raw", "id": "00346ea5-aff7-455a-82ce-4a69f75c677a", "metadata": { "editable": true, "raw_mimetype": "text/restructuredtext", "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "This example uses a small GeoTIFF file containing 3 bands. With :func:`from_source` we read this data into a fieldlist with one field per band." ] }, { "cell_type": "code", "execution_count": 1, "id": "d35c55f2-7320-4967-9a31-3c56e566df65", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "import earthkit.data as ekd\n", "ds = ekd.from_source(\"sample\", \"multi_band.tif\")" ] }, { "cell_type": "code", "execution_count": 2, "id": "2379a4b4-bbd9-48c3-84bb-61d674cf01f4", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
| \n", " | variable | \n", "band | \n", "
|---|---|---|
| 0 | \n", "band_1 | \n", "1 | \n", "
| 1 | \n", "band_2 | \n", "2 | \n", "
| 2 | \n", "band_3 | \n", "3 | \n", "
<xarray.Dataset> Size: 1MB\n",
"Dimensions: (x: 315, y: 294)\n",
"Coordinates:\n",
" * x (x) float64 3kB 3.68e+05 3.681e+05 ... 3.839e+05 3.84e+05\n",
" * y (y) float64 2kB 5.632e+06 5.632e+06 ... 5.616e+06 5.616e+06\n",
" spatial_ref int64 8B 0\n",
"Data variables:\n",
" band_1 (y, x) float32 370kB ...\n",
" band_2 (y, x) float32 370kB ...\n",
" band_3 (y, x) float32 370kB ...\n",
"Attributes:\n",
" TIFFTAG_XRESOLUTION: 96\n",
" TIFFTAG_YRESOLUTION: 96\n",
" TIFFTAG_RESOLUTIONUNIT: 2 (pixels/inch)\n",
" AREA_OR_POINT: Area