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

Enable data editing for SubImage #151

Open
ManuelPopp opened this issue Jan 3, 2023 · 6 comments
Open

Enable data editing for SubImage #151

ManuelPopp opened this issue Jan 3, 2023 · 6 comments

Comments

@ManuelPopp
Copy link

I have large .bsq images I cannot load into memory. Spectral fails to apply the .open_memmap method to the BsqFile instance created from images (see this post).
Lacking other options, I wondered whether it would be possible to enable editing for single pixels, bands, or regions in order to assign values? Could a writable = True option be added to .read_band(), .read_bands(), .read_pixel(), and .read_subimage(), or is this not possible?

@tboggs
Copy link
Member

tboggs commented Jan 3, 2023

What happens if you try this:

import logging
logging.getLogger('spectral').setLevel('DEBUG')
print(img.shape)
mm = img._open_memmap("r")
print(mm.shape)

@ManuelPopp
Copy link
Author

ManuelPopp commented Jan 3, 2023

The first lines give me the shape of the original image:
img.shape prints (3805, 3940, 493)

But the second part fails:
img._open_memmap("r") is None equals True
Accordingly, mm.shape raises a Runtime error: 'NoneType' object has no attribute 'shape'

Edit:

The issue appears to be unique to older Python versions!

@tboggs
Copy link
Member

tboggs commented Jan 3, 2023

Ah, I didn't notice it was python 2.x. And if it was 32-bit python, then memmap would not work on an image that large.

@tboggs
Copy link
Member

tboggs commented Jan 4, 2023

Out of curiosity, what does this print for your python version:

import sys
print(sys.version)
print(sys.maxsize)

@ManuelPopp
Copy link
Author

ManuelPopp commented Jan 4, 2023

>>>sys.version
'2.7.10 (default, May 23 2015, 09:40:32) [MSC v.1500 32 bit (Intel)]
and
>>> sys.maxsize
2147483647

@tboggs
Copy link
Member

tboggs commented Jan 4, 2023

Ok, so that looks like it is the problem. For your system & python version, it can only handle a max file size of 2 GB but yours is larger than that.

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

No branches or pull requests

2 participants