0

I am trying to combine MODIS EVI with climate data from ERA5 in Google Earth Engine.

When I run the code I get the following error:

Fr_EVI: Tile error: Reprojection output too large (19686x6123 pixels).

Why am I getting this error?

I have broken the script down below but you can also just use this link.

First i take the temperature band from the ERA-5 data

var ta = ee.ImageCollection("ECMWF/ERA5/MONTHLY")
              .filter(ee.Filter.date('2019-01-01', '2019-12-31'))
              .select('mean_2m_air_temperature');

Now to extract the projection info for ERA-5

var ERAProjection = ta.first().projection();
print('ERA-5 Projection: ', ERAProjection)

This projection is used in this function to reproject MODIS EVI data

//resample modis to ERA-5 resolution
function resample(dr){
  // Get the modis data at era-5 scale and projection.
  var out = dr
    // Force the next reprojection to aggregate instead of resampling.
    .reduceResolution({
      reducer: ee.Reducer.mean(),
      maxPixels: 65535
    }).rename('EVI')
    // Request the data at the scale and projection of the ERA-5 data.
    .reproject({
      crs: ERAProjection
    });
    return(out)
}

And here it is executed

var modEVI  = ee.ImageCollection('MODIS/006/MOD13A1')
                  .filter(ee.Filter.date('2019-01-01', '2019-12-31'))
                  .select('EVI')
                  .map(resample);

Then we take a monthly mean of MODIS EVI

//Month and year for function
var months = ee.List.sequence(1, 12);
var years = ee.List.sequence(2019, 2019);

// Get average pixel value for month-year
function MonYrME(y) {
    return months.map(function (m) {
      return modEVI
        .filter(ee.Filter.calendarRange(y, y, 'year'))
        .filter(ee.Filter.calendarRange(m, m, 'month'))
        .mean()
        .set('system:index', ee.Date.fromYMD(y, m, 1).format("YYYYMM"));
  });
}

//Apply function
var modEVImy = ee.ImageCollection
                  .fromImages(years.map(MonYrME).flatten());

Join two Image Collections

var filter = ee.Filter.equals({
  leftField: 'system:index',
  rightField: 'system:index'
});

// Create the join.
var simpleJoin = ee.Join.inner();

// Inner join
var innerJoin = ee.ImageCollection(simpleJoin.apply(modEVImy, ta, filter))

var joined = innerJoin.map(function(feature) {
  return ee.Image.cat(feature.get('primary'), feature.get('secondary'));
})

combine temp and EVI

function frev(ra){
  var fe = ra.expression(
    'T * E',{
      'T': ra.select('mean_2m_air_temperature'),
      'E': ra.select('EVI')
    })
    return(fe.rename('fr_evi'))
}

var firevi = joined
  .map(frev)
  .mean();

print(firevi)

Add layers to map

Map.setCenter(132, -27, 3);
Map.addLayer(firevi.mean(), {min: -10, max: 10}, 'Fr_EVI');

1 Answer 1

2

Normally when rendering an image, EE works at different scales for different zoom levels. The docs explain how this works. When you reproject, you force EE to work at the scale you specified, and depending on your zoom level, each map tile will contain more or less pixels. When zoomed out too far, each tile simply contain too many pixels for EE to handle . In your case, at zoom level 3, you ended up with some 19686x6123 pixels, and get an error. Zoom in far enough and it will work.

Your options are to either not reproject at all, view the map at large enough zoom level, or export the image as an asset before adding it to the map.

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.