{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Using Google Earth Engine" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This tutorial shows how to harness data from Google Earth Engine using `cubo`:" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import cubo\n", "import ee" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Initialize the high volume endpoint from Google Earth Engine:" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "ee.Initialize(opt_url='https://earthengine-highvolume.googleapis.com')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`cubo` works in a similar way for GEE, and you just have to consider the two following things:\n", "\n", "- Set `gee=True` inside the function.\n", "- Set `collection` to the ID of the GEE collection to use, or a `ee.ImageCollection` object." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Example 1: Use the ID of a GEE Collection\n", "\n", "Let's try first with just the ID of a collection:" ] }, { "cell_type": "code", "execution_count": 61, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
<xarray.DataArray 'COPERNICUS/S2_SR_HARMONIZED' (time: 12, band: 3, y: 64, x: 64)>\n", "dask.array<transpose, shape=(12, 3, 64, 64), dtype=int32, chunksize=(12, 1, 64, 64), chunktype=numpy.ndarray>\n", "Coordinates:\n", " * time (time) datetime64[ns] 2021-06-02T10:17:25.4740...\n", " * x (x) float64 3.784e+05 3.785e+05 ... 3.791e+05\n", " * y (y) float64 5.301e+06 5.301e+06 ... 5.3e+06\n", " * band (band) object 'B2' 'B3' 'B4'\n", " cubo:distance_from_center (y, x) float64 445.7 438.8 432.0 ... 438.3 445.4\n", "Attributes:\n", " collection: COPERNICUS/S2_SR_HARMONIZED\n", " stac: https://earthengine-stac.storage.googleapis.com/cat...\n", " 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: 2021-06-01\n", " time_coverage_end: 2021-07-01
<xarray.DataArray 'COPERNICUS/S2_SR_HARMONIZED' (time: 5, band: 3, y: 64, x: 64)>\n", "dask.array<transpose, shape=(5, 3, 64, 64), dtype=int32, chunksize=(5, 1, 64, 64), chunktype=numpy.ndarray>\n", "Coordinates:\n", " * time (time) datetime64[ns] 2021-06-04T10:07:28.1460...\n", " * x (x) float64 3.784e+05 3.785e+05 ... 3.791e+05\n", " * y (y) float64 5.301e+06 5.301e+06 ... 5.3e+06\n", " * band (band) object 'B2' 'B3' 'B4'\n", " cubo:distance_from_center (y, x) float64 445.7 438.8 432.0 ... 438.3 445.4\n", "Attributes:\n", " collection: COPERNICUS/S2_SR_HARMONIZED\n", " stac: https://earthengine-stac.storage.googleapis.com/cat...\n", " 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: 2021-06-01\n", " time_coverage_end: 2021-07-01