# https://deephaven.io from deephaven import agg, parquet, empty_table, merge # Everything pre-whiteout # https://www.reddit.com/r/place/comments/tzboys/the_rplace_parquet_dataset/ place = parquet.read('2022_place_deephaven.parquet')\ .where("k<155926002") # 2000 x 2000 grid all_pixels = empty_table(2000).view(["x1=(short)i"])\ .join(empty_table(2000).view(["y1=(short)i"]), []) # All pixels *not* present in the place table unused_pixels = all_pixels\ .where_not_in(place, ["x1", "y1"]) # All pixels in the place table exactly once one_and_done_pixels = place\ .count_by("count", ["x1", "y1"])\ .where("count == 1")\ .view(["x1", "y1"]) # Light pink background (255, 230, 238) background_img = all_pixels.view(["x=x1", "y=y1", "rgb=16770798"]) # White for unused (255, 255, 255) unused_img = unused_pixels.view(["x=x1", "y=y1", "rgb=16777215"]) # One and done (rgb) one_and_done_img = place\ .where_in(one_and_done_pixels, ["x1", "y1"])\ .view(["x=x1", "y=y1", "rgb"]) # Combine all, ensure unused and one-and-done pixels take precedence over background uncontested_img = merge([background_img, unused_img, one_and_done_img])\ .last_by(["x", "y"]) write_image(uncontested_img, "/data/uncontested.png")