From 291bbf7551f5c2681b2b986e2d7c884a0148d2c2 Mon Sep 17 00:00:00 2001 From: vincentsarago Date: Sun, 11 Feb 2024 22:24:57 +0100 Subject: [PATCH] round lat/lon to avoid error in python-cmr --- titiler/cmr/backend.py | 5 ++++- titiler/cmr/logger.py | 5 +++++ 2 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 titiler/cmr/logger.py diff --git a/titiler/cmr/backend.py b/titiler/cmr/backend.py index 5098940..cbfc05f 100644 --- a/titiler/cmr/backend.py +++ b/titiler/cmr/backend.py @@ -20,6 +20,7 @@ from rio_tiler.mosaic import mosaic_reader from rio_tiler.types import BBox +from titiler.cmr.logger import logger from titiler.cmr.settings import AuthSettings, CacheSettings, RetrySettings from titiler.cmr.utils import retry @@ -164,12 +165,14 @@ def get_assets( ) -> List[Asset]: """Find assets.""" try: + xmin, ymin, xmax, ymax = (round(n, 8) for n in [xmin, ymin, xmax, ymax]) results = earthaccess.search_data( bounding_box=(xmin, ymin, xmax, ymax), count=limit, **kwargs, ) - except RuntimeError: + except RuntimeError as e: + logger.debug(repr(e)) return [] assets: List[Asset] = [] diff --git a/titiler/cmr/logger.py b/titiler/cmr/logger.py new file mode 100644 index 0000000..ed81b75 --- /dev/null +++ b/titiler/cmr/logger.py @@ -0,0 +1,5 @@ +"""titiler-cmr logger.""" + +import logging + +logger = logging.getLogger("titiler-cmr")