From 9fb0142632e9e5b496438d08da437303228035dd Mon Sep 17 00:00:00 2001 From: Vincent Sarago Date: Mon, 23 Aug 2021 13:15:42 +0200 Subject: [PATCH] remove white space when passing rescale parameters for float32 value (#360) --- CHANGES.md | 3 ++- src/titiler/core/tests/test_factories.py | 10 ++++++++++ src/titiler/core/titiler/core/dependencies.py | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index be9245497..a71661964 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,10 +1,11 @@ # Release Notes -## Next (TDB) +## 0.3.6 (2021-08-23) ### titiler.core - fix morecantile related tests (https://github.com/developmentseed/titiler/issues/358) +- fix float parsing when datatype is float32 (https://github.com/developmentseed/rio-viz/issues/39) ### titiler.application diff --git a/src/titiler/core/tests/test_factories.py b/src/titiler/core/tests/test_factories.py index 32418785f..eb55d5af5 100644 --- a/src/titiler/core/tests/test_factories.py +++ b/src/titiler/core/tests/test_factories.py @@ -68,6 +68,16 @@ def test_TilerFactory(): assert "postprocess;dur" in timing assert "format;dur" in timing + response = client.get( + f"/tiles/8/87/48?url={DATA_DIR}/cog.tif&rescale=-3.4028235e+38,3.4028235e+38" + ) + assert response.status_code == 200 + assert response.headers["content-type"] == "image/jpeg" + timing = response.headers["server-timing"] + assert "dataread;dur" in timing + assert "postprocess;dur" in timing + assert "format;dur" in timing + response = client.get( f"/tiles/8/87/48.tif?url={DATA_DIR}/cog.tif&expression=b1,b1,b1&return_mask=false" ) diff --git a/src/titiler/core/titiler/core/dependencies.py b/src/titiler/core/titiler/core/dependencies.py index a612fe02d..47cd4e8cc 100644 --- a/src/titiler/core/titiler/core/dependencies.py +++ b/src/titiler/core/titiler/core/dependencies.py @@ -341,7 +341,7 @@ class RenderParams(DefaultDependency): def __post_init__(self): """Post Init.""" self.rescale_range = ( - [tuple(map(float, r.split(","))) for r in self.rescale] + [tuple(map(float, r.replace(" ", "").split(","))) for r in self.rescale] if self.rescale else None )