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

Get rasterize working #3

Closed
lalligagger opened this issue Jun 17, 2023 · 15 comments
Closed

Get rasterize working #3

lalligagger opened this issue Jun 17, 2023 · 15 comments
Assignees

Comments

@lalligagger
Copy link
Owner

Per holviz channels, we should be able to use delayed rasterization for the holoviz plot objects. This would let us remove the resolution slider and just load what makes sense for the zoom level, hopefully avoid crashing with memory overages.

@ivandorte
Copy link
Collaborator

ivandorte commented Jun 17, 2023

I tried implementing the rasterization option on both holoviews and hvplot.xarray. I was only able to add the OSM tiles with hvplot (in holoviews it shows a blank map). However, when zooming in/out, the RGB image is filled with a black background:

screen-capture.webm

And it's laggy, sometimes the image is clipped and not fully rendered...

@lalligagger
Copy link
Owner Author

Interesting, thanks for giving this a shot. I thought that black area was due to nodata=0 happening somewhere, but it looks like it extends beyond the tile.

We could consider using your visualization as our "Layer Editor" and then push those to a leaflet map once holoviz/panel#5064 is released.

@lalligagger
Copy link
Owner Author

For context - image-to-tiles with ipyleaflet had been working really well even for quite large (merged) S2 tiles. I just got stuck on the layer reload issue. The biggest benefits I see to hv are easy data tooltips for raster (idk if I've seen this in leaflet) & linked plots.

I don't think we have to pick one, I just want to be specific about where/ how each will be used. For the contest, I think sticking with close to the current layout is the right call.

@lalligagger
Copy link
Owner Author

holoviz/holoviews#5351 - related per @ hoxbro, also:

Try setting expand=False in the call

@ivandorte
Copy link
Collaborator

The expand option works on both holoviews and hvplot with some differences. Check the gists and comments:
holoviews: https://gist.github.com/ivandorte/339560c5c82ad4f1f9a39fc672b036fd
hvplot: https://gist.github.com/ivandorte/16bbf1ee8af6b433937697134bd59e7e

@lalligagger
Copy link
Owner Author

Personally good to close this. I will try an xarray contrast stretch today and see if that fixes the issue I'm seeing.

We can add some other polish items to a new ticket. (My latest thinking is we should return these plot(s) and controls all together in one chatbox response.)

@ivandorte
Copy link
Collaborator

For the contrast stretch try changing np.clip(out_data, 0, 255) to out_data.clip(0, 255).
This morning I merged the RGB/index plot into a single function and made some changes to the image_processing.py script.
I will push a branch soon.

@ivandorte
Copy link
Collaborator

Merging the function is not working. If you apply a selector, the plot acts independently of each other. Investigating...

@lalligagger
Copy link
Owner Author

Why don't I push by UI updates to main and you can start working off of that? I think this would be a nice setup to work towards:

  • "View datacube" will be the agent call for both RGB/ Index plotting over time using hv
  • We have an underlying function that can switch between type as needed
  • This is returned with an attached datepicker and index selector
  • Optionally, the user can ask for a swipe view which returns two of the above

The fewer tool wrappers the better for this first release. If RGB vs. spectral really need to be separate functions we can just have a flag that switches between those in the single load_datacube python function. (That then gets wrapped as langchain tool.)

@lalligagger
Copy link
Owner Author

One nice thing about the about is you could do time comparison slider as well as RGB vs. index.

@lalligagger
Copy link
Owner Author

out_data.values = exposure.rescale_intensity(in_data, in_range=(p2, p98))
works

@ivandorte
Copy link
Collaborator

ivandorte commented Jun 22, 2023

Added Rasterization for RGB/single band #17. I think that we'll need to remove the stac_load from the image plots and load the required data once (if this is possible).

@lalligagger
Copy link
Owner Author

lalligagger commented Jun 22, 2023 via email

@lalligagger
Copy link
Owner Author

Closing this :) Can track any improvements elsewhere.

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