Last active
January 15, 2020 23:27
-
-
Save jdbcode/ed65cdf096f648f1c3d90922d9cc3e4c to your computer and use it in GitHub Desktop.
q_347340_68792_alt01.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"name": "q_347340_68792_alt01.ipynb", | |
"provenance": [], | |
"authorship_tag": "ABX9TyNv00XZttiqmkQDWoV4NJwK", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/jdbcode/ed65cdf096f648f1c3d90922d9cc3e4c/q_347340_68792_alt01.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "IhAYa5IFdJJO", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"Regarding GIS Stack Exchange question: https://gis.stackexchange.com/q/347340/68792" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "RrdWjinw5RKk", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"import ee\n", | |
"ee.Authenticate()\n", | |
"ee.Initialize()" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "9gcsgdSs5dT4", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"okla = ee.FeatureCollection('TIGER/2018/States') \\\n", | |
" .filter(ee.Filter().eq('NAME', 'Oklahoma'))" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "Kn16aGMe5nHx", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"collection = ee.ImageCollection('LANDSAT/LE07/C01/T1_SR') \\\n", | |
" .filterDate(ee.Date.fromYMD(2012, 1, 1), ee.Date.fromYMD(2012, 1, 30)) \\\n", | |
" .filterBounds(okla)" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "Bopvdd93561B", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"col_mean = collection.mean()\n", | |
"col_mean_okla = col_mean.clipToCollection(okla)\n", | |
"col_mean_okla_rgb = col_mean_okla.visualize(\n", | |
" bands=['B5', 'B4', 'B3'], min=100, max=3500)" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "K60lgirj6E0s", | |
"colab_type": "code", | |
"colab": {} | |
}, | |
"source": [ | |
"export_task = ee.batch.Export.image.toDrive(\n", | |
" image = col_mean_okla_rgb, \n", | |
" region = okla.geometry().bounds().getInfo()['coordinates'],\n", | |
" description = 'col_mean_okla_rgb',\n", | |
" scale = 300,\n", | |
" crs = 'EPSG:5070'\n", | |
")\n", | |
"\n", | |
"export_task.start()" | |
], | |
"execution_count": 0, | |
"outputs": [] | |
}, | |
{ | |
"cell_type": "code", | |
"metadata": { | |
"id": "LvUFHzYSVDro", | |
"colab_type": "code", | |
"outputId": "675498fc-1d00-4877-e57b-4d8b1077b899", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 181 | |
} | |
}, | |
"source": [ | |
"export_task.status()" | |
], | |
"execution_count": 7, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"{'creation_timestamp_ms': 1579130411102,\n", | |
" 'description': 'col_mean_okla_rgb',\n", | |
" 'destination_uris': ['https://drive.google.com/'],\n", | |
" 'id': 'JOZ2L4S7GTRWE6CWY75M5WJP',\n", | |
" 'name': 'projects/earthengine-legacy/operations/JOZ2L4S7GTRWE6CWY75M5WJP',\n", | |
" 'start_timestamp_ms': 1579130427153,\n", | |
" 'state': 'COMPLETED',\n", | |
" 'task_type': 'EXPORT_IMAGE',\n", | |
" 'update_timestamp_ms': 1579130513540}" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
}, | |
"execution_count": 7 | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment