Nuestros cálculos se han automatizado en Google Earth Engine para la democratización del mercado. Google se ha comprometido a proporcionar cuentas gratuitas a grupos Indígenas involucrados en el cambio climático. El registro no-comercial está disponible.
Además, la comunidad de código abierto de Python ha estado trabajando en código público de Python en el repositorio de GitHub de Savimbo. Este código podría estar relacionado con los desarrollos en Google Earth Engine o ser implementado en otros entornos.
Muestra de código, código en revisión. Puede accederse a través de Google Earth Engine en este enlace. O en Savimbo GitHub en este enlace.
// Load plot18 polygon
var plot18_data = require("users/drea/map:plot18_data");
var plot18 = plot18_data.polygon;
// Calculate plot area in hectare
var plotArea = plot18.area();
var plotAreaHectares = plotArea.divide(10000);
// Load jaguar points
var points_jaguar_data = require("users/drea/map:points_jaguar_data");
var puntos = points_jaguar_data.points;
var radios = [];
var sumMultipliedArea = ee.Number(0);
// Define a feature collection to store intersection polygons
var intersectionPolygons = ee.FeatureCollection([]);
// Define the assignedArea function
var assignedAreaFunction = function(offset) {
var day = startDate.advance(offset, 'day');
var dayString = day.format('YYYY-MM-dd');
var feature = ee.Feature(null, { date: dayString, intersectionArea: intersectionArea });
return feature.set('date_area', ee.String(dayString).cat(' - ').cat(intersectionArea));
};
// Calculate radios and buffers for each point
for (var i = 0; i < puntos.length; i++) {
var point = puntos[i].geometry;
var date = puntos[i].date;
// Calculate the start date by subtracting 30 days
var startDate = ee.Date(date).advance(-30, 'day');
// Calculate the end date by adding 30 days
var endDate = ee.Date(date).advance(30, 'day');
// Create a feature with the point geometry and date as properties
var feature = ee.Feature(point, { date: date });
var pointBuffer = feature.buffer(800);
radios.push(pointBuffer);
// Calculate intersection with plot18
var intersection = pointBuffer.intersection(plot18);
// Calculate area in hectares
var area = intersection.area().divide(10000);
// Get the month and year of the date
var month = ee.Date(date).get('month');
var year = ee.Date(date).get('year');
// Generate a label for the month and year
var monthYearLabel = ee.String(month).cat('-').cat(year).cat(' Hectarias N°');
// Calculate intersection with plot18 for the current point
var intersectionPlot18 = pointBuffer.intersection(plot18);
// Calculate area in hectares for the intersection with plot18
var intersectionArea = intersectionPlot18.area().divide(10000);
var multipliedArea = intersectionArea.multiply(60);
// Add multipliedArea to the sum
sumMultipliedArea = sumMultipliedArea.add(multipliedArea);
// Define the jaguar range of dates
var jaguarRange = endDate.difference(startDate, 'day');
// Assign intersectionArea value to each day of the jaguar range
var assignedArea = ee.FeatureCollection(ee.List.sequence(0, jaguarRange.subtract(1)).map(assignedAreaFunction));
// Print the results for each point
print('Jaguar:', i + 1);
print('Date of image capture:', date);
print('Start Date:', startDate.format('YYYY-MM-dd'));
print('End Date:', endDate.format('YYYY-MM-dd'));
print('Total Intersection Area per day in hectares:', intersectionArea);
print('Multiplied Intersection Area * 60:', multipliedArea);
print('Assigned Area per day:', assignedArea);
print('----------------------');
// Add the current point buffer to the map in blue color
Map.addLayer(pointBuffer, { color: 'blue' }, 'Radio ' + (i + 1));
// Add the intersection geometry to intersectionPolygons
intersectionPolygons = intersectionPolygons.merge(intersection);
}
// Perform polygon unions to avoid duplicates
var unionPolygons = intersectionPolygons.union();
// Calculate the total area of intersections without duplicates
var totalIntersectionArea = unionPolygons.geometry().area().divide(10000);
// Display the results
print('Total intersection area hectares:', totalIntersectionArea);
print('Plot18 area hectares:', plotAreaHectares);
print('Sum of Multiplied Intersection Area hectares * 60 days:', sumMultipliedArea);
// Add the plot18 layer to the map
Map.addLayer(plot18, { color: 'gold' }, "plot18");
Map.centerObject(plot18);