Getting data to Drive or Cloud from GEE?

65 views Asked by At

//EDIT: I am so new to GEE that I even did not know I should click on Tasks bar after running the script, to complete the export process ! Also there was a problem with the code (csv file included dates, not mean values at first when I managed to export). Here is the updated code as a result of the assistance I received, which seems like working, in case somebody needs:

var FeatureF = ee.Feature(ee.Geometry.Rectangle([27.823137, 36.56604, 29.194001, 37.214688]), {name: 'selectedareaMugla'});

var clipToCol = function(image) {


    return image.clip(FeatureF);


};

var AOD = ee.ImageCollection('MODIS/061/MCD19A2_GRANULES')


            .select('Optical_Depth_055')


            .filterDate('2014-03-30', '2014-04-05')


            .map(clipToCol);



var band_viz = {


    min: 0,


    max: 350,


    palette: ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red']


};



Map.addLayer(AOD.mean(), band_viz, 'Optical Depth 055');



var outline = ee.Image().byte().paint({


    featureCollection: FeatureF,


    color: 1,


    width: 1


});



Map.addLayer(outline, {palette: ['black']}, 'FeatureF');



var AODmeanF = AOD.map(function(img) {


    var mean = img.reduceRegion({


        reducer: ee.Reducer.mean(),


        geometry: FeatureF.geometry(),


        scale: 1000


    });
   

return ee.Feature(null, {

'date': img.date(),


'meanAOD': mean.get('Optical_Depth_055')

});

}).filter(ee.Filter.notNull(['meanAOD']));

Export.table.toDrive({


    collection: AODmeanF,


    description: 'dailyresult1',


    folder: 'GEE_results',


    fileFormat: 'CSV',


    selectors: ['date', 'meanAOD'] 


});

My initial question:

I am quite new to Google Earth Engine. In GEE, I am trying to download the list of MODIS AOD daily mean results based on the code that I thankfully found on the page Download daily mean AOD data GEE (By the way, I could not find a way to contact the owner and I am not entitled to comment on that page, plus maybe I am encountering a problem that the owner did not), by adjusting it to my circumstances. However in both of the cases of my trials to get the data to the Cloud or the Drive, nothing happened in terms of data export but the GEE displays an image on the map as a result of the code. Please find below, firstly, the code I lastly tried for retrieval to Cloud. It is followed by the code I previously tried using to retrieve data to my Drive. I would appreciate any help with data export. Or is it because there is an error with the code, like I actually need to define AOD.map first?

var FeatureF = ee.Feature(ee.Geometry.Rectangle([27.823137, 36.56604, 29.194001, 37.214688]), {name: 'selectedareaMugla'});
var clipToCol = function(image){return image.clip(FeatureF)};

var AOD = ee.ImageCollection('MODIS/061/MCD19A2_GRANULES') .select('Optical_Depth_055') .filterDate('2015-01-01', '2015-01-31').map(clipToCol); //.filterBounds(RMSP);

var band_viz = { min: 0, max: 350, palette: ['black', 'blue', 'purple', 'cyan', 'green', 'yellow', 'red'] }; Map.addLayer(AOD.mean(), band_viz, 'Optical Depth 055');

var outline = ee.Image().byte().paint({ featureCollection: FeatureF, color: 1, width: 1 }); Map.addLayer(outline, {palette: ['black']}, 'FeatureF');

var AODmean_2 = AOD.map(function(img) { return img.reduceRegions({ collection: FeatureF, reducer: ee.Reducer.mean(), scale: 1000, }).map(function(f){ return f.set('date', img.date()); }); }).flatten();

Export.table.toCloudStorage({ collection:AODmean_2, description: 'dailyavgAOD_MCD19A2_GRANULES', bucket: 'avg_aod', fileFormat: 'CSV', selectors:(['date','mean']) }); 

Export.table.toDrive({ collection:AODmean_2, description: 'dailyavgAODfromMCD19A2_GRANULES', folder: 'GEE results', fileFormat: 'CSV', selectors:(['date','mean']) }); 
0

There are 0 answers