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

Test for clipping with natural coordinates #152

Merged
merged 1 commit into from
Feb 18, 2023
Merged

Conversation

gabrieldansereau
Copy link
Member

Fixes #149 as the test (and the clipping call) works for exact natural coordinates.

However, we have an example right in the test of a clip with a Float that returns an approximation error:

julia> M = rand(Bool, (10, 10));
       S = SimpleSDMPredictor(M, 0.0, 1.0, 0.0, 1.0);
       cl1 = clip(S; left=0.2, right=0.6, bottom=0.5, top=1.0)
SDM predictor → 5×4 grid with 20 Bool-valued cells
  Latitudes     0.5 ⇢ 1.0
  Longitudes    0.2 ⇢ 0.6000000000000001

I think we should fix clip first, then adapt the test accordingly.

@github-actions
Copy link
Contributor

@codecov-commenter
Copy link

Codecov Report

Base: 47.49% // Head: 53.71% // Increases project coverage by +6.22% 🎉

Coverage data is based on head (737df11) compared to base (a0970e1).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #152      +/-   ##
==========================================
+ Coverage   47.49%   53.71%   +6.22%     
==========================================
  Files          36       47      +11     
  Lines        1196     1493     +297     
==========================================
+ Hits          568      802     +234     
- Misses        628      691      +63     
Flag Coverage Δ
unittests 53.71% <ø> (+6.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...DMDatasets/src/providers/WorldClim/worldclim_v2.jl 92.10% <0.00%> (ø)
...impleSDMDatasets/src/providers/CHELSA/chelsa_v2.jl 90.90% <0.00%> (ø)
SimpleSDMDatasets/src/keychecker.jl 74.13% <0.00%> (ø)
SimpleSDMDatasets/src/types/specifiers.jl 100.00% <0.00%> (ø)
SimpleSDMDatasets/src/interface.jl 63.33% <0.00%> (ø)
...MDatasets/src/providers/CHELSA/chelsa_future_v2.jl 100.00% <0.00%> (ø)
SimpleSDMDatasets/src/downloader.jl 76.66% <0.00%> (ø)
...mpleSDMDatasets/src/providers/EarthEnv/earthenv.jl 86.66% <0.00%> (ø)
...MDatasets/src/providers/CHELSA/chelsa_future_v1.jl 100.00% <0.00%> (ø)
...impleSDMDatasets/src/providers/CHELSA/chelsa_v1.jl 96.55% <0.00%> (ø)
... and 1 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tpoisot tpoisot changed the base branch from main to hotfix/clip February 18, 2023 01:46
@tpoisot tpoisot marked this pull request as ready for review February 18, 2023 01:46
@tpoisot tpoisot merged commit 0131c26 into hotfix/clip Feb 18, 2023
@tpoisot tpoisot deleted the gd/clip-test branch February 18, 2023 01:46
tpoisot added a commit that referenced this pull request Feb 21, 2023
#153)

* 🩹 SimpleSDMLayers version bump

* ✅ test for clipping with natural coordinates (#152)

* 🐛 no use of stride in clip / expand keyword

* 🐛 Update the stitching code to get the right bounding box (#155)

* 🐛 Stitch returns the wrong bounding box in the end
Fixes #154

* 🟩 test the stitch patch

* 🟩 some more tests for the right coordinate

* 🟩 removed a test where the layer type changes

* ➖ drop dependencies for SimpleSDMLayers test

* 🟩 tests with the expand keyword

* GBIF throws 404 (not 410) for deleted resources (#156)

* 🤢 GBIF throws 404 (not 410) for deleted resources

* 🐛 throws an error when the occurrence is not available

* ✅ 404 error on single occurrence is handled

* 🟥 remove the subsetting test (handled by clip)

* 🐛 fix clipping with natural coordinates

* 🐛 fix approximation in displayed coordinate

* 🐛 tests when clipping exactly on the limit

* ✅ add test comparing clip with gdalwarp

* 🐛 missing end for test module

---------

Co-authored-by: Gabriel Dansereau <gabriel.dansereau@umontreal.ca>
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.

Add a test for clipping with exact coordinates
3 participants