I'm running celery beat in order to execute the zonal_stats periodically.
Here is my script:
from rasterstats import zonal_stats
import geopandas as gpd
shapefile = r'~/Earthquake_shakemap/temp_extracted_files/mi.shp'
shapefile_path = os.path.expanduser(shapefile)
gdf = gpd.readfile(shapefile_path)
raster = r'~/raster/afg_worldpop_2020_UNadj_unconstrained_comp.tif'
raster_path = os.path.expanduser(raster)
zonal = zonal_stats(gdf, raster_path, stats = 'sum')
The issue is that when I run the script under Celery, I get Segmentation Fault (Core Dumped) error when the script reaches the line from rasterstats import zonal_stats but once I run it outside Celery, it runs normally
Please help me to solve this issue.
Thanks