I am trying to find the mean precipitation of a watershed. When I print the feature collection BasinMean, I can see the mean precipitation in the console. A lot of them are zeros but the first two rows have non-zero precipitation.

When I export the table in to a drive, I expect a CSV file which is a timeseries with 3 columns - Station, date(timestamp) and mean precipitation. However, with the below code, the generated CSV has empty cells for mean precipitation. Any idea why the export function does not work?

Link to the workspace : https://code.earthengine.google.co.in/7f21f81224e88bed21e2db64fb7fda30

// Filter the image colelction for a certain timeframe
var filtered = Chirps_daily.filterDate('1981-01-01', '2016-12-31');

// Display the basin

// Load the first image of the collection
var Chirps_first = ee.Image(filtered.first());

// Load the scale of the chirps image
var Chirp_scale = Chirps_first.projection().nominalScale();

var BasinMean = Basin.map(function(f) {
    return filtered.map(function(i) {
       var mean = i.reduceRegion({
       geometry: f.geometry(),
       reducer: ee.Reducer.mean(),
    return f.setMulti(mean).set({date: i.date()})

// flatten
BasinMean = BasinMean.flatten()

  folder: "Google EE results",

I was suggested a work around for this issue by Jillian Deines in Google Engine developers forum. https://groups.google.com/forum/#!forum/google-earth-engine-developers

Quoting Jillian Deines: "I'm not entirely sure why your method doesn't export correctly, since as you note the precip values are there when you print, but my guess has something to do with the way the 'precipitation' value is stored, since that column doesn't export at all if you omit the "selectors" specification in your Export.table.toDrive()

I switched up the code a bit to an approach I often use (using the plural reduceRegions() regardless of the number of features in your collection), and it exports correctly here: https://code.earthengine.google.co.in/1e2fd2a8dff34099f4bffb25906c0d94

The outer map here is over the collection, vs over the FeatureCollection in your example. Perhaps not a satisfying answer, but it works!"

Code here https://code.earthengine.google.co.in/1e2fd2a8dff34099f4bffb25906c0d94

var BasinMean = filtered.map(function(img) {
  return img.reduceRegions({
      collection: Basin,
      reducer: ee.Reducer.mean(),
      scale: Chirp_scale
        return f.set('date', img.date());
  • 1
    If this solved your problem please accept this as the correct answer by using the grey/green tick mark to the left. – Kersten Mar 14 '18 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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