Skip to content

Instantly share code, notes, and snippets.

@jdbcode
Created October 3, 2022 15:35
Show Gist options
  • Save jdbcode/af0c78875e7337ac95821edd93516d26 to your computer and use it in GitHub Desktop.
Save jdbcode/af0c78875e7337ac95821edd93516d26 to your computer and use it in GitHub Desktop.
g4g22_ndvi_animation.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
},
"language_info": {
"name": "python"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/jdbcode/af0c78875e7337ac95821edd93516d26/g4g22_ndvi_animation.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "fmzT0LcaCZOv"
},
"outputs": [],
"source": [
"import ee\n",
"ee.Authenticate()\n",
"ee.Initialize()"
]
},
{
"cell_type": "code",
"source": [
"from IPython.display import Image"
],
"metadata": {
"id": "zKJlTEvGdYrx"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"# Fetch a MODIS NDVI collection.\n",
"col = (ee.ImageCollection('MODIS/006/MOD13A2')\n",
" .filterDate('2018-01-01', '2019-01-01'))\n",
"\n",
"# Define visualization parameters.\n",
"params = {\n",
" 'bands': ['NDVI'],\n",
" 'min': 0,\n",
" 'max': 9000,\n",
" 'palette': ['white', 'green'],\n",
" 'region': ee.Geometry.BBox(-180, -58, 180, 63),\n",
" 'dimensions': 700,\n",
" 'crs': 'EPSG:32662',\n",
" 'framesPerSecond': 10\n",
"}\n",
"\n",
"# Get a URL that will generate a GIF.\n",
"url = col.getVideoThumbURL(params)\n",
"\n",
"# Display the NDVI animation.\n",
"Image(url=url)"
],
"metadata": {
"id": "9yBHahoeCdlT"
},
"execution_count": null,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment