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

Feature request: mask_and_scale #702

Open
vboussange opened this issue Jul 26, 2024 · 3 comments
Open

Feature request: mask_and_scale #702

vboussange opened this issue Jul 26, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@vboussange
Copy link

vboussange commented Jul 26, 2024

Hey there,
rioxarray exposes an argument mask_and_scale when opening a raster, which lazily scales the raster using the scales and offsets in metadata. Could we have this option in Rasters.jl, possibly in the Raster function?

Here is a quick proposition:

function scale(raster::Raster)
   T = typeof(raster.metadata["scale"])
   (raster .|> T) .* raster.metadata["scale"] .+ raster.metadata["offset"]
end
@rafaqz
Copy link
Owner

rafaqz commented Jul 26, 2024

It's on the way!

See: #695

It's a bit trickier than that because it has to work lazily on larger than memory data, on RasterStack etc.

But it's pretty much there in the PR, just a few bugs to iron out.

@rafaqz
Copy link
Owner

rafaqz commented Jul 27, 2024

Also this will be applied as the default when scale and offset are set. Keywords can turn it off.

@vboussange
Copy link
Author

Excellent!

@rafaqz rafaqz added the enhancement New feature or request label Nov 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants