0

Here is my code How do I add the soil moisture data I am trying to get onto my Google drive?

var dataset = ee.ImageCollection('NASA_USDA/HSL/SMAP_soil_moisture')
                  .filter(ee.Filter.date('2017-04-01', '2017-04-30'));
var soilMoisture = dataset.select('ssm');
var soilMoistureVis = {
  min: 0.0,
  max: 28.0,
  palette: ['0300ff', '418504', 'efff07', 'efff07', 'ff0303'],
};
Map.setCenter(-6.746, 46.529, 2);
Map.addLayer(soilMoisture, soilMoistureVis, 'Soil Moisture');

1 Answer 1

2

soilMoisture is an image collection. You will have to export each image in the the collection separately. Here's how you could do it:

soilMoisture
  .aggregate_array('system:index') // Get a list of unique ids
  .evaluate(function (indexes) { // Turn this into a client-side list
    indexes.map(exportImage) // Export all images
  })

function exportImage(index) {
  var image = soilMoisture // Find the image with this unique id
    .filterMetadata('system:index', 'equals', index)
    .first()
  Export.image.toDrive({ // Export it
    image: image,
    description: index,
    scale: 27829
  })
}

https://code.earthengine.google.com/2e9adee99d5683f5551741a907bf2e16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.