Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

estimate minimum memory usage #556

Open
ungarj opened this issue Jul 11, 2023 · 0 comments
Open

estimate minimum memory usage #556

ungarj opened this issue Jul 11, 2023 · 0 comments

Comments

@ungarj
Copy link
Owner

ungarj commented Jul 11, 2023

We have at least some information to estimate how much memory the output array will roughly need:

def memory_estimate(bands=3, metatiling=1, pixelbuffer=0, dtype="uint8"):
    
    tile_size = 256
    metatile_size = tile_size * metatiling

    # add pixelbuffer around metatile if defined
    metatile_size = metatile_size + 2 * pixelbuffer

    # calculate number of pixels
    one_band_pixels = metatile_size ** 2
    all_bands_pixels = bands * one_band_pixels

    # footprint of one pixel as datatype
    itemsize = np.dtype(dtype).itemsize

    # total size in bytes
   return all_bands_pixels * itemsize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant