diff --git a/src/main.jl b/src/main.jl index 1d21782..b85e751 100644 --- a/src/main.jl +++ b/src/main.jl @@ -65,7 +65,7 @@ function main(; polarisation="VH", orbit="*", threshold=3.0, - folders=["V01R01", "V0M2R4", "V1M0R1", "V1M1R1", "V1M1R2"] + folders=[ "V0M2R4", "V1M1R1", "V1M1R2"] ) if isdir(indir) && isempty(indir) error("Input directory $indir must not be empty") @@ -84,10 +84,8 @@ function main(; filenamelist = [glob("$(sub)/*$(continent)*20M/$(tilefolder)/*$(polarisation)_$(orbit)*.tif", indir) for sub in folders] allfilenames = collect(Iterators.flatten(filenamelist)) - @show allfilenames relorbits = unique([split(basename(x), "_")[5][2:end] for x in allfilenames]) - @show relorbits for relorbit in relorbits for y in years @@ -95,13 +93,11 @@ function main(; @time cube = gdalcube(filenames) path = joinpath(YAXDefaults.workdir[], "$(tilefolder)_rqatrend_$(polarisation)_$(relorbit)_thresh_$(threshold)_year_$(y)") - @show path ispath(path * ".done") && continue ispath(path * "_zerotimesteps.done") && continue tcube = cube[Time=Date(y - 1, 7, 1) .. Date(y + 1, 7, 1)] - @show size(cube) - @show size(tcube) + if size(tcube, 3) == 0 touch(path * "_zerotimesteps.done") continue diff --git a/src/rqatrend.jl b/src/rqatrend.jl index cc388cf..da9ae24 100644 --- a/src/rqatrend.jl +++ b/src/rqatrend.jl @@ -49,7 +49,7 @@ Compute the RQA trend metric for the non-missing time steps of xin, and save it `thresh` specifies the epsilon threshold of the Recurrence Plot computation """ function rqatrend(pix_trend, pix, thresh=2) - pix_trend .= rqatrend_impl(pix; thresh) + pix_trend .= rqatrend_impl(collect(skipmissing(pix)); thresh) end diff --git a/test/testdata.jl b/test/testdata.jl index c203934..4079966 100644 --- a/test/testdata.jl +++ b/test/testdata.jl @@ -1,6 +1,7 @@ @testitem "testdata julia_main" begin import Pkg: Artifacts.@artifact_str, ensure_artifact_installed + using YAXArrays, Zarr ensure_artifact_installed("rqatestdata", "Artifacts.toml") testdatapath = joinpath(artifact"rqatestdata", "RQADeforestationTestData-2.0") @@ -8,7 +9,7 @@ testdir = "tmp/testdata" rm(testdir, recursive=true, force=true) mkpath(testdir) - outdir = "$testdir/out.zarr" + outdir = "$testdir/out" indir = "$testdir/in" cp(testdatapath, indir) @@ -18,10 +19,15 @@ "--continent", "EU", "--in-dir", indir, "--out-dir", outdir, + "--years", "2021" ]) # test normal execution RQADeforestation.julia_main() # test short cut implementation using cache files RQADeforestation.julia_main() + + outpath = joinpath(outdir, "E051N018T3_rqatrend_VH_022_thresh_3.0_year_2021.zarr") + c = Cube(outpath) + @test count(c .< -1.28) > 200 copy!(ARGS, OLD_ARGS) end \ No newline at end of file