Fix catch warnings and add gc

This commit is contained in:
LilyRose2798 2024-04-15 23:09:45 +10:00
parent 3c6063979c
commit 4f717f5c61
1 changed files with 3 additions and 1 deletions

View File

@ -141,6 +141,8 @@ def make_tiles(coords_path: Path, input_path: Path, tiles_dir: Path, *,
print(f"creating {data.shape[1]}x{data.shape[0]} pixel image for {colormap.name} colormap...", end = " ", flush = True)
image_data = colors[data]
print("done")
del colors
collect()
tiles_per_side = image_data.shape[0] // tile_size
z = tiles_per_side.bit_length() - 1
z_path = path / f"{z}"
@ -288,7 +290,7 @@ def make_tiles(coords_path: Path, input_path: Path, tiles_dir: Path, *,
# print(f"replacing NaNs...", end = " ", flush = True)
# rtt_data_f[np.isnan(rtt_data_f)] = 0.0
print(f"converting to ints...", end = " ", flush = True)
with catch_warnings():
with catch_warnings(action = "ignore"):
rtt_data_norm = rtt_data_f.astype(np.uint16)
print("done")
return rtt_data_norm