Skip to content

Optimize/update carbon stats calculation

Sifeddine Biri requested to merge sif/update-stats into main
  • Added Pandas and GeoPandas. GeoPandas spatial join replaces the custom method for more efficient point generation, especially for complex polygons.
  • Implemented async handling and a timeout mechanism for better management of long-running calculations (> 1.5 mins). This will free server resources to prevent service downtime/no response.
  • Limited the size of polygons to 7 million ha (configurable).
  • Improved error handling/logging with custom AreaError to enhance reliability.
  • Optimized parallel sampling for better resource utilization.
  • Moved constants to environment variables for increased configuration flexibility.
  • Reorganized the code structure and added type hints to improve readability and maintainability.

Need to install pip packages: numpy, pandas, rasterio, geojson, pyproj, geopandas, shapely

Merge request reports