diff --git a/benchmark/Artifacts.toml b/benchmark/Artifacts.toml new file mode 100644 index 0000000..9ba9b91 --- /dev/null +++ b/benchmark/Artifacts.toml @@ -0,0 +1,6 @@ +[rqatestdata] +git-tree-sha1 = "1dc9d7aa975de4f5ecc652f34d6bbee706fcb7bd" + + [[rqatestdata.download]] + url = "https://github.com/meggart/RQADeforestationTestData/archive/refs/tags/v2.0.tar.gz" + sha256 = "38a3e66a0505ed9d22c6e065627039089a421b0b143ac4c8d78aac45dd3dd497" diff --git a/benchmark/Project.toml b/benchmark/Project.toml new file mode 100644 index 0000000..0ac1d33 --- /dev/null +++ b/benchmark/Project.toml @@ -0,0 +1,4 @@ +[deps] +BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" +Glob = "c27321d9-0574-5035-807b-f59d2c89b15c" +RQADeforestation = "3f1d9318-18cc-4ffd-9937-04025ce33b74" diff --git a/benchmark/bench_cube.jl b/benchmark/bench_cube.jl new file mode 100644 index 0000000..7b6d646 --- /dev/null +++ b/benchmark/bench_cube.jl @@ -0,0 +1,16 @@ +using RQADeforestation +using BenchmarkTools +using Glob +import Pkg: Artifacts.@artifact_str, ensure_artifact_installed + +ensure_artifact_installed("rqatestdata", "Artifacts.toml") +testdatapath = joinpath(artifact"rqatestdata", "RQADeforestationTestData-2.0") + +testdir = tempname() +rm(testdir, recursive=true, force=true) +mkpath(testdir) + + +filenames = glob("*/*/*/*.tif",testdatapath) +cube = gdalcube(filenames) +@benchmark RQADeforestation.rqatrend(cube) \ No newline at end of file diff --git a/benchmark/bench_full_tile.jl b/benchmark/bench_full_tile.jl new file mode 100644 index 0000000..a89aef9 --- /dev/null +++ b/benchmark/bench_full_tile.jl @@ -0,0 +1,25 @@ +using RQADeforestation +using BenchmarkTools +using Glob +using DimensionalData +using Dates + +tile = "E048N021T3" +continent = "EU" +#lim = Extent(X = (-63.36854472609895, -57.18529373390659), Y = (-2.666626089016638, -1.9161481184310643)) +indir = "/eodc/products/eodc.eu/S1_CSAR_IWGRDH/SIG0/" +folders = ["V0M2R4", "V1M1R1", "V1M1R2"] +corruptedfiles = "corrupted_tiles.txt" +orbit = "A" +pol="VH" + +filenamelist = [glob("$(sub)/*$(continent)*20M/$(tile)/*$(pol)_$(orbit)*.tif", indir) for sub in folders] + +allfilenames = collect(Iterators.flatten(filenamelist)) +relorbits = unique([split(basename(x), "_")[5] for x in allfilenames]) +relorbit = relorbits[2] + +filenames = allfilenames[findall(contains("$(relorbit)_E"), allfilenames)] +cube = gdalcube(filenames, :lazyagg) +tcube = cube[Time=Date(2021,7,1)..Date(2023,6,30)] +@benchmark RQADeforestation.rqatrend(tcube) diff --git a/benchmark/bench_timeseries.jl b/benchmark/bench_timeseries.jl new file mode 100644 index 0000000..464b74f --- /dev/null +++ b/benchmark/bench_timeseries.jl @@ -0,0 +1,18 @@ +using RQADeforestation +using BenchmarkTools + +ts = [-13.9, -16.2, -15.4, -16.1, -16.1, -15.9, -15.200000000000001, -13.200000000000001, -14.200000000000001, + -14.8, -15.9, -14.4, -16.400000000000002, -13.200000000000001, -16.0, -13.3, -13.9, -15.5, -13.600000000000001, + -16.3, -15.200000000000001, -16.900000000000002, -15.5, -14.9, -14.8, -14.600000000000001, -17.5, + -14.600000000000001, -13.200000000000001, -13.100000000000001, -14.600000000000001, -13.4, -14.0, -14.4, + -13.200000000000001, -14.600000000000001, -17.5, -21.150000000000002, -18.8, -15.150000000000002, -14.9, + -15.8, -18.900000000000002, -14.8, -15.5, -17.3, -14.4, -15.600000000000001, -15.8, -14.5, -17.7, -15.4, + -13.700000000000001, -14.5, -15.3, -13.8, -13.5, -15.5, -16.400000000000002, -13.5, -14.600000000000001, + -15.4, -15.0, -14.0, -14.100000000000001, -13.4, -14.4, -15.3, -16.3, -14.4, -13.3, -14.5, -13.4, -14.700000000000001, + -13.9, -12.100000000000001, -14.600000000000001, -15.4, -15.600000000000001, -12.9, -14.8, -17.3, -13.9, + -15.100000000000001, -14.700000000000001, -16.400000000000002, -15.200000000000001, -14.100000000000001, -16.900000000000002, + -15.8, -17.5, -18.2, -13.600000000000001, -17.8, -14.5, -12.8, -16.8, -17.7, -15.4, -15.8, -14.8, -14.4, -16.1, -12.8, -14.700000000000001, -15.5, -14.5] + +pix_trend = [0.0] +threshold = 3.0 +@benchmark RQADeforestation.rqatrend(pix_trend, ts, threshold) \ No newline at end of file diff --git a/benchmark/benchmarks.jl b/benchmark/benchmarks.jl new file mode 100644 index 0000000..d6443e2 --- /dev/null +++ b/benchmark/benchmarks.jl @@ -0,0 +1,7 @@ +using Pkg + +using RQADeforestation +using BenchmarkTools + +const SUITE = BenchmarkGroup() +SUITE["single_timeseries"] = include("bench_timeseries.jl")