Fix catch warnings and add gc
This commit is contained in:
parent
3c6063979c
commit
4f717f5c61
4
ipmap.py
4
ipmap.py
|
@ -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)
|
print(f"creating {data.shape[1]}x{data.shape[0]} pixel image for {colormap.name} colormap...", end = " ", flush = True)
|
||||||
image_data = colors[data]
|
image_data = colors[data]
|
||||||
print("done")
|
print("done")
|
||||||
|
del colors
|
||||||
|
collect()
|
||||||
tiles_per_side = image_data.shape[0] // tile_size
|
tiles_per_side = image_data.shape[0] // tile_size
|
||||||
z = tiles_per_side.bit_length() - 1
|
z = tiles_per_side.bit_length() - 1
|
||||||
z_path = path / f"{z}"
|
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)
|
# print(f"replacing NaNs...", end = " ", flush = True)
|
||||||
# rtt_data_f[np.isnan(rtt_data_f)] = 0.0
|
# rtt_data_f[np.isnan(rtt_data_f)] = 0.0
|
||||||
print(f"converting to ints...", end = " ", flush = True)
|
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)
|
rtt_data_norm = rtt_data_f.astype(np.uint16)
|
||||||
print("done")
|
print("done")
|
||||||
return rtt_data_norm
|
return rtt_data_norm
|
||||||
|
|
Loading…
Reference in New Issue