I have a process in Python using OGR via the API and the command line. I am tired of my logs being filled with various warnings (so many that it no longer prints after the first 1000). These happen in Python when I call ogr2ogr and when I use OGR's layer.SetFeature. I expect these warnings each time, they do not actually interfere with anything, and I do not need to see them in my logs.
I can't find anything in the documentation or online for how to suppress these warnings when they occur from an ogr2ogr call and/or with the OGR API in Python. The closest answer I found applied to GDAL, not OGR.
UPDATE: I am getting two different types of warnings that are clogging up my logs:
Warning 6: Normalized/laundered field name: 'Shape_Length' to 'Shape_Leng' Warning 1: Value 3.40282346638999984e+23 of field can_open of feature 0 not successfully written. Possibly due to too larger number with respect to field width
The former only occurs once and is not much of a problem, the second one occurs for each feature in my feature class where that value is in the cell, which can be thousands of features * up to 20 columns (of course it stops printing after 1000 warnings issued). These warnings don't actually cause problems in my output and I would like to hide them.
Here is the sample code for the ogr2ogr command (I am just clipping an input gdb to an extent) that is causing these error messages, but the same also occurs when working in the OGR API, with shapefiles that have these values.
ogr2ogr -clipsrc -102.38428516 54.5384116051 -102.031403056 54.7529375968 -spat -102.38428516 54.5384116051 -102.031403056 54.7529375968 -f "ESRI Shapefile" <output.shp> <input.gdb>