I am trying to understand and use the "GFS: Global Forecast System 384-Hour Predicted Atmosphere Data". As I got it, the dataset consist of forest for coming 384 hours (16 day) in hourly and 3 hourly scale. So first 120 hours in hourly scale then 3 hourly scale. Please, correct me if I am right and help me to figure out. Using this dataset I would like to make a code which will make a chart with forested daily rainfall, max temperature and min temperature. And I have tried to develop a code for daily precipitation, but does not work. Please, help me to improve it.

var now = ee.Date(new Date().getTime());

var dataset = ee.ImageCollection('NOAA/GFS0P25')

var day1_pcp = dataset.filterDate(now,now.advance(23,'hour')).sum();
var day2_pcp = dataset.filterDate(now.advance(24,'hour'),now.advance(47,'hour')).sum();
var day3_pcp = dataset.filterDate(now.advance(48,'hour'),now.advance(71,'hour')).sum();
var day4_pcp = dataset.filterDate(now.advance(72,'hour'),now.advance(95,'hour')).sum();
var day5_pcp = dataset.filterDate(now.advance(96,'hour'),now.advance(120,'hour')).sum();

var days = dau1_pcp.merge(day2_pcp).merge(day3_pcp).merge(day4_pcp).merge(day5_pcp)

var chart = ui.Chart.image.series(summedCollection, wua_filtered, ee.Reducer.mean())


enter image description here https://code.earthengine.google.com/f9da9c8ba26777c3cb9334188f9e9b4f

  • 1
    Please include a link to a working code editor script, and make sure all your used assets are shared. That makes it easier to help you. Apr 21, 2020 at 6:54

1 Answer 1


I never used this data, but something like this might work for you:

var region = ee.Geometry(Map.getBounds(true))
// Strip time off current date/time
var today = ee.Date(new Date().toISOString().split('T')[0])

var collection = ee.ImageCollection('NOAA/GFS0P25')
  // Might not have any data for today, so include yesterday too
  .filterDate(today.advance(-1, 'day'), today.advance(1, 'day'))
  // Sort so latest can be picked by taking first
  .sort('system:time_start', false)

var forecasts = ee.ImageCollection(
  [23, 24, 48, 72, 96].map(forecast) // Pick forecasts for these hours

Map.addLayer(forecasts, {min: 0, max: 0.001}, 'forecasts', false)

var chart = ui.Chart.image.series({
  imageCollection: forecasts, 
  region: region,
  reducer: ee.Reducer.mean(), 
  scale: forecasts.first().projection().nominalScale(),
  xProperty: 'date'


function forecast(hours) {
  var image = collection
    .filterMetadata('forecast_hours', 'equals', hours)
    // Since colleciton is sorted descending, if there are more than 
    // one forecast, first() will give the latest.
  var date = image.date().advance(hours, 'hours')
  return image
    .set('date', date.format())


  • Dear Daniel, thanks for suggestion. I have slightly updates the code that you made. I made it for temperature and edited the hours. And I am still not sure about is it mean temp or max temp or min temp or first image temp visualized in the chart. Can you please help me to clarify it? code.earthengine.google.com/707afba4aee47e1bb5a39600b6accdaf Apr 22, 2020 at 15:48
  • The chart uses ee.Reducer.mean(), so you will get the mean over your region. Apr 22, 2020 at 15:58
  • I mean, average or max temp per day, not for region Apr 22, 2020 at 19:08

Your Answer

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

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