Last active
January 15, 2020 00:07
-
-
Save jdbcode/51ae9029b56eaeb2b3fe364e7f9a4f61 to your computer and use it in GitHub Desktop.
Untitled12.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": "Untitled12.ipynb", | |
"provenance": [], | |
"authorship_tag": "ABX9TyMNxBoXuZCr4v2eTy3giHa/", | |
"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/51ae9029b56eaeb2b3fe364e7f9a4f61/untitled12.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)" | |
], | |
"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, \n", | |
" region = okla.geometry().bounds().getInfo()['coordinates'],\n", | |
" description = 'col_mean_okla',\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", | |
"colab": { | |
"base_uri": "https://localhost:8080/", | |
"height": 181 | |
}, | |
"outputId": "ca5d1f37-aee8-47f7-dc03-19183d001f32" | |
}, | |
"source": [ | |
"export_task.status()" | |
], | |
"execution_count": 21, | |
"outputs": [ | |
{ | |
"output_type": "execute_result", | |
"data": { | |
"text/plain": [ | |
"{'creation_timestamp_ms': 1579045614964,\n", | |
" 'description': 'col_mean_okla',\n", | |
" 'destination_uris': ['https://drive.google.com/'],\n", | |
" 'id': 'KGQRPSY3KMV7FHA64TD3ZQCA',\n", | |
" 'name': 'projects/earthengine-legacy/operations/KGQRPSY3KMV7FHA64TD3ZQCA',\n", | |
" 'start_timestamp_ms': 1579045629822,\n", | |
" 'state': 'COMPLETED',\n", | |
" 'task_type': 'EXPORT_IMAGE',\n", | |
" 'update_timestamp_ms': 1579045874865}" | |
] | |
}, | |
"metadata": { | |
"tags": [] | |
}, | |
"execution_count": 21 | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment