diff --git a/tests/test_router.py b/tests/test_router.py index e27e0c6..0f27f1f 100644 --- a/tests/test_router.py +++ b/tests/test_router.py @@ -92,6 +92,14 @@ def test_get_map(xpublish_client): assert response.status_code == 200, "Response did not return successfully" assert response.headers["content-type"] == "image/png", "Response is not an image" + autoscale_response = xpublish_client.get( + "datasets/air/wms?version=1.3.0&service=WMS&request=GetMap&layers=air&styles=raster/default&crs=EPSG:4326&bbox=-160.0,15.0,-30.0,75.0&width=512&height=513&format=image/png&colorscalerange=227.0,302.6&autoscale=True", + ) + assert autoscale_response.status_code == 200, "Response did not return successfully" + assert ( + autoscale_response.headers["content-type"] == "image/png" + ), "Response is not an image" + def test_get_feature_info(xpublish_client): response = xpublish_client.get( diff --git a/xpublish_wms/wms/get_map.py b/xpublish_wms/wms/get_map.py index e44618a..ac2bcd7 100644 --- a/xpublish_wms/wms/get_map.py +++ b/xpublish_wms/wms/get_map.py @@ -332,9 +332,9 @@ def render( return {"min": float(da.min()), "max": float(da.max())} if not self.autoscale: - vmin, vmax = self.colorscalerange + span = (self.colorscalerange[0], self.colorscalerange[1]) else: - vmin, vmax = [None, None] + span = None start_shade = time.time() cvs = dsh.Canvas( @@ -344,8 +344,6 @@ def render( y_range=(self.bbox[1], self.bbox[3]), ) - print(da) - if ds.gridded.render_method == RenderMethod.Quad: mesh = cvs.quadmesh( da, @@ -373,7 +371,7 @@ def render( mesh, cmap=cm.get_cmap(self.palettename), how="linear", - span=(vmin, vmax), + span=span, ) logger.info(f"WMS GetMap Shade time: {time.time() - start_shade}")