diff --git a/app/main.py b/app/main.py index 3a14c9b..20b774c 100644 --- a/app/main.py +++ b/app/main.py @@ -217,7 +217,7 @@ class QueryColumnPointListResponse(BaseModel): @app.post('/query/dataset/{dataset}/s/{scale}/values_array', response_model=QueryColumnPointListResponse, tags=["query"]) async def query_values_array(dataset: DataSetName, scale: int, locs : ColumnPointList): """Return segment IDs at given locations. - One + Note: This function returns float(s). For segments, use values_array_string_response. """ # Get a Nx3 array of points diff --git a/app/query.py b/app/query.py index 6835d4d..daf4a36 100644 --- a/app/query.py +++ b/app/query.py @@ -32,7 +32,11 @@ def query_points(dataset, scale, locs): query_points[bad_points] = np.NaN if bad_points.all(): # No valid points. The binning code will otherwise fail. - field = np.full((query_points.shape[0], info["width"]), np.NaN, dtype=info["dtype"]) + error_value = np.NaN + if np.issubdtype(np.dtype(info["dtype"]), np.integer): + # Return 0 for integers [otherwise, np.NaN maps to MAX_VALUE + error_value = 0 + field = np.full((query_points.shape[0], info["width"]), error_value, dtype=info["dtype"]) else: field = process.get_multiple_ids(query_points, n5, max_workers=config.MaxWorkers,