Skip to content

Commit dd370af

Browse files
author
Sean Sullivan
committed
Fix bins that were being cut out when the min bin was set to 0 and remove debug
1 parent 77ef067 commit dd370af

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

elastic_datashader/tilegen.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,7 +1118,6 @@ def generate_tile(idx, x, y, z, headers, params, tile_width_px=256, tile_height_
11181118
span = None
11191119
if field_type == "geo_point":
11201120
geo_tile_grid = A("geotile_grid", field=geopoint_field, precision=geotile_precision)
1121-
logger.info(params)
11221121
estimated_points_per_tile = get_estimated_points_per_tile(span_range, global_bounds, z, global_doc_cnt)
11231122
if params['bucket_min']>0 or params['bucket_max']<1:
11241123
if estimated_points_per_tile is None:
@@ -1133,10 +1132,10 @@ def generate_tile(idx, x, y, z, headers, params, tile_width_px=256, tile_height_
11331132
else:
11341133
estimated_points_per_tile = resp.aggregations.comp.buckets[0].doc_count
11351134

1136-
min_bucket = math.exp(math.log(estimated_points_per_tile)*params['bucket_min'])
1137-
max_bucket = math.exp(math.log(estimated_points_per_tile)*params['bucket_max'])
1138-
geo_tile_grid.pipeline("selector","bucket_selector",buckets_path={"doc_count":"_count"},script=f"params.doc_count > {min_bucket} && params.doc_count < {max_bucket}")
1139-
logger.info(geo_tile_grid.to_dict())
1135+
min_bucket = math.floor(math.exp(math.log(estimated_points_per_tile)*params['bucket_min']))
1136+
max_bucket = math.ceil(math.exp(math.log(estimated_points_per_tile)*params['bucket_max']))
1137+
geo_tile_grid.pipeline("selector","bucket_selector",buckets_path={"doc_count":"_count"},script=f"params.doc_count >= {min_bucket} && params.doc_count <= {max_bucket}")
1138+
11401139
if inner_aggs is not None:
11411140
for agg_name, agg in inner_aggs.items():
11421141
geo_tile_grid.aggs[agg_name] = agg

0 commit comments

Comments
 (0)