1

I'm trying to map monthly NDSI map using MODIS dataset but when I clip it to my area using Snow band, it is showing the band is not found. Here is the code:

Map.centerObject(area)
var dataCollection = ee.ImageCollection('MODIS/006/MOD10A1')
    .select(['NDSI_Snow_Cover'])

var month_mean = ee.List.sequence(2001, 2020).map(
    function (year) {
        return ee.ImageCollection(
            ee.List.sequence(1,1).map(
                function (month) {
                    var date = ee.Date.fromYMD(year, month, 1);
                    // mean chlor_a (log-normal)
                    var monthMeanImage = dataCollection.filterDate(date, date.advance(1, 'month')).sum().rename('precipitation');

                    // add time band
                    date = ee.Image(date
                        .difference('2002-01-01', "year"))
                        .double()
                        .rename("time");
                    return date.addBands(monthMeanImage);
                })).sum().set('system:time_start', ee.Date.fromYMD(year, 1, 1));
    });

var collection = ee.ImageCollection(month_mean).select('NDSI_Snow_Cover');

var januaryMean = collection.reduce(ee.Reducer.mean()).clip(area)

Map.addLayer(januaryMean)

The link for GEE is: https://code.earthengine.google.com/311cab2c459081a2f1e2fedf41b554ce

1 Answer 1

1

Inside month_mean, you have the following line:

var monthMeanImage = dataCollection.filterDate(date, date.advance(1, 'month')).sum().rename('precipitation');

You're reducing the ImageCollection and renaming the output as 'precipitation', so either change that line or change:

var collection = ee.ImageCollection(month_mean).select('NDSI_Snow_Cover');

To:

var collection = ee.ImageCollection(month_mean).select('precipitation');
1
  • Thanks. Yes I used this code for precipitation but could not recognized it. Aug 22, 2022 at 18:14

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.