ee-jupyter-contrib icon indicating copy to clipboard operation
ee-jupyter-contrib copied to clipboard

Failed export of images without specified region

Open Zaubatrix opened this issue 5 years ago • 0 comments

Hello everybody,

my export task fail when I do not specify a region in the export statement. If I do everything runs fine. As help tells me region default is set to the image's region. For a global dataset. I would assume I do would get a global image as an output (which is what I want). I tested this with quite a variety of Image Collections by now, with the same result.

Best Regards Hannes

import ee

#ee.Initialize() # Initialize ee with access token

startdate = '2005-01-01'
enddate   = '2015-01-01'
TCL = ee.ImageCollection("IDAHO_EPSCOR/TERRACLIMATE").filterDate(startdate,enddate)
scaling_factors={"aet":0.1, "def":0.1,"pdsi":0.01,"pet":0.1,"pr":1,"ro":1,"soil":0.1,
                "srad":0.1,"swe":1,"tmmn":0.1,"tmmx":0.1,"vap":0.001,"vpd":0.01,"vs":0.01}

# I set the bands to only 1 band, for the sake of simplicity
bands_of_interest = ["aet"]#["aet","def","pet","pr","ro","soil","srad","vs"]  


scaling_factors[bands_of_interest[0]]

# define function to reduce image collections to single images
def get_mean(ICL,scaling_factor):
    IC = ICL.mean()
    #im transfering to celcius here so I don't have to worry about different band names
    IC = IC.multiply(ee.Image.constant(scaling_factor))
    return IC

# this is the region dummy the code is working with
llx, lly, urx, ury = -18, 33, 48, 74 # more or less Europe
clippi = [[llx,lly], [llx,ury], [urx,ury], [urx,lly]]

for band in bands_of_interest:
    ICL = TCL.select(band) 
    IC = get_mean(ICL,scaling_factors[band])
    export_string = "terraclimate_"+band+"_2005-14"
    
    task = ee.batch.Export.image.toDrive(image = IC,
                                         description = export_string,
                                         folder = "terraclimate",
                                         scale = 1000,
                                         #region = clippi, #commented out 
                                         fileFormat = 'GeoTIFF')
    task.start()


print(ee.batch.Task.list())# Print all tasks.
# Poll the task
import time 
while task.active():
    print('Polling for task (id: {}).'.format(task.id))
    time.sleep(10) # poll every x secs
print('Done with export.')
print(ee.batch.Task.list())

Zaubatrix avatar Jun 05 '19 09:06 Zaubatrix