pysepal.mapping.gdal_env#

Sanitize GDAL/PROJ data environment variables.

SEPAL’s system GDAL exports GDAL_DATA, PROJ_LIB and PROJ_DATA into every module venv, pointing at data files for a different GDAL build than the venv’s wheels. That breaks raster reads, so drop them before anything imports rasterio.

Paths inside the interpreter’s own prefix are kept: they are this environment’s own GDAL stack, and pyogrio and osgeo break without them. This cannot fix a mixed conda/wheel install, where a wheel’s own libgdal lives in that prefix too.

Module Attributes

GDAL_ENV_VARS

Data-directory variables to sanitize.

Functions

prune_foreign_gdal_env

Delete the GDAL/PROJ data variables that point outside this environment.