{ "cells": [ { "cell_type": "markdown", "id": "0", "metadata": {}, "source": [ "[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/gee-community/geemap/blob/master/docs/workshops/GEE_Workshop_2024.ipynb)\n", "\n", "**Earth Engine Data Converters**\n", "\n", "- Notebook: \n", "- Earth Engine: \n", "- Geemap: \n", "\n", "## Introduction\n", "\n", "This notebook contains the materials for the workshop **Earth Engine Data Converters** at the 第七届地球空间大数据与云计算前沿会议与集中学习.\n", "\n", "### Agenda\n", "\n", "This workshop covers the following topics:\n", "- Colab setup\n", "- Vector data conversion\n", "- Raster data extraction\n", "- Exporting Earth Engine data\n", "- Creating timelapse animations\n", "\n", "\n", "### Prerequisites\n", "\n", "- To use geemap and the Earth Engine Python API, you must [register](https://code.earthengine.google.com/register) for an Earth Engine account and follow the instructions [here](https://docs.google.com/document/d/1ZGSmrNm6_baqd8CHt33kIBWOlvkh-HLr46bODgJN1h0/edit?usp=sharing) to create a Cloud Project. Earth Engine is free for [noncommercial and research use](https://earthengine.google.com/noncommercial). To test whether you can use authenticate the Earth Engine Python API, please run [this notebook](https://colab.research.google.com/github/gee-community/geemap/blob/master/docs/notebooks/geemap_colab.ipynb) on Google Colab.\n", "\n", "## Technical requirements\n", "\n", "### Install packages\n", "\n", "```bash\n", "conda create -n gee python=3.11\n", "conda activate gee\n", "conda install -c conda-forge mamba\n", "mamba install -c conda-forge pygis\n", "```" ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "# %pip install geemap pygis mapclassify" ] }, { "cell_type": "markdown", "id": "2", "metadata": {}, "source": [ "### Import libraries" ] }, { "cell_type": "code", "execution_count": null, "id": "3", "metadata": {}, "outputs": [], "source": [ "import ee\n", "import geemap" ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "geemap.ee_initialize()" ] }, { "cell_type": "markdown", "id": "5", "metadata": {}, "source": [ "## Colab setup\n", "\n", "Uncomment the following line to get the Earth Engine authorization token. Please treat your token with care and don't share it with anyone. Copy the token to the clipboard." ] }, { "cell_type": "code", "execution_count": null, "id": "6", "metadata": {}, "outputs": [], "source": [ "# geemap.get_ee_token()" ] }, { "cell_type": "markdown", "id": "7", "metadata": {}, "source": [ "1. Open your Google Colab notebook and click on the `secrets` tab.\n", "2. Create a new secret with the name `EARTHENGINE_TOKEN`.\n", "3. Paste the content from the clipboard into the `Value` input box of the created secret.\n", "4. Toggle the button on the left to allow notebook access to the secret.\n", "\n", "![](https://i.imgur.com/Z9R08uU.png)" ] }, { "cell_type": "markdown", "id": "8", "metadata": {}, "source": [ "## Vector data conversion\n", "\n", "### From GeoJSON" ] }, { "cell_type": "code", "execution_count": null, "id": "9", "metadata": {}, "outputs": [], "source": [ "in_geojson = \"https://github.com/gee-community/geemap/blob/master/examples/data/countries.geojson\"\n", "m = geemap.Map()\n", "fc = geemap.geojson_to_ee(in_geojson)\n", "m.add_layer(fc.style(**{\"color\": \"ff0000\", \"fillColor\": \"00000000\"}), {}, \"Countries\")\n", "m" ] }, { "cell_type": "markdown", "id": "10", "metadata": {}, "source": [ "### From Shapefile" ] }, { "cell_type": "code", "execution_count": null, "id": "11", "metadata": {}, "outputs": [], "source": [ "url = \"https://github.com/gee-community/geemap/blob/master/examples/data/countries.zip\"\n", "geemap.download_file(url, overwrite=True)" ] }, { "cell_type": "code", "execution_count": null, "id": "12", "metadata": {}, "outputs": [], "source": [ "in_shp = \"countries.shp\"\n", "fc = geemap.shp_to_ee(in_shp)" ] }, { "cell_type": "code", "execution_count": null, "id": "13", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map()\n", "m.add_layer(fc, {}, \"Countries\")\n", "m" ] }, { "cell_type": "markdown", "id": "14", "metadata": {}, "source": [ "### From GeoDataFrame" ] }, { "cell_type": "code", "execution_count": null, "id": "15", "metadata": {}, "outputs": [], "source": [ "import geopandas as gpd\n", "\n", "gdf = gpd.read_file(in_shp)\n", "fc = geemap.gdf_to_ee(gdf)" ] }, { "cell_type": "code", "execution_count": null, "id": "16", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map()\n", "m.add_layer(fc, {}, \"Countries\")\n", "m" ] }, { "cell_type": "markdown", "id": "17", "metadata": {}, "source": [ "### To GeoJSON" ] }, { "cell_type": "code", "execution_count": null, "id": "18", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map()\n", "states = ee.FeatureCollection(\"TIGER/2018/States\")\n", "fc = states.filter(ee.Filter.eq(\"NAME\", \"Alaska\"))\n", "m.add_layer(fc, {}, \"Alaska\")\n", "m.center_object(fc, 4)\n", "m" ] }, { "cell_type": "code", "execution_count": null, "id": "19", "metadata": {}, "outputs": [], "source": [ "geemap.ee_to_geojson(fc, filename=\"Alaska.geojson\")" ] }, { "cell_type": "markdown", "id": "20", "metadata": {}, "source": [ "### To Shapefile" ] }, { "cell_type": "code", "execution_count": null, "id": "21", "metadata": {}, "outputs": [], "source": [ "geemap.ee_to_shp(fc, filename=\"Alaska.shp\")" ] }, { "cell_type": "markdown", "id": "22", "metadata": {}, "source": [ "### To GeoDataFrame" ] }, { "cell_type": "code", "execution_count": null, "id": "23", "metadata": {}, "outputs": [], "source": [ "gdf = geemap.ee_to_gdf(fc)\n", "gdf" ] }, { "cell_type": "code", "execution_count": null, "id": "24", "metadata": {}, "outputs": [], "source": [ "gdf.explore()" ] }, { "cell_type": "markdown", "id": "25", "metadata": {}, "source": [ "### To DataFrame" ] }, { "cell_type": "code", "execution_count": null, "id": "26", "metadata": {}, "outputs": [], "source": [ "df = geemap.ee_to_df(fc)\n", "df" ] }, { "cell_type": "markdown", "id": "27", "metadata": {}, "source": [ "### To CSV" ] }, { "cell_type": "code", "execution_count": null, "id": "28", "metadata": {}, "outputs": [], "source": [ "geemap.ee_to_csv(fc, filename=\"Alaska.csv\")" ] }, { "cell_type": "markdown", "id": "29", "metadata": {}, "source": [ "## Raster data extraction\n", "\n", "### Extracting values to points" ] }, { "cell_type": "code", "execution_count": null, "id": "30", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map(center=[40, -100], zoom=4)\n", "\n", "dem = ee.Image(\"USGS/SRTMGL1_003\")\n", "landsat7 = ee.Image(\"LANDSAT/LE7_TOA_5YEAR/1999_2003\")\n", "\n", "vis_params = {\n", " \"min\": 0,\n", " \"max\": 4000,\n", " \"palette\": [\"006633\", \"E5FFCC\", \"662A00\", \"D8D8D8\", \"F5F5F5\"],\n", "}\n", "\n", "m.add_layer(\n", " landsat7,\n", " {\"bands\": [\"B4\", \"B3\", \"B2\"], \"min\": 20, \"max\": 200, \"gamma\": 2},\n", " \"Landsat 7\",\n", ")\n", "m.add_layer(dem, vis_params, \"SRTM DEM\", True, 1)\n", "m" ] }, { "cell_type": "code", "execution_count": null, "id": "31", "metadata": {}, "outputs": [], "source": [ "in_shp = \"us_cities.shp\"\n", "url = \"https://github.com/giswqs/data/raw/main/us/us_cities.zip\"\n", "geemap.download_file(url)" ] }, { "cell_type": "code", "execution_count": null, "id": "32", "metadata": {}, "outputs": [], "source": [ "in_fc = geemap.shp_to_ee(in_shp)\n", "m.add_layer(in_fc, {}, \"Cities\")" ] }, { "cell_type": "code", "execution_count": null, "id": "33", "metadata": {}, "outputs": [], "source": [ "geemap.extract_values_to_points(in_fc, dem, out_fc=\"dem.shp\")" ] }, { "cell_type": "code", "execution_count": null, "id": "34", "metadata": {}, "outputs": [], "source": [ "geemap.shp_to_gdf(\"dem.shp\")" ] }, { "cell_type": "code", "execution_count": null, "id": "35", "metadata": {}, "outputs": [], "source": [ "geemap.extract_values_to_points(in_fc, landsat7, \"landsat.csv\")" ] }, { "cell_type": "code", "execution_count": null, "id": "36", "metadata": {}, "outputs": [], "source": [ "geemap.csv_to_df(\"landsat.csv\")" ] }, { "cell_type": "markdown", "id": "37", "metadata": {}, "source": [ "### Extracting pixel values along a transect" ] }, { "cell_type": "code", "execution_count": null, "id": "38", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map(center=[40, -100], zoom=4)\n", "m.add_basemap(\"TERRAIN\")\n", "\n", "image = ee.Image(\"USGS/SRTMGL1_003\")\n", "vis_params = {\n", " \"min\": 0,\n", " \"max\": 4000,\n", " \"palette\": [\"006633\", \"E5FFCC\", \"662A00\", \"D8D8D8\", \"F5F5F5\"],\n", "}\n", "m.add_layer(image, vis_params, \"SRTM DEM\", True, 0.5)\n", "m" ] }, { "cell_type": "code", "execution_count": null, "id": "39", "metadata": {}, "outputs": [], "source": [ "line = m.user_roi\n", "if line is None:\n", " line = ee.Geometry.LineString(\n", " [[-120.2232, 36.3148], [-118.9269, 36.7121], [-117.2022, 36.7562]]\n", " )\n", " m.add_layer(line, {}, \"ROI\")\n", "m.centerObject(line)" ] }, { "cell_type": "code", "execution_count": null, "id": "40", "metadata": {}, "outputs": [], "source": [ "reducer = \"mean\"\n", "transect = geemap.extract_transect(\n", " image, line, n_segments=100, reducer=reducer, to_pandas=True\n", ")\n", "transect" ] }, { "cell_type": "code", "execution_count": null, "id": "41", "metadata": {}, "outputs": [], "source": [ "geemap.line_chart(\n", " data=transect,\n", " x=\"distance\",\n", " y=\"mean\",\n", " markers=True,\n", " x_label=\"Distance (m)\",\n", " y_label=\"Elevation (m)\",\n", " height=400,\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "42", "metadata": {}, "outputs": [], "source": [ "transect.to_csv(\"transect.csv\")" ] }, { "cell_type": "markdown", "id": "43", "metadata": {}, "source": [ "## Exporting Earth Engine data\n", "\n", "### Exporting images\n", "\n", "Add a Landsat image to the map." ] }, { "cell_type": "code", "execution_count": null, "id": "44", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map()\n", "\n", "image = ee.Image(\"LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140318\").select(\n", " [\"B5\", \"B4\", \"B3\"]\n", ")\n", "\n", "vis_params = {\"min\": 0, \"max\": 0.5, \"gamma\": [0.95, 1.1, 1]}\n", "\n", "m.center_object(image)\n", "m.add_layer(image, vis_params, \"Landsat\")\n", "m" ] }, { "cell_type": "markdown", "id": "45", "metadata": {}, "source": [ "Add a rectangle to the map." ] }, { "cell_type": "code", "execution_count": null, "id": "46", "metadata": {}, "outputs": [], "source": [ "region = ee.Geometry.BBox(-122.5955, 37.5339, -122.0982, 37.8252)\n", "fc = ee.FeatureCollection(region)\n", "style = {\"color\": \"ffff00ff\", \"fillColor\": \"00000000\"}\n", "m.add_layer(fc.style(**style), {}, \"ROI\")" ] }, { "cell_type": "markdown", "id": "47", "metadata": {}, "source": [ "To local drive" ] }, { "cell_type": "code", "execution_count": null, "id": "48", "metadata": {}, "outputs": [], "source": [ "geemap.ee_export_image(image, filename=\"landsat.tif\", scale=30, region=region)" ] }, { "cell_type": "markdown", "id": "49", "metadata": {}, "source": [ "Check image projection." ] }, { "cell_type": "code", "execution_count": null, "id": "50", "metadata": {}, "outputs": [], "source": [ "projection = image.select(0).projection().getInfo()\n", "projection" ] }, { "cell_type": "code", "execution_count": null, "id": "51", "metadata": {}, "outputs": [], "source": [ "crs = projection[\"crs\"]\n", "crs_transform = projection[\"transform\"]" ] }, { "cell_type": "markdown", "id": "52", "metadata": {}, "source": [ "Specify region, crs, and crs_transform." ] }, { "cell_type": "code", "execution_count": null, "id": "53", "metadata": {}, "outputs": [], "source": [ "geemap.ee_export_image(\n", " image,\n", " filename=\"landsat_crs.tif\",\n", " crs=crs,\n", " crs_transform=crs_transform,\n", " region=region,\n", ")" ] }, { "cell_type": "markdown", "id": "54", "metadata": {}, "source": [ "To Google Drive" ] }, { "cell_type": "code", "execution_count": null, "id": "55", "metadata": {}, "outputs": [], "source": [ "geemap.ee_export_image_to_drive(\n", " image, description=\"landsat\", folder=\"export\", region=region, scale=30\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "56", "metadata": {}, "outputs": [], "source": [ "geemap.download_ee_image(image, \"landsat.tif\", scale=90)" ] }, { "cell_type": "markdown", "id": "57", "metadata": {}, "source": [ "### Exporting image collections" ] }, { "cell_type": "code", "execution_count": null, "id": "58", "metadata": {}, "outputs": [], "source": [ "point = ee.Geometry.Point(-99.2222, 46.7816)\n", "collection = (\n", " ee.ImageCollection(\"USDA/NAIP/DOQQ\")\n", " .filterBounds(point)\n", " .filterDate(\"2008-01-01\", \"2018-01-01\")\n", " .filter(ee.Filter.listContains(\"system:band_names\", \"N\"))\n", ")" ] }, { "cell_type": "code", "execution_count": null, "id": "59", "metadata": {}, "outputs": [], "source": [ "collection.aggregate_array(\"system:index\")" ] }, { "cell_type": "markdown", "id": "60", "metadata": {}, "source": [ "To local drive" ] }, { "cell_type": "code", "execution_count": null, "id": "61", "metadata": {}, "outputs": [], "source": [ "geemap.ee_export_image_collection(collection, out_dir=\".\", scale=10)" ] }, { "cell_type": "markdown", "id": "62", "metadata": {}, "source": [ "To Google Drive" ] }, { "cell_type": "code", "execution_count": null, "id": "63", "metadata": {}, "outputs": [], "source": [ "geemap.ee_export_image_collection_to_drive(collection, folder=\"export\", scale=10)" ] }, { "cell_type": "markdown", "id": "64", "metadata": {}, "source": [ "### Exporting feature collections" ] }, { "cell_type": "code", "execution_count": null, "id": "65", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map()\n", "states = ee.FeatureCollection(\"TIGER/2018/States\")\n", "fc = states.filter(ee.Filter.eq(\"NAME\", \"Alaska\"))\n", "m.add_layer(fc, {}, \"Alaska\")\n", "m.center_object(fc, 4)\n", "m" ] }, { "cell_type": "markdown", "id": "66", "metadata": {}, "source": [ "To local drive" ] }, { "cell_type": "code", "execution_count": null, "id": "67", "metadata": {}, "outputs": [], "source": [ "geemap.ee_to_shp(fc, filename=\"Alaska.shp\")" ] }, { "cell_type": "code", "execution_count": null, "id": "68", "metadata": {}, "outputs": [], "source": [ "geemap.ee_export_vector(fc, filename=\"Alaska.shp\")" ] }, { "cell_type": "code", "execution_count": null, "id": "69", "metadata": {}, "outputs": [], "source": [ "geemap.ee_to_geojson(fc, filename=\"Alaska.geojson\")" ] }, { "cell_type": "code", "execution_count": null, "id": "70", "metadata": {}, "outputs": [], "source": [ "geemap.ee_to_csv(fc, filename=\"Alaska.csv\")" ] }, { "cell_type": "code", "execution_count": null, "id": "71", "metadata": {}, "outputs": [], "source": [ "gdf = geemap.ee_to_gdf(fc)\n", "gdf" ] }, { "cell_type": "code", "execution_count": null, "id": "72", "metadata": {}, "outputs": [], "source": [ "df = geemap.ee_to_df(fc)\n", "df" ] }, { "cell_type": "markdown", "id": "73", "metadata": {}, "source": [ "To Google Drive" ] }, { "cell_type": "code", "execution_count": null, "id": "74", "metadata": {}, "outputs": [], "source": [ "geemap.ee_export_vector_to_drive(\n", " fc, description=\"Alaska\", fileFormat=\"SHP\", folder=\"export\"\n", ")" ] }, { "cell_type": "markdown", "id": "75", "metadata": {}, "source": [ "## Creating timelapse animations\n", "\n", "### Landsat timelapse" ] }, { "cell_type": "code", "execution_count": null, "id": "76", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map(center=[64.838721, -147.763366], zoom=11)\n", "m" ] }, { "cell_type": "markdown", "id": "77", "metadata": {}, "source": [ "Pan and zoom the map to an area of interest. Use the drawing tools to draw a rectangle on the map. If no rectangle is drawn, the default rectangle shown below will be used." ] }, { "cell_type": "code", "execution_count": null, "id": "78", "metadata": {}, "outputs": [], "source": [ "roi = m.user_roi\n", "if roi is None:\n", " roi = ee.Geometry.BBox(-147.9701, 64.7733, -147.5849, 64.8717)\n", " m.add_layer(roi)\n", " m.center_object(roi)" ] }, { "cell_type": "code", "execution_count": null, "id": "79", "metadata": {}, "outputs": [], "source": [ "timelapse = geemap.landsat_timelapse(\n", " roi,\n", " out_gif=\"Fairbanks.gif\",\n", " start_year=2000,\n", " end_year=2023,\n", " start_date=\"06-01\",\n", " end_date=\"09-01\",\n", " bands=[\"SWIR1\", \"NIR\", \"Red\"],\n", " frames_per_second=5,\n", " title=\"Landsat Timelapse\",\n", " progress_bar_color=\"blue\",\n", " mp4=True,\n", ")\n", "geemap.show_image(timelapse)" ] }, { "cell_type": "code", "execution_count": null, "id": "80", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map(center=[64.838721, -147.763366], zoom=11)\n", "m.add_gui(\"timelapse\")\n", "m" ] }, { "cell_type": "code", "execution_count": null, "id": "81", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map()\n", "roi = ee.Geometry.BBox(-115.5541, 35.8044, -113.9035, 36.5581)\n", "m.add_layer(roi)\n", "m.center_object(roi)\n", "m" ] }, { "cell_type": "code", "execution_count": null, "id": "82", "metadata": {}, "outputs": [], "source": [ "timelapse = geemap.landsat_timelapse(\n", " roi,\n", " out_gif=\"las_vegas.gif\",\n", " start_year=1984,\n", " end_year=2023,\n", " bands=[\"NIR\", \"Red\", \"Green\"],\n", " frames_per_second=5,\n", " title=\"Las Vegas, NV\",\n", " font_color=\"blue\",\n", ")\n", "geemap.show_image(timelapse)" ] }, { "cell_type": "code", "execution_count": null, "id": "83", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map()\n", "roi = ee.Geometry.BBox(113.8252, 22.1988, 114.0851, 22.3497)\n", "m.add_layer(roi)\n", "m.center_object(roi)\n", "m" ] }, { "cell_type": "code", "execution_count": null, "id": "84", "metadata": {}, "outputs": [], "source": [ "timelapse = geemap.landsat_timelapse(\n", " roi,\n", " out_gif=\"hong_kong.gif\",\n", " start_year=1990,\n", " end_year=2022,\n", " start_date=\"01-01\",\n", " end_date=\"12-31\",\n", " bands=[\"SWIR1\", \"NIR\", \"Red\"],\n", " frames_per_second=3,\n", " title=\"Hong Kong\",\n", ")\n", "geemap.show_image(timelapse)" ] }, { "cell_type": "markdown", "id": "85", "metadata": {}, "source": [ "### Sentinel-2" ] }, { "cell_type": "code", "execution_count": null, "id": "86", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map(center=[64.838721, -147.763366], zoom=11)\n", "m" ] }, { "cell_type": "markdown", "id": "87", "metadata": {}, "source": [ "Pan and zoom the map to an area of interest. Use the drawing tools to draw a rectangle on the map. If no rectangle is drawn, the default rectangle shown below will be used." ] }, { "cell_type": "code", "execution_count": null, "id": "88", "metadata": {}, "outputs": [], "source": [ "roi = m.user_roi\n", "if roi is None:\n", " roi = ee.Geometry.BBox(-147.9701, 64.7733, -147.5849, 64.8717)\n", " m.add_layer(roi)\n", " m.center_object(roi)" ] }, { "cell_type": "code", "execution_count": null, "id": "89", "metadata": {}, "outputs": [], "source": [ "timelapse = geemap.sentinel2_timelapse(\n", " roi,\n", " out_gif=\"sentinel2.gif\",\n", " start_year=2017,\n", " end_year=2023,\n", " start_date=\"06-01\",\n", " end_date=\"09-01\",\n", " frequency=\"year\",\n", " bands=[\"SWIR1\", \"NIR\", \"Red\"],\n", " frames_per_second=3,\n", " title=\"Sentinel-2 Timelapse\",\n", ")\n", "geemap.show_image(timelapse)" ] }, { "cell_type": "markdown", "id": "90", "metadata": {}, "source": [ "### MODIS\n", "\n", "MODIS vegetation indices" ] }, { "cell_type": "code", "execution_count": null, "id": "91", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map()\n", "m" ] }, { "cell_type": "code", "execution_count": null, "id": "92", "metadata": {}, "outputs": [], "source": [ "roi = m.user_roi\n", "if roi is None:\n", " roi = ee.Geometry.BBox(-18.6983, -36.1630, 52.2293, 38.1446)\n", " m.add_layer(roi)\n", " m.center_object(roi)" ] }, { "cell_type": "code", "execution_count": null, "id": "93", "metadata": {}, "outputs": [], "source": [ "timelapse = geemap.modis_ndvi_timelapse(\n", " roi,\n", " out_gif=\"ndvi.gif\",\n", " data=\"Terra\",\n", " band=\"NDVI\",\n", " start_date=\"2000-01-01\",\n", " end_date=\"2022-12-31\",\n", " frames_per_second=3,\n", " title=\"MODIS NDVI Timelapse\",\n", " overlay_data=\"countries\",\n", ")\n", "geemap.show_image(timelapse)" ] }, { "cell_type": "markdown", "id": "94", "metadata": {}, "source": [ "MODIS temperature" ] }, { "cell_type": "code", "execution_count": null, "id": "95", "metadata": {}, "outputs": [], "source": [ "m = geemap.Map()\n", "m" ] }, { "cell_type": "code", "execution_count": null, "id": "96", "metadata": {}, "outputs": [], "source": [ "roi = m.user_roi\n", "if roi is None:\n", " roi = ee.Geometry.BBox(-171.21, -57.13, 177.53, 79.99)\n", " m.add_layer(roi)\n", " m.center_object(roi)" ] }, { "cell_type": "code", "execution_count": null, "id": "97", "metadata": {}, "outputs": [], "source": [ "timelapse = geemap.modis_ocean_color_timelapse(\n", " satellite=\"Aqua\",\n", " start_date=\"2018-01-01\",\n", " end_date=\"2020-12-31\",\n", " roi=roi,\n", " frequency=\"month\",\n", " out_gif=\"temperature.gif\",\n", " overlay_data=\"continents\",\n", " overlay_color=\"yellow\",\n", " overlay_opacity=0.5,\n", ")\n", "geemap.show_image(timelapse)" ] }, { "cell_type": "markdown", "id": "98", "metadata": {}, "source": [ "### GOES" ] }, { "cell_type": "code", "execution_count": null, "id": "99", "metadata": {}, "outputs": [], "source": [ "roi = ee.Geometry.BBox(167.1898, -28.5757, 202.6258, -12.4411)\n", "start_date = \"2022-01-15T03:00:00\"\n", "end_date = \"2022-01-15T07:00:00\"\n", "data = \"GOES-17\"\n", "scan = \"full_disk\"" ] }, { "cell_type": "code", "execution_count": null, "id": "100", "metadata": {}, "outputs": [], "source": [ "timelapse = geemap.goes_timelapse(\n", " roi, \"goes.gif\", start_date, end_date, data, scan, framesPerSecond=5\n", ")\n", "geemap.show_image(timelapse)" ] }, { "cell_type": "code", "execution_count": null, "id": "101", "metadata": {}, "outputs": [], "source": [ "roi = ee.Geometry.BBox(-159.5954, 24.5178, -114.2438, 60.4088)\n", "start_date = \"2021-10-24T14:00:00\"\n", "end_date = \"2021-10-25T01:00:00\"\n", "data = \"GOES-17\"\n", "scan = \"full_disk\"" ] }, { "cell_type": "code", "execution_count": null, "id": "102", "metadata": {}, "outputs": [], "source": [ "timelapse = geemap.goes_timelapse(\n", " roi, \"hurricane.gif\", start_date, end_date, data, scan, framesPerSecond=5\n", ")\n", "geemap.show_image(timelapse)" ] }, { "cell_type": "code", "execution_count": null, "id": "103", "metadata": {}, "outputs": [], "source": [ "roi = ee.Geometry.BBox(-121.0034, 36.8488, -117.9052, 39.0490)\n", "start_date = \"2020-09-05T15:00:00\"\n", "end_date = \"2020-09-06T02:00:00\"\n", "data = \"GOES-17\"\n", "scan = \"full_disk\"" ] }, { "cell_type": "code", "execution_count": null, "id": "104", "metadata": {}, "outputs": [], "source": [ "timelapse = geemap.goes_fire_timelapse(\n", " roi, \"fire.gif\", start_date, end_date, data, scan, framesPerSecond=5\n", ")\n", "geemap.show_image(timelapse)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }