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

add possibility to specify crop dimensions #539

Merged
merged 4 commits into from
Oct 22, 2023
Merged

Conversation

maxfreu
Copy link
Contributor

@maxfreu maxfreu commented Oct 19, 2023

This adds the possibility to specify crop dimensions. Hope it looks ok :)

Copy link
Owner

@rafaqz rafaqz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lools good

src/methods/crop_extend.jl Outdated Show resolved Hide resolved
src/methods/crop_extend.jl Outdated Show resolved Hide resolved
src/methods/crop_extend.jl Outdated Show resolved Hide resolved
src/methods/crop_extend.jl Outdated Show resolved Hide resolved
@maxfreu
Copy link
Contributor Author

maxfreu commented Oct 20, 2023

This was a clear case of not seeing the forest for the trees :D I'll fix it!

@codecov-commenter
Copy link

codecov-commenter commented Oct 22, 2023

Codecov Report

Merging #539 (9e87dbd) into main (ff90b8f) will increase coverage by 7.92%.
Report is 3 commits behind head on main.
The diff coverage is 37.50%.

@@            Coverage Diff             @@
##             main     #539      +/-   ##
==========================================
+ Coverage   73.06%   80.98%   +7.92%     
==========================================
  Files          59       57       -2     
  Lines        4633     4107     -526     
==========================================
- Hits         3385     3326      -59     
+ Misses       1248      781     -467     
Files Coverage Δ
src/Rasters.jl 100.00% <ø> (ø)
src/methods/crop_extend.jl 89.13% <100.00%> (-0.12%) ⬇️
src/methods/mask.jl 90.00% <100.00%> (+0.38%) ⬆️
src/plotrecipes.jl 83.17% <ø> (+9.91%) ⬆️
src/stack.jl 84.47% <100.00%> (+0.09%) ⬆️
ext/RastersMakieExt/plotrecipes.jl 0.00% <0.00%> (ø)

... and 6 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@maxfreu
Copy link
Contributor Author

maxfreu commented Oct 22, 2023

I noticed that there are unused variables in the crop functions, so it's likely that they don't work as you intended:

sampled = reduce(to; init=()) do acc, d
lookup(d) isa AbstractSampled ? (acc..., d) : acc
end

ds = dims(x, map(key2dim, keys(to)))

@rafaqz
Copy link
Owner

rafaqz commented Oct 22, 2023

Good catch, the second one ds is just no longer needed, thats in DD now.

In the first sampled should be used instead of to. It will mostly just stop bands or other Categorical lookups being used to crop. We probably dont test that.

(Feel free to clean up/fix those)

@maxfreu
Copy link
Contributor Author

maxfreu commented Oct 22, 2023

Actually, cropping forward ordered categorical int64 band dimensions worked. But I changed it nevertheless, as there probably will be problems with string values.

@rafaqz
Copy link
Owner

rafaqz commented Oct 22, 2023

Yeah the idea was you basically never want to use crop for bands or categorical things, so passing in bands in the to template should be ignored

@rafaqz rafaqz merged commit 87adabd into rafaqz:main Oct 22, 2023
4 of 5 checks passed
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

Successfully merging this pull request may close these issues.

3 participants