[GIS] How to download monthly values for a time series? NCEP_RE/surface_temp in GEE

google-earth-enginetime series

I want to download values of Air temperature from NCEP/NCAR Reanalysis Data, Surface Temperature in Google Earth Engine. I want the average temperature of every month from 1948 to present, but with my current script I get the monthly average, this is only one value for all the Januaries and so on..

What's wrong in the script?

// Importa una colección de imágenes
var TEMP = ee.ImageCollection('NCEP_RE/surface_temp')
//.select('precipitation')
//.filterDate('2015-01-01','2015-12-31');

print(TEMP)

//Funcion para sumar la PPT mensual (devuelve una lista de imagenes)

var months = ee.List.sequence(1, 12);

var TEMP_mensual = months.map(function(m) {
  // Filter to 1 month.
  return TEMP.filter(ee.Filter.calendarRange(m, m, 'month')).mean();
});


var TEMPmIC = ee.ImageCollection(TEMP_mensual)

print(TEMPmIC)



// Importa puntos para hacer la extracción desde una Fusion Table
var puntos =     ee.FeatureCollection('ft:1_53GKyY5xjt2EJwNLI9hw2LFh5D0sOmCgCdSA-Zj');

// Agrega los puntos al mapa
Map.addLayer(puntos);
Map.setCenter(-105, 19.6, 9);


// Función para extraer los puntos en un bucle 
//Tiene el sacle fijado en 30 por que reduceregions no tabaja con WGS84
// que es la proj nativa de TRMM, pero en este caso el 30 no tiene mas 
// sentido que darle un scale a la función

var datos = TEMPmIC.map(function(i){
  return i.reduceRegions(puntos, 'first', 30)
})

//var dat = collection.reduceRegions(puntos, 'first')

var extract = ee.FeatureCollection(datos.flatten())
print(extract)

//EXPORTAR

Export.table.toDrive({
  collection: extract,
  folder: 'ee_extract',
  description: 'airtemp_pruebamean',
  fileFormat: 'CSV',
});

Best Answer

I had the same issue before, I asked it in SO with a great and simply answer applied to this issue. For monthly means over a period, use this function:

var month_mean = ee.List.sequence(0, 70*12).map(function(n) {
  var start = ee.Date('1948-01-01').advance(n, 'month');
  var end = start.advance(1, 'month');
  return ee.ImageCollection('NCEP_RE/surface_temp').filterDate(start, end).mean();
});

print(month_mean);

Where:
sequence(0, 70*12): number of years from 1948 to present.
ee.Date('1948-01-01'): starting date.
start.advance(1, 'month'): step by each iteration.

I can't complete the answer for your specific purpose because you have denied the access to your fusion tables.