Skip to content

Instantly share code, notes, and snippets.

@jdbcode
Created November 6, 2024 18:46
Show Gist options
  • Save jdbcode/dd0d49d64cf3b1a6defb6c7867b76691 to your computer and use it in GitHub Desktop.
Save jdbcode/dd0d49d64cf3b1a6defb6c7867b76691 to your computer and use it in GitHub Desktop.
ee_annual_landsat_composite_collection.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"provenance": [],
"authorship_tag": "ABX9TyNpme167i1/FPqA9MgjwWxm",
"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/dd0d49d64cf3b1a6defb6c7867b76691/ee_annual_landsat_composite_collection.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"source": [
"This notebook loads and displays an example Landsat cloud-free annual median composite.\n",
"\n",
"**Note that the LANDSAT/COMPOSITES/C02/T1_L2_ANNUAL composites are computed on the fly, so if the Cloud project you're using is registered as commercial, it will incure a compute cost to generate and display the tiles.**\n",
"\n",
"[Learn more about how the data are prepared and composited](https://developers.google.com/earth-engine/landsat_c1_to_c2#temporal_composites)."
],
"metadata": {
"id": "F4F2YnMjwjRD"
}
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"id": "VWqDS32ivgyJ"
},
"outputs": [],
"source": [
"import ee\n",
"import geemap\n",
"\n",
"ee.Authenticate()\n",
"ee.Initialize(project='my-project')"
]
},
{
"cell_type": "code",
"source": [
"annual_composites = ee.ImageCollection('LANDSAT/COMPOSITES/C02/T1_L2_ANNUAL')\n",
"annual_composite_2023 = annual_composites.filterDate('2023-01-01', '2024-01-01').first()\n",
"annual_composite_2023"
],
"metadata": {
"id": "Mf3-oQyTvmJb"
},
"execution_count": null,
"outputs": []
},
{
"cell_type": "code",
"source": [
"m = geemap.Map()\n",
"m.add_layer(annual_composite_2023, {'bands': ['swir1', 'nir', 'green'], 'min': 0, 'max': 0.4})\n",
"m"
],
"metadata": {
"id": "PeJdcQccwDvr"
},
"execution_count": null,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment