-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
π correct check on layer inner type (#146)
* π correct check on layer inner type * π© prepare for tests * βοΈ handle the internal type check gracefully * β read/write test passing
- Loading branch information
Showing
5 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module TestThatWeCanReadStuff | ||
|
||
using SpeciesDistributionToolkit | ||
using Test | ||
|
||
# Get some EarthEnv data | ||
layer = SimpleSDMPredictor(RasterData(EarthEnv, LandCover); layer = 1) | ||
D = SimpleSDMLayers._inner_type(layer) | ||
|
||
# Write the data | ||
f = tempname() | ||
SpeciesDistributionToolkit._write_geotiff(f, [layer]; driver = "GTiff", nodata = typemax(D)) | ||
@test isfile(f) | ||
|
||
# Read the data | ||
layer2 = SpeciesDistributionToolkit._read_geotiff(f, SimpleSDMPredictor) | ||
@test typeof(layer2) <: SimpleSDMPredictor | ||
@test all(values(layer) .== values(layer2)) | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[deps] | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,26 @@ | ||
nothing | ||
using SpeciesDistributionToolkit | ||
using Test | ||
|
||
global anyerrors = false | ||
|
||
tests = [ | ||
"read/write layers" => "01_integration_read.jl", | ||
] | ||
|
||
for test in tests | ||
try | ||
include(test.second) | ||
println("\033[1m\033[32mβ\033[0m\t$(test.first)") | ||
catch e | ||
global anyerrors = true | ||
println("\033[1m\033[31mΓ\033[0m\t$(test.first)") | ||
println("\033[1m\033[38mβ\033[0m\ttest/$(test.second)") | ||
showerror(stdout, e, backtrace()) | ||
println() | ||
break | ||
end | ||
end | ||
|
||
if anyerrors | ||
throw("Tests failed") | ||
end |
e0049b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuliaRegistrator register
e0049b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Registration pull request created: JuliaRegistries/General/77860
After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.
This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via: