-
Notifications
You must be signed in to change notification settings - Fork 83
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
rescaleImage ignoring ymin and ymax? #54
Comments
In your example, the data values exceed the theoretical min and max you provide and the rescaling is ill-defined and will inevitably result in values outside of the specified ymin:ymax range. imc <- clamp(ima, lower=q[1],upper=q[2]) # check ?raster::clamp for the useValues argument
ima2 <- rescaleImage(imc, xmin=q[1], xmax=q[2], ymin=0, ymax=255, forceMinMax = TRUE)
cellStats(ima2,range)
#> 0 255 |
It is not inevitable, it just needs to clamp the output to conform to the specified ymin, ymax range. but including the clamp as an option within rescaleImage() would be more efficient for large raster brick objects and certainly easier for the user. |
That is correct of course. Yet, if you clamp beforehand, you have the choice to set all values exceeding the quantiles to NA, if you so wish. But I agree, that option can be added to rescaleImage. |
Good we finally agree! Should I fill another ticket with that request or is this one sufficient? |
No, this one is sufficient. |
I've deleted my last comment, I was mixing things up with |
Thanks to a recent improvemnt of raster::clamp(),
|
Doing:
I was expecting ima2 to be rescaled from range
-7.437958 , 7.845097-4.168026, 4.168633 to 0, 255Am I misunderstanding the doc or is there an error?
The text was updated successfully, but these errors were encountered: