You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm plotting maps with cartopy and use the GSHHS maps as background. From there I get warnings like: WARNING:root:Possible issue encountered when converting Shape #95 to GeoJSON: Shapefile format requires that polygons contain at least one exterior ring, but the Shape was entirely made up of interior holes (defined by counter-clockwise orientation in the shapefile format). The rings were still included but were encoded as GeoJSON exterior rings instead of holes.
After some search I found out that these warnings are from shapefile.py, which uses the root-logger as logger.warning whenever a problem occurs. Currently, I have to suppress the root-logger to suppress the warning, i.e.
logging.root.setLevel(logging.ERROR)
As a library, it would make the users life easier if a named logger rather than the root logger would be used as suggested by the logging documentation:
A good convention to use when naming loggers is to use a module-level logger, in each module which uses logging, named as follows:
I had a small note in the docs to toggle the warnings by setting the module VERBOSE constant to False, but updated the README to make this more clear. In addition I switched to your suggested solution of using a named logger. Thanks!
Hi,
I'm plotting maps with cartopy and use the GSHHS maps as background. From there I get warnings like:
WARNING:root:Possible issue encountered when converting Shape #95 to GeoJSON: Shapefile format requires that polygons contain at least one exterior ring, but the Shape was entirely made up of interior holes (defined by counter-clockwise orientation in the shapefile format). The rings were still included but were encoded as GeoJSON exterior rings instead of holes.
After some search I found out that these warnings are from shapefile.py, which uses the root-logger as
logger.warning
whenever a problem occurs. Currently, I have to suppress the root-logger to suppress the warning, i.e.As a library, it would make the users life easier if a named logger rather than the root logger would be used as suggested by the logging documentation:
A good convention to use when naming loggers is to use a module-level logger, in each module which uses logging, named as follows:
Then a user (or the GSHHS library provider) could suppress the specific warnings as
logging.getLogger('shapefile').setLevel(logging.ERROR)
Best regards,
Heiko
The text was updated successfully, but these errors were encountered: