Skip to content

Instantly share code, notes, and snippets.

@giswqs
Created December 27, 2020 16:51
Show Gist options
  • Save giswqs/161d3cb7962286fa94fbd86f02eb38e3 to your computer and use it in GitHub Desktop.
Save giswqs/161d3cb7962286fa94fbd86f02eb38e3 to your computer and use it in GitHub Desktop.
MODIS NDVI time series
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "import ee\nimport geemap",
"execution_count": 1,
"outputs": []
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "Map = geemap.Map()\n\ndataset = ee.ImageCollection('MODIS/MCD43A4_006_NDVI') \\\n .filter(ee.Filter.date('2018-04-01', '2018-06-01'))\ncolorized = dataset.select('NDVI')\n\ntime_series = colorized.toBands() #convert collection to image\n\ncolorizedVis = {\n 'min': 0.0,\n 'max': 1.0,\n 'palette': [\n 'FFFFFF', 'CE7E45', 'DF923D', 'F1B555', 'FCD163', '99B718', '74A901',\n '66A000', '529400', '3E8601', '207401', '056201', '004C00', '023B01',\n '012E01', '011D01', '011301'\n ],\n}\nMap.setCenter(-7.03125, 31.0529339857, 2)\nMap.addLayer(time_series, {}, \"Time series\", False)\nMap.addLayer(colorized, colorizedVis, 'Colorized')\nMap\n",
"execution_count": 5,
"outputs": [
{
"output_type": "display_data",
"data": {
"text/plain": "Map(center=[31.0529339857, -7.03125], controls=(WidgetControl(options=['position'], widget=HBox(children=(Togg…",
"application/vnd.jupyter.widget-view+json": {
"version_major": 2,
"version_minor": 0,
"model_id": "42b3fa5402f84211961c6dde0ecd7a5f"
}
},
"metadata": {}
}
]
},
{
"metadata": {
"trusted": true
},
"cell_type": "code",
"source": "",
"execution_count": null,
"outputs": []
}
],
"metadata": {
"kernelspec": {
"name": "python3",
"display_name": "Python 3",
"language": "python"
},
"hide_input": false,
"toc": {
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"base_numbering": 1,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"language_info": {
"name": "python",
"version": "3.8.5",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"gist": {
"id": "",
"data": {
"description": "MODIS NDVI time series",
"public": true
}
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment