{ "cells": [ { "cell_type": "markdown", "id": "6b55717a", "metadata": {}, "source": [ "# Downloading Images and Collections\n", "In this tutorial, we'll look at how we can use `wxee` and the `wx` accesor to quickly and easily download images and image collections from Earth Engine to a local drive. \n", "\n", "`wxee` isn't designed to replace Earth Engine's native downloading functionality--if you need high resolution images or large areas, downloading to a Drive using ee is probably the best option. What `wxee`'s downloading system is great for is quickly pulling small regions or mesoscale images for further processing in Python without the hassle of intermediate steps." ] }, { "cell_type": "markdown", "id": "3081bca9", "metadata": {}, "source": [ "## Setup" ] }, { "cell_type": "code", "execution_count": null, "id": "656935bb", "metadata": {}, "outputs": [], "source": [ "!pip install wxee" ] }, { "cell_type": "code", "execution_count": 1, "id": "739f74b7", "metadata": { "ExecuteTime": { "end_time": "2021-09-12T04:09:14.626266Z", "start_time": "2021-09-12T04:09:11.263266Z" } }, "outputs": [], "source": [ "import ee\n", "import wxee\n", "\n", "ee.Authenticate()\n", "wxee.Initialize()" ] }, { "cell_type": "markdown", "id": "f1d076fd", "metadata": {}, "source": [ "## Downloading an Image" ] }, { "cell_type": "markdown", "id": "1ff1a78d", "metadata": {}, "source": [ "Load an image from MODIS. For convenience, we'll select just the red, green, and blue bands." ] }, { "cell_type": "code", "execution_count": 2, "id": "a2491f50", "metadata": { "ExecuteTime": { "end_time": "2021-09-12T04:09:14.630624Z", "start_time": "2021-09-12T04:09:14.627974Z" } }, "outputs": [], "source": [ "img = ee.Image(\"MODIS/006/MOD09GA/2021_06_01\").select([\"sur_refl_b01\", \"sur_refl_b04\" ,\"sur_refl_b03\"])" ] }, { "cell_type": "markdown", "id": "fde849d1", "metadata": {}, "source": [ "Set the download parameters." ] }, { "cell_type": "code", "execution_count": 3, "id": "9a4ef628", "metadata": { "ExecuteTime": { "end_time": "2021-09-12T04:09:16.743925Z", "start_time": "2021-09-12T04:09:16.739648Z" } }, "outputs": [], "source": [ "# The file name to save\n", "description = \"modis_img\"\n", "# The coordinate reference system to use (NAD83 Albers CONUS)\n", "crs = \"EPSG:5070\"\n", "# Spatial resolution in CRS units (meters)\n", "scale = 500\n", "# The region to download the image within.\n", "region = ee.Geometry.Polygon(\n", " [[[-120.0576549852371, 46.185091976777684],\n", " [-120.0576549852371, 45.577074504710005],\n", " [-118.91782344226834, 45.577074504710005],\n", " [-118.91782344226834, 46.185091976777684]]]\n", ")" ] }, { "cell_type": "markdown", "id": "09a996a2", "metadata": {}, "source": [ "