{ "cells": [ { "cell_type": "code", "execution_count": null, "id": "0", "metadata": {}, "outputs": [], "source": [ "import ee\n", "import geemap" ] }, { "cell_type": "code", "execution_count": null, "id": "1", "metadata": {}, "outputs": [], "source": [ "# geemap.update_package()" ] }, { "cell_type": "markdown", "id": "2", "metadata": {}, "source": [ "## Visualizing weather data" ] }, { "cell_type": "code", "execution_count": null, "id": "3", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "\n", "collection = (\n", " ee.ImageCollection(\"NOAA/GFS0P25\")\n", " .filterDate(\"2018-12-22\", \"2018-12-23\")\n", " .limit(24)\n", " .select(\"temperature_2m_above_ground\")\n", ")\n", "\n", "vis_params = {\n", " \"min\": -40.0,\n", " \"max\": 35.0,\n", " \"palette\": [\"blue\", \"purple\", \"cyan\", \"green\", \"yellow\", \"red\"],\n", "}\n", "\n", "first_image = collection.first()\n", "\n", "Map.addLayer(first_image, vis_params, \"First image\", False)\n", "Map.setCenter(-0.3490, 25.7900, 2)\n", "Map" ] }, { "cell_type": "code", "execution_count": null, "id": "4", "metadata": {}, "outputs": [], "source": [ "labels = [str(n).zfill(2) + \":00\" for n in range(0, 24)]\n", "print(labels)" ] }, { "cell_type": "code", "execution_count": null, "id": "5", "metadata": {}, "outputs": [], "source": [ "Map.add_time_slider(collection, vis_params, labels=labels, time_interval=1, opacity=0.8)" ] }, { "cell_type": "markdown", "id": "6", "metadata": {}, "source": [ "## Visualizing vegetation data" ] }, { "cell_type": "code", "execution_count": null, "id": "7", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "\n", "collection = (\n", " ee.ImageCollection(\"MODIS/MCD43A4_006_NDVI\")\n", " .filter(ee.Filter.date(\"2018-04-01\", \"2018-05-01\"))\n", " .select(\"NDVI\")\n", ")\n", "vis_params = {\n", " \"min\": 0.0,\n", " \"max\": 1.0,\n", " \"palette\": [\n", " \"FFFFFF\",\n", " \"CE7E45\",\n", " \"DF923D\",\n", " \"F1B555\",\n", " \"FCD163\",\n", " \"99B718\",\n", " \"74A901\",\n", " \"66A000\",\n", " \"529400\",\n", " \"3E8601\",\n", " \"207401\",\n", " \"056201\",\n", " \"004C00\",\n", " \"023B01\",\n", " \"012E01\",\n", " \"011D01\",\n", " \"011301\",\n", " ],\n", "}\n", "\n", "first_image = collection.first()\n", "\n", "Map.addLayer(first_image, vis_params, \"First image\", False)\n", "Map.setCenter(-7.03125, 31.0529339857, 2)\n", "Map" ] }, { "cell_type": "code", "execution_count": null, "id": "8", "metadata": {}, "outputs": [], "source": [ "Map.add_time_slider(collection, vis_params, time_interval=1)" ] }, { "cell_type": "markdown", "id": "9", "metadata": {}, "source": [ "## Visualizing Landsat imagery" ] }, { "cell_type": "code", "execution_count": null, "id": "10", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map()\n", "\n", "bands = [\"B1\", \"B2\", \"B3\", \"B4\", \"B5\", \"B7\"]\n", "image = ee.Image(\"LANDSAT/LE7_TOA_5YEAR/1999_2003\").select(bands)\n", "vis_params = {\"min\": 20, \"max\": 200, \"gamma\": 2.0}\n", "\n", "Map.add_time_slider(image, vis_params, time_interval=1)\n", "Map" ] }, { "cell_type": "markdown", "id": "11", "metadata": {}, "source": [ "## Visualizing Sentinel-2 imagery" ] }, { "cell_type": "code", "execution_count": null, "id": "12", "metadata": {}, "outputs": [], "source": [ "Map = geemap.Map(center=[37.75, -122.45], zoom=12)\n", "\n", "S2 = (\n", " ee.ImageCollection(\"COPERNICUS/S2_SR\")\n", " .filterBounds(ee.Geometry.Point([-122.45, 37.75]))\n", " .filterMetadata(\"CLOUDY_PIXEL_PERCENTAGE\", \"less_than\", 10)\n", ")\n", "\n", "vis_params = {\"min\": 0, \"max\": 4000, \"bands\": [\"B8\", \"B4\", \"B3\"]}\n", "\n", "Map.addLayer(S2, {}, \"Sentinel-2\", False)\n", "Map.add_time_slider(S2, vis_params)\n", "Map" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" } }, "nbformat": 4, "nbformat_minor": 5 }