# Resampling to 0.5° resolution in Earth Engine

I'm trying to reproject a 500m MODIS image into 0.5° longlat for comparison with climate data. I've followed the instructions for resampling here, but I'm confused about reducing the resolution. I suspect that I'm supposed to change the scale value in reproject(crs, crsTransform, scale), but this value is supposed to be set in meters, which are not consistent across degrees. How can I best convert to a lower resolution in degrees rather than in meters?

What I have so far is:

``````var modis = ee.ImageCollection("MODIS/006/MCD12Q1").select('LC_Type1');
var region = ee.Geometry.Rectangle(-127.18, 19.39, -62.75, 51.29);

var modisyr = ee.Image(modis.first()).select('LC_Type1');
var modisProjection = modisyr.projection();
var modisResolution = modisyr.projection().nominalScale();
print('MODIS projection:', modisProjection);
print('MODIS resolution:', modisResolution);

// Get the forest cover data at MODIS scale and projection.
var modisReproj = modisyr
// Force the next reprojection to aggregate instead of resampling.
.reduceResolution({
reducer: ee.Reducer.mean(),
maxPixels: 1024
})
// Request the data at the scale and projection of the MODIS image.
.reproject({
crs: 'EPSG:4326'
});

var proj2 = modisReproj.projection();
print('MODIS Reprojection:', proj2);
var modisResolution2 = modisyr.projection().nominalScale();
print('MODIS resolution:', modisResolution2);
``````

The ground distance of longitude fluctuates according to:

1º Longitude = cos(Latitude in º) * 111319.46 m (length of 1º at equator)

so if you wanted to truly resample the dimensions of the pixels to match the graticule, the resulting pixels would be variable in size and non-square.

However, when publications use decimal degree scales I think they usually either:

• take the smallest (highest resolution) value, which corresponds to the highest latitude

OR

• take the mean value of the longitudinal distance across the range of latitudes in the image

For your case, you would want to use either ~70km (min) or ~88km (mean), but since you will likely have to resample again when you merge with the climate data, I would recommend going on the finer scale side with this step and using something like 50km:

``````// Get the forest cover data at MODIS scale and projection.
var modisReproj = modisyr
// Force the next reprojection to aggregate instead of resampling.
.reduceResolution({
reducer: ee.Reducer.mean(),
maxPixels: 1024
})
// Request the data at the scale and projection of the MODIS image.
.reproject({
crs: 'EPSG:4326',
scale: 50000
});
``````

I got some good info from here and here.