0

Does anybody know how to select 3-hourly time steps in a dataset on Google Earth Engine?

Here is what I have tried

    // A function to compute CF_solar for every time step at which irradiation and temperature are available (3-hourly)
var CF_solar2 = function(image) {
  return image.expression(
    '(1-beta*(c1 + c2*T + c3*G - T_ref) + gamma*log10(G+1))*G/G_ref',
    {
      'beta': 0.0045,
      'c1': -3.75,
      'c2': 1.14,
      'c3': 0.0175,
      'T_ref': 25,
      'gamma': 0.1,
      'G_ref': 1000,
      'T': image.select('Tair_f_inst').subtract(273.15),
      'G': image.select('SWdown_f_tavg'),
    }).rename("CF2").set('system:time_start', image.get('system:time_start'));
}
0

I am not sure if this answers you question, as it is not perfectly clear to me.

I see from your other question that you're dataset is imported as follows:

// import geometry (point to zoom in to)
var home_coords = ee.Geometry.Point([-7.6, 54.4])
var region = home_coords.buffer(20000);

// load image stack for one year
var dataset = ee.ImageCollection("NASA/GLDAS/V20/NOAH/G025/T3H")
   .filterDate('2010-12-01', '2010-12-31')
   .filterBounds(home_coords);

print(dataset);

Each image consists then of an start hour (0-21) and an end hour three hours later. If your question is that you only want, for example, the images starting at start_hour == 0, then you should at this line in your code. Edit the zero to another hour (e.g. 3) if you want a colleciton of images with start hour 3.

 var filteredDataset = dataset.filter(ee.Filter.eq('start_hour', 0));
 print(filteredDataset);

If this does not perfectly solve your problem, please specify your question by editing your first post and I guess it will be solved easily.

  • Hi thanks so much, that explains things. I wanted my code to represent every 3 hours across the month (so the timeseries would have data at every 3 hours). But now I see that this is what it was doing anyway - with 240 points over dates 1-31 in december. – gall Dec 3 '18 at 11:29

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.