Adjust the Google Earth Engine script below to generate the "early" imagecollection,…
- User
Adjust the Google Earth Engine script below to generate the "early" imagecollection, selecting the bands and applying the logical masks from the values in the "resultYear1" list. Note: The image "cictrizes_veredas_anos" has 41 bands, each with the name "Months" followed by the year (for example: 'Months1984', 'Months1985', 'Months1986' and so on) Here is the example script:
var months1 = ee.List.sequence(1,7); var months2 = ee.List.sequence(8,12); var year1 = ee.List.sequence(1984, 2014);
var joinYearMonth1 = function(yearList) { return yearList.map(function(year) { return months1.map(function(month) { var monthStr = ee.Number(month).format('%02d');//adds zero to two characters var yearStr = ee.Number(year).format('%d');//year without dot var combinedStr = ee.String(yearStr).cat(monthStr); var combined = ee.Number.parse(combinedStr); return combined; }); }).flatten(); };
var resultYear1 = joinYearMonth1(year1); print('Result Year1 and Months:', resultYear1);
var joinYearMonth2 = function(yearList) { return yearList.map(function(year) { return months2.map(function(month) { var monthStr = ee.Number(month).format('%02d');//adds zero to two characters var yearStr = ee.Number(year).format('%d');//year without dot var combinedStr = ee.String(yearStr).cat(monthStr); var combined = ee.Number.parse(combinedStr); return combined; }); }).flatten(); };
var resultYear2 = joinYearMonth2(year1);
print('Result Year2 and Months:', resultYear2);
var bandameses = citrizes_veredas_meses.bandNames()
var early = ee.ImageCollection.fromImages(resultYear1.map(function(x){ var v1 = bandameses.map(function(y){ return citriczes_veredas_anos.select(y).updateMask(cictrizes_veredas_anos.select(y).eq(ee.Number(x)))}) return v1.setMulti('anomes', x) }));
- Assistant
- User
fix the error: Line 40: x.format is not a function
- Assistant