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

st_set_bbox() not persistent when applied to stars_proxy object #707

Open
dazu89 opened this issue Sep 1, 2024 · 2 comments
Open

st_set_bbox() not persistent when applied to stars_proxy object #707

dazu89 opened this issue Sep 1, 2024 · 2 comments

Comments

@dazu89
Copy link

dazu89 commented Sep 1, 2024

I was happy to discover that read_stars supports reading any file as stars_proxy object, significantly easing my memory constraints (quite the contrary occured to my surprise, see #708)! However, st_bbox() when applied via st_set_bbox() to a stars_proxy does not outlast the conversion into a stars object, e.g.

library(stars)
fl = system.file("tif/L7_ETMs.tif", package = "stars")
rs = read_stars(fl, proxy = TRUE)
rs2 = rs |> 
  st_set_bbox(value = st_bbox(rs)*2) |> 
  st_as_stars()

# The two bboxes should be different, i.e. TRUE TRUE TRUE TRUE
st_bbox(rs) != st_bbox(rs2)

This entails problems for intermediate down-sampled output such as plots as well as repetitive statements after each obtained stars objects if the st_bbox of the raw data is not set correctly.

@edzer
Copy link
Member

edzer commented Sep 1, 2024

The help for st_set_bbox is rather short; what is it that you want to get done by using it?

@dazu89
Copy link
Author

dazu89 commented Sep 1, 2024

Thank you, @edzer, for your reply. My raster in ASCII Grid form has wrong cellsize or dx/dy values so I wanted to correct these before further processing, by manually setting the bounding box.
I could work around this problem by modifying the data in place, but preferred an in memory replacement.

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