Calculate the following statistics and insert them into the properties. Use…
- User
Calculate the following statistics and insert them into the properties. Use aggregate_stats(property) to calculate the sum, min, max, mean, sample standard deviation, sample variance, total standard deviation and total variance of the 'anomes'. Here is the example script: var ET = ee.ImageCollection("projects/sat-io/open-datasets/BR-DWGD/ET"); var PR = ee.ImageCollection("projects/sat-io/open-datasets/BR-DWGD/PR");
var mask = ee.Image(1).clip(geometry3); // Placeholder for masking if necessary
// Define scaling factors for ET and PR var ET_offset = 0; // Evapotranspiration var ET_scale = 0.051181102;
var PR_offset = 225; // Precipitation var PR_scale = 0.006866665;
// Function to scale ET images var scaleETBand = function(img) { return img.updateMask(mask).select("b1").multiply(ET_scale).add(ET_offset) .rename(['ET1']) //.addBands(ee.Image.constant(ee.Number.parse(img.date().format("YYYYMM"))).toInt().rename('Months')) .set('system:time_start', img.get('system:time_start')) .set('anomes', ee.Number.parse(img.date().format("YYYYMM")).toInt()); };
// Function to scale PR images var scalePRBand = function(img) { return img.updateMask(mask).select("b1").multiply(PR_scale).add(PR_offset) .rename(['PR1']) //.addBands(ee.Image.constant(ee.Number.parse(img.date().format("YYYYMM"))).toInt().rename('Months')) .set('system:time_start', img.get('system:time_start')) .set('anomes', ee.Number.parse(img.date().format("YYYYMM")).toInt()); };
// Scale ET and PR collections var ET_scaled = ET.filterDate('2014-01-01', '2024-12-31').map(scaleETBand); var PR_scaled = PR.filterDate('2014-01-01', '2024-12-31').map(scalePRBand);
- Assistant
- User
Corrija o script. Antes utilize sampleRegions(collection, properties, scale, projection, tileScale, geometries) para coletar as informações por mês utilizando a propriedade "anomes".
- Assistant