1

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',
});
3
  • Could you please change the comments in your script to English.
    – Kersten
    Feb 21, 2018 at 17:39
  • sequence(0, 70*12): number of years from 1948 to present. start.advance(1, 'month'): step by each iteration. Question: what is the purpose of the 0 and 1? I am trying to get the monthly average value for a range of years. I have tried changing the months from months to January...ect as well as the number 1 to other numbers (i.e. 2=February), but I keep getting the same output raster. Please any help. Jul 19, 2018 at 15:04
  • Welcome to GIS StackExchange! As a new user please take the tour. This appears to be a new question, rather than an answer to @pgalansino's question. Please post as a new question, and elaborate on what system you are using and what you've tried so far.
    – SMiller
    Jul 19, 2018 at 15:40

1 Answer 1

3

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.

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.