Calculating Degree Days using iterate() and accumulate() functions

I am trying to calculate degree days using landsat's thermal band for a very specific geographic area and temporal range. I am having trouble coming up with a method that would allow me to get the result that I am looking for.

The degree day equation is quite simple: temp-base = degree units for that day. During a season (may-sep), farmers sum each day's total for a season total of degree days.

I want to be able to sum these degree days on a per-pixel basis, so what I imagine that would look like would be: pixel value - 285 = that pixel's DD. For every image that is in that range (every year has a different number of images), I want to sum up those values to give a total number of degree days for that pixel and then overlay that value onto the map.

This is the code that I have right now that finds the mean temp for a given range:

``````// Create a geometry representing an export region.
var features = ee.Geometry.Polygon(
[[[-85.1269269325727, 44.839449231220215],
[-85.2642560341352, 45.366750684688796],
[-86.1926007606977, 44.92507820254033],
[-86.4233136513227, 44.197108291897024]]]);
print("features",features);

// This function clips images to the ROI feature collection
var clipToCol = function(image){
return image.clip(features);
};

var dataset = ee.ImageCollection('LANDSAT/LC08/C01/T1_8DAY_TOA')
.map(clipToCol);

var st = dataset.select('B10');

var imageVisParam = {"opacity":1,"bands":["B10"],"min":271.4,"max":284.6,"palette":["0f00ff","14b5ff","d3ff86","2aff5e","20c749","ffbd1e","ff931c","ff5018","ff0000"]};

st.filterDate("2014-04-01", "2014-06-01"), imageVisParam,
'2014');
Map.setCenter(-85.75976, 44.85257, 11);

var imageRGB = st.mean().visualize(imageVisParam);

print(imageRGB);
imageRGB)
// Export the image, specifying scale and region.

Export.image.toDrive({
image: imageRGB,
description: 'LST_415_515',
scale: 5,
region: features,
maxPixels: 76000000000,
});
``````

I'm looking at this resource to try to better understand the iterate() and accumulate() function, but am having trouble fitting it into the context of this specific deployment.

• The dataset you are using ("LANDSAT/LC08/C01/T1_8DAY_TOA") consists of images representing 8 day periods (i.e. not daily data), which is inconsistent with your description of "sum each day's total for a season total". Could you clarify? – Tyler Erickson Jan 24 at 20:12
• Tyler is correct. The dataset for daily temperature is the following. ("MODIS/006/MOD11A1"). The problem you will have with the daily thermal band is that there are a lot of missing pixels due to clouds. Also, the daily passes over at a specific time, and this does not reflect the mean temperature in the day for calculating the degree days correctly. – Sean Roulet Jan 25 at 0:07
• I appreciate the feedback. I have used modis data before, however the resolution is 1km and not great for the research I am trying to achieve. Are there any higher-resolution products that would provide daily temperatures? – Joey Roses Jan 25 at 19:05