Skip to content

Commit

Permalink
Return "0" for out of range integer data.
Browse files Browse the repository at this point in the history
  • Loading branch information
perlman committed Nov 15, 2020
1 parent 98add13 commit bc23eb8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion app/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bc23eb8

Please sign in to comment.