Topics

Silencing PROJ errors/warnings


gberardinelli@...
 

Hi all,

As of GDAL 3 I've started seeing warnings written to stderr on open, such as:

proj_create_from_database: datum not found
It's possible that these datasets have malformed projection information, but in cases where I don't care I'd like to be able to silence these types of warnings, as they can easily be emitted hundreds of times.  However I can't find a way to do so.

Using an Env() context with CPL_DEBUG set to os.devnull has no effect, nor does redirecting sys.stderr itself.  It also doesn't look like this is being emitted through the logging module.  So it seems like the underlying library itself may be writing to stderr?  I don't know if this is a rasterio issue, a gdal issue, or a proj issue.

Any pointers are appreciated.

Greg


Sean Gillies
 

Hi Greg,

On Fri, Mar 27, 2020 at 12:29 PM <gberardinelli@...> wrote:
Hi all,

As of GDAL 3 I've started seeing warnings written to stderr on open, such as:

proj_create_from_database: datum not found
It's possible that these datasets have malformed projection information, but in cases where I don't care I'd like to be able to silence these types of warnings, as they can easily be emitted hundreds of times.  However I can't find a way to do so.

Using an Env() context with CPL_DEBUG set to os.devnull has no effect, nor does redirecting sys.stderr itself.  It also doesn't look like this is being emitted through the logging module.  So it seems like the underlying library itself may be writing to stderr?  I don't know if this is a rasterio issue, a gdal issue, or a proj issue.

Any pointers are appreciated.

Greg

Do you see a bare "proj_create_from_database: datum not found" or do you see
ERROR 1: PROJ: proj_create_from_database: datum not found
as in https://github.com/OSGeo/gdal/issues/2321?

Which specific GDAL version are you using?

--
Sean Gillies


gberardinelli@...
 

The warnings are bare when using rasterio (neither of those two prefixes).

Packages were all installed via conda/conda-forge on Windows 10:

gdal version 3.0.4
rasterio version 1.1.3
proj version 6.3.1

Also my original post had a typo, I had tried rasterio.Env(CPL_LOG=os.devnull) (not "CPL_DEBUG").  Still a shot in the dark, perhaps.

Greg