{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Getting Started" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "This tutorial shows some examples of how to use `cubo`:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import cubo" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Create a cube with an edge size of 32 pixels and a resolution of 10 m from the Sentinel-2 L2A Collection of Planetary Computer given a pair of coordinates and start and end dates using just the RGB bands:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DataArray 'sentinel-2-l2a' (time: 3, band: 3, y: 32, x: 32)>\n",
       "dask.array<fetch_raster_window, shape=(3, 3, 32, 32), dtype=float64, chunksize=(1, 1, 32, 32), chunktype=numpy.ndarray>\n",
       "Coordinates: (12/46)\n",
       "  * time                                     (time) datetime64[ns] 2021-06-05...\n",
       "    id                                       (time) <U54 'S2A_MSIL2A_20210605...\n",
       "  * band                                     (band) <U3 'B02' 'B03' 'B04'\n",
       "  * x                                        (x) float64 5.715e+05 ... 5.718e+05\n",
       "  * y                                        (y) float64 5.539e+06 ... 5.539e+06\n",
       "    s2:datastrip_id                          (time) <U64 'S2A_OPER_MSI_L2A_DS...\n",
       "    ...                                       ...\n",
       "    proj:transform                           object {0.0, 5600040.0, 10.0, 49...\n",
       "    proj:bbox                                object {5490240.0, 5600040.0, 60...\n",
       "    common_name                              (band) <U5 'blue' 'green' 'red'\n",
       "    center_wavelength                        (band) float64 0.49 0.56 0.665\n",
       "    full_width_half_max                      (band) float64 0.098 0.045 0.038\n",
       "    epsg                                     <U10 'EPSG:32632'\n",
       "Attributes:\n",
       "    collection:           sentinel-2-l2a\n",
       "    stac:                 https://planetarycomputer.microsoft.com/api/stac/v1\n",
       "    epsg:                 EPSG:32632\n",
       "    resolution:           10\n",
       "    edge_size:            32\n",
       "    central_lat:          50\n",
       "    central_lon:          10\n",
       "    central_y:            5539109.815298798\n",
       "    central_x:            571666.4475034359\n",
       "    time_coverage_start:  2021-06-01\n",
       "    time_coverage_end:    2021-06-10
" ], "text/plain": [ "\n", "dask.array\n", "Coordinates: (12/46)\n", " * time (time) datetime64[ns] 2021-06-05...\n", " id (time) \n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "\n", "
<xarray.DataArray 'sentinel-s2-l2a-cogs' (time: 31, band: 3, y: 128, x: 128)>\n",
       "dask.array<fetch_raster_window, shape=(31, 3, 128, 128), dtype=float64, chunksize=(1, 1, 128, 128), chunktype=numpy.ndarray>\n",
       "Coordinates: (12/26)\n",
       "  * time                        (time) datetime64[ns] 2020-01-02T15:41:55 ......\n",
       "    id                          (time) <U24 'S2A_18NUK_20200102_0_L2A' ... 'S...\n",
       "  * band                        (band) <U3 'B05' 'B06' 'B07'\n",
       "  * x                           (x) float64 3.656e+05 3.656e+05 ... 3.681e+05\n",
       "  * y                           (y) float64 4.778e+05 4.778e+05 ... 4.752e+05\n",
       "    data_coverage               (time) object 77.62 77.37 77.69 ... None None\n",
       "    ...                          ...\n",
       "    sentinel:product_id         (time) <U60 'S2A_MSIL2A_20200102T153611_N0213...\n",
       "    sentinel:latitude_band      <U1 'N'\n",
       "    proj:shape                  object {5490}\n",
       "    title                       (band) <U6 'Band 5' 'Band 6' 'Band 7'\n",
       "    proj:transform              object {0, 300000, 1, 500040, -20, 20}\n",
       "    epsg                        <U10 'EPSG:32618'\n",
       "Attributes:\n",
       "    collection:           sentinel-s2-l2a-cogs\n",
       "    stac:                 https://earth-search.aws.element84.com/v0\n",
       "    epsg:                 EPSG:32618\n",
       "    resolution:           20\n",
       "    edge_size:            128\n",
       "    central_lat:          4.31\n",
       "    central_lon:          -76.2\n",
       "    central_y:            476498.32356558647\n",
       "    central_x:            366835.4548862558\n",
       "    time_coverage_start:  2020-01-01\n",
       "    time_coverage_end:    2020-06-01
" ], "text/plain": [ "\n", "dask.array\n", "Coordinates: (12/26)\n", " * time (time) datetime64[ns] 2020-01-02T15:41:55 ......\n", " id (time)