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

Merge/union support for multi-band images #39

Closed
PenguinJunk opened this issue Jun 10, 2019 · 3 comments
Closed

Merge/union support for multi-band images #39

PenguinJunk opened this issue Jun 10, 2019 · 3 comments

Comments

@PenguinJunk
Copy link

I was unable to use merge() with 3-band images until I added a third dimension to the shape expression in union():
shape = (np.abs(np.floor((latmax-latmin)/rasters[0].y_cell_size)).astype(int), np.floor((lonmax-lonmin)/rasters[0].x_cell_size).astype(int), 3)

Was I using merge() incorrectly or does there need to be a test for the number of bands in the input imagery?

@ozak
Copy link
Owner

ozak commented Jun 10, 2019

The code is not optimized for multi band rasters, since I never use those. But it shouldn't be too difficult to extend functionality I think. Would you mind sharing the raster you are using? Could you also let me know which functions or properties you have encountered problems with? Perhaps one way forward is to allow the choice of band to import. Then every band will be its own georaster. Additionally it would be possible to create a new object for multi band georasters.

@PenguinJunk
Copy link
Author

Unfortunately, I can't share the data. When I have time (could be a while) I'll try to reproduce with some other data.
Only on merge()/union() so far. I will add to this log any others that appear to have a similar problem.

Observation:
When using from_file() the image is loaded with the bands/channels in the first dimension/axis. In my data, because I'm converting from an array, the channels are in the 3rd dimension. Therefore, the above code snippet will not work in every case - and it will definitely break if the image does not have 3 bands (it was a brute-force fix).

I would be happy to propose a an update to union() that would work for single or multi-band imagery. It would be useful to know if there is any functionality in georasters that assumes the axis in which the channels sit. Would it be possible to update the GeoRaster class with an attribute stating the channel axis (e.g. channel_axis=0)?

@ozak
Copy link
Owner

ozak commented May 28, 2020

Moved all multi-band requests to #58.

@ozak ozak closed this as completed May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants