{ "cells": [ { "cell_type": "markdown", "id": "e64e134b", "metadata": {}, "source": [ "# Selecting Collections" ] }, { "cell_type": "markdown", "id": "8d213403", "metadata": {}, "source": [ "This tutorial shows how to select a collection and visualize a cube:" ] }, { "cell_type": "code", "execution_count": 1, "id": "dcbbb720-a4bf-4803-9016-f6d5f9757076", "metadata": {}, "outputs": [], "source": [ "import cubo\n", "import xarray as xr" ] }, { "cell_type": "markdown", "id": "30a8650e", "metadata": {}, "source": [ "This code creates a cube with an edge size of 64 pixels from Sentinel-2 and apply a cloud coverage filter of 40 percent. Get just the RGB bands:" ] }, { "cell_type": "code", "execution_count": 2, "id": "749b9b6f-1fee-4de3-a811-556eb0398b1d", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.DataArray 'sentinel-2-l2a' (time: 46, band: 3, y: 64, x: 64)>\n", "dask.array<fetch_raster_window, shape=(46, 3, 64, 64), dtype=float64, chunksize=(1, 1, 64, 64), chunktype=numpy.ndarray>\n", "Coordinates: (12/46)\n", " * time (time) datetime64[ns] 2020-01-01...\n", " id (time) <U54 'S2B_MSIL2A_20200101...\n", " * band (band) <U3 'B02' 'B03' 'B04'\n", " * x (x) float64 3.784e+05 ... 3.791e+05\n", " * y (y) float64 5.301e+06 ... 5.3e+06\n", " s2:medium_proba_clouds_percentage (time) float64 0.3489 ... 4.911\n", " ... ...\n", " title (band) <U20 'Band 2 - Blue - 10m...\n", " proj:transform object {0.0, 300000.0, 5400000.0...\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:32633'\n", "Attributes:\n", " collection: sentinel-2-l2a\n", " stac: https://planetarycomputer.microsoft.com/api/stac/v1\n", " epsg: EPSG:32633\n", " resolution: 10\n", " edge_size: 64\n", " central_lat: 47.848151988493385\n", " central_lon: 13.379491178028564\n", " central_y: 5300694.38448788\n", " central_x: 378764.6058600877\n", " time_coverage_start: 2020-01-01\n", " time_coverage_end: 2021-01-01
<xarray.DataArray 'landsat-c2-l2' (time: 25, band: 3, y: 32, x: 32)>\n", "dask.array<fetch_raster_window, shape=(25, 3, 32, 32), dtype=float64, chunksize=(1, 1, 32, 32), chunktype=numpy.ndarray>\n", "Coordinates: (12/30)\n", " * time (time) datetime64[ns] 2020-01-11T09:58:09.42...\n", " id (time) <U31 'LC08_L2SP_192027_20200111_02_T1...\n", " * band (band) <U5 'blue' 'green' 'red'\n", " * x (x) float64 3.783e+05 3.783e+05 ... 3.792e+05\n", " * y (y) float64 5.301e+06 5.301e+06 ... 5.3e+06\n", " landsat:cloud_cover_land (time) float64 44.67 18.59 ... 44.81 42.77\n", " ... ...\n", " raster:bands object {'scale': 2.75e-05, 'nodata': 0, 'off...\n", " title (band) <U10 'Blue Band' 'Green Band' 'Red Band'\n", " common_name (band) <U5 'blue' 'green' 'red'\n", " center_wavelength (band) float64 0.48 0.56 0.65\n", " full_width_half_max (band) float64 0.06 0.06 0.04\n", " epsg <U10 'EPSG:32633'\n", "Attributes:\n", " collection: landsat-c2-l2\n", " stac: https://planetarycomputer.microsoft.com/api/stac/v1\n", " epsg: EPSG:32633\n", " resolution: 30\n", " edge_size: 32\n", " central_lat: 47.848151988493385\n", " central_lon: 13.379491178028564\n", " central_y: 5300694.38448788\n", " central_x: 378764.6058600877\n", " time_coverage_start: 2020-01-01\n", " time_coverage_end: 2021-01-01" ], "text/plain": [ "