-
Notifications
You must be signed in to change notification settings - Fork 34
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
Comparing R Terra and Julia Rasters crop function: alignment y to the geometry of x #557
Comments
It seems terra does not move the 1760 at all? Essentially we will never recreate exactly what terra does for all commands in Rasters.jl. stars in R doesnt have Maybe explain a little more why using (The |
"It seems terra does not move the 1760 at all?" "Maybe explain a little more why using near matters to you here." Moreover, using Julia and your package I can get results in minutes instead of hours when using R terra. That is why I wanted to do my research in Julia using Rasters. But, as it seems In terms of "Essentially we will never recreate exactly what terra does for all commands in Rasters.jl. stars in R doesnt have snap for crop either, and rasterio in python has all_touched just like we do." Ok, I think that explains everything and closes the topic:) |
I think you are right, it actually makes sense to have the But I need to emphasize that there is no guarantee you will always get the same result as terra even after that. Points that are on the line are treated differently per axis in gdal/R but consistently here. So results are not always identical. |
That is great! If you need help in e.g. testing I am all in! "But I need to emphasize that there is no guarantee you will always get the same result as terra even after that. Points that are on the line are treated differently per axis in gdal/R but consistently here. So results are not always identical." Yes, I know. And that is a general precaution, not only for terra. That is why I am testing each step and exploring! |
Hello, |
Ahh sorry no. I suggest you make a new issue that writes out exactly what the change should be with every detail specified. With my workload Im unfirtunately unlikely to read back over a long conversation and I just skim the issue titles as a reminder of what Im meant to do. |
Closed in favor of #593 |
Hello!
I have my code written in R using terra package (https://github.com/rspatial/terra), where I get pixel count based on different masks from rasters & polygons.
In a simple experiment, I cropped a raster with a smaller one. (Pixels are the same resolution and they 100% overlap). And so, due to differences in crop approach, I am getting different results.
In terra's crop function, as a default, there is a parameter snap set as "near" for the alignment y to the geometry of x. I do not care about touches because it is for polygons only. (https://rdrr.io/cran/terra/man/crop.html)
Depending on the settings, I get:
In Julia Rasters, the control is via touches:
If touches=false:
If touches=true:
So the comparable result (based on pixel dimension) is when in terra I set snap="in" while in Julia Raster's touches=false. But all my original R scripts are based on default snap="near".
Also, I have seen #312 for boundary using mask.
Would you consider adding alignment control?
Thank you!
The text was updated successfully, but these errors were encountered: