Below is an example of a larger process (downloading MODIS data-- multiple products for 23 cities between 2004-2016) that is giving me a bit of a hassle:
#load libraries import ee import datetime #Init earth engine and load a collection ee.Initialize() imgs = ee.ImageCollection('MODIS/006/MOD11A2') #filer by some dates and extract a single "band" and extract one image. I'm sure there is a cleaner way to do this dat = imgs.filterDate('2004-01-01','2004-01-02').select('QC_Day').toList(1).get(0) #print some info print dat.getInfo() #define a bounding box bbox = (38.94993166800003, -7.127943276999929, 39.44200277300007, -6.552704129999938) #Create the bounding box as an earth engine object thing target_projection = ee.Image(imgs.select('QC_Day').first()).projection() thecity = ee.Geometry.Rectangle(bbox).transform(target_projection,250) #hoping the 250 is in meters #For some reason ee sees dat as a computed object and so clip won't work #trick it dat = ee.Image.cat([dat]) #print the info again print dat.getInfo() #clip the image to the city dat = dat.clip(thecity) #make the ask to EE ask = ee.batch.Export.image.toDrive(image = dat, description = 'hello') #start the ask ask.start()
When the download completes and I move to R (my preference) to visualize the image:
#Import the raster package, analgous to import raster library('raster') #load the raster ras = ras("C:/Users/Me/Downloads/hello.tif") #Set all values that equal 0 to 1 and everything else to 0 zeros = ras == 0 #make a crappy map plot(zeros)
I get the following map. My problem is the green area on the sides that looks like some combination of a projection + no data issue. The raw MODIS data (downloaded from LPDAAC) does not have this pattern. Thoughts on how to make the green go away?