I am very new to ee and am trying to export a collection to my drive, after masking for clouds and clipping to myregion... tried to follow the advice in this answer https://stackoverflow.com/questions/35991403/pip-install-unroll-python-setup-py-egg-info-failed-with-error-code-1 where the col2drive function is imported from geetools. But I seem not to have access to the repo, it doesn't show under my read module. Took me a while to find out because the error said is not a function, and thought I was not creating the object correctly.
So I copied the hardcoded version posted here Export each image from a collection in Google Earth Engine to my own repo and tried to load it from there, did not work. I get again and error saying col2drive is not a function... when I do var exportfunction = tools.col2drive;
and print(exportfuncion)
... it prints "undefined". So is not loading it, I think.
Then I found this other option Google Earth Engine: Export an entire collection, running it directly from python API. Installed python in my computer (Windows10, 64 bits), and when trying to install geetools
it needs a module 'fcntl'
, which apparently does not exist for Windows... there is a suggestion of using win32api
, but then again is for windows32 and the advice says that it is important to understand what fcntl
is doing in each case before substituing... In any case I have no idea where can I substitue it. Could someone help, I did try.
Here is my (stitched) code in case is useful
var geometry = /* color: #98ff00 */geometry;
//Add tools to export collection
// load tools from Fito Principe
//var tools = require('users/fitoprincipe/geetools:tools');
var tools = require('users/sulazul/Rep:col2Drive')
// add col2drive function
var exportfunction = tools.col2Drive;
print(exportfunction)
// Load Landsat 8 imagery and filter it
var collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filter(ee.Filter.eq('WRS_PATH', 33))
.filter(ee.Filter.eq('WRS_ROW', 41))
.set('SENSOR_ID', 'OLI_TIRS')
.sort("CLOUD_COVER", false);
var count = collection.size()
print("Coleccion", count)
//some more code here to maskclouds and clip to myregion
// Map the function .
var filtered_1 = filtered.map(maskL8sr);
// export collection to google drive
exportfunction(filtered_1,"Landsat8", {
scale: 30,
region: geometry.getInfo()["coordinates"],
type: 'float'
});
Answer
I am the author of both geetools
(Python and JavaScript)
The JavaScript repo is share with anyone can read
so it should work, but anyhow you can click here to accept the repo, and then do:
var batch = require('users/fitoprincipe/geetools:batch')
// Load Landsat 8 imagery and filter it
var collection = ee.ImageCollection('LANDSAT/LC08/C01/T1_SR')
.filter(ee.Filter.eq('WRS_PATH', 33))
.filter(ee.Filter.eq('WRS_ROW', 41))
.set('SENSOR_ID', 'OLI_TIRS')
.sort("CLOUD_COVER", false);
var count = collection.size()
print("Coleccion", count)
//some more code here to maskclouds and clip to myregion
// Map the function .
var filtered_1 = filtered.map(maskL8sr);
// export collection to google drive
batch.Download.ImageCollection.toDrive(filtered_1, 'Landsat8', {
scale: 30,
region: geometry.getInfo()["coordinates"] // or geometry.getInfo()
})
Documentation here: https://github.com/fitoprincipe/geetools-code-editor/wiki
No comments:
Post a Comment